using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Fm.Bussiness;

public partial class Admin_sys_webset : BasePage
{


    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            public_select ps = new public_select();
            DataView dv = ps.Getps("Fm_webset","*","");
            //绑定数据
            webname.Text = dv[0]["webname"].ToString();
            weburl.Text = dv[0]["weburl"].ToString();
            indexname.Text = dv[0]["title"].ToString();
            uppath.Text = dv[0]["uppath"].ToString();
            web_keyword.Text = dv[0]["keyword"].ToString();
            web_intro.Text = dv[0]["intro"].ToString();
            banquan.Text = dv[0]["banquan"].ToString();
            beian.Text = dv[0]["beian"].ToString();
            html.Text = dv[0]["html"].ToString();
            foreach (ListItem item in member.Items)
            {
                if (item.Value == (dv[0]["member"].ToString().ToLower()))
                {
                    item.Selected = true;
                }
            }
            foreach (ListItem item in tougao.Items)
            {
                if (item.Value == (dv[0]["tougao"].ToString().ToLower()))
                {
                    item.Selected = true;
                }
            }
           //Response.Write(dv[0]["member"].ToString().ToLower()+" "+dv[0]["tougao"].ToString().ToLower());

        }
    }
    //基本设置修改
    protected void btn_save_Click(object sender, ImageClickEventArgs e)
    {
        sys_webset sys = new sys_webset();
        Fm.EntityClass.Webset webset = new Fm.EntityClass.Webset();
        webset.sid = 1;
        webset.webname = webname.Text;
        webset.weburl = weburl.Text;
        webset.title = indexname.Text;
        webset.uppath = uppath.Text;
        webset.keyword = web_keyword.Text;
        webset.intro = web_intro.Text;
        webset.banquan = banquan.Text;
        webset.beian = beian.Text;
        webset.html = html.Text;
        if (bool.Parse(member.SelectedValue))
        {
            webset.member = 1;
        }
        else
        {
            webset.member = 0;
        }
        if (bool.Parse(tougao.SelectedValue))
        {
            webset.tougao = 1;
        }
        else
        {
            webset.tougao = 0;
        }
        if (sys.Webset_Update(webset))
        {
            Response.Redirect("Erro.aspx?eid=系统基本设置信息修改成功!&url=sys_webset.aspx", false);
        }
        else
        {
            Response.Redirect("Erro.aspx?eid=系统基本设置信息修改失败!&url=" + Request.Url.AbsoluteUri, false);
        }
    }
}
