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;

public partial class etw_c_m_website : System.Web.UI.Page
{
    public string webid = string.Empty;
    public string usernameid = string.Empty;
    public string company = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie GetCookie = Request.Cookies["cook_admin"];
        if (Request.Cookies["cook_admin"] == null)
        {
            Response.Redirect("index.aspx");
        }
        if (Request.QueryString["webid"] != null && Request.QueryString["userid"] != null)
        {
            webid = Request.QueryString["webid"].ToString();
            usernameid = Request.QueryString["userid"].ToString();
            if (!IsPostBack)
            {
                BindLang();
                etw.etw_web lead = new etw.etw_web();
                lead.webid = Convert.ToInt32(webid);
                lead.GetModel();
                website.Text = Fun.Fancode(lead.website);
                jsqid.Text = lead.jsqid.ToString();
                if (lead.langId.ToString() != "" && lead.langId.ToString() != null)
                {
                    langlist.SelectedValue = lead.langId.ToString();
                }
                etw.etw_user leaduser = new etw.etw_user();
                leaduser.userid = Convert.ToInt32(usernameid);
                leaduser.GetModel();
                company = leaduser.company;
            }
        }
    }
    private void BindLang()
    {
        DataSet ds = DbHelperSQL.Query("select * from etw_language order by id");
        if (ds.Tables[0].Rows.Count > 0)
        {
            langlist.DataSource = ds.Tables[0].DefaultView;
            langlist.DataTextField = "language";
            langlist.DataValueField = "id";
            langlist.DataBind();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        etw.etw_web lead = new etw.etw_web();
        lead.webid = Convert.ToInt32(webid);
        lead.website = Fun.Encode(website.Text.Trim());
        lead.jsqid = Convert.ToInt32(jsqid.Text.Trim());
        lead.langId = Convert.ToInt32(langlist.SelectedValue);
        lead.Update();
        Fun.JsAlerT("修改成功", "customstr.aspx?userid=" + usernameid + "");
    }
}
