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 System.Data.SqlClient;

public partial class WTOSYSadmin_vipmag_vipedit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["WtoRightName"] == null)
        {
            Response.Redirect("~/SYSADMIN/main/error.aspx?err=非法登陆!或系统超时，请刷新后重新登录");
        }
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        string isopen = "";
        if (this.open.Checked)
        {
            isopen = "open";
        }
        else
        {
            isopen = "close";
        }
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd = new SqlCommand("select OwnedUser,ConpanyName,DomainNames,setdo,EndTime from UserAdmin where id=10000001", conn);
        SqlDataReader sdr = smd.ExecuteReader();
        sdr.Read();
        string OwnedUser = sdr["OwnedUser"].ToString();
        string ConpanyName = sdr["ConpanyName"].ToString();
        string DomainNames = sdr["DomainNames"].ToString();
        string setdo = sdr["setdo"].ToString();
        string EndTime = sdr["EndTime"].ToString();
        sdr.Close();
        conn.Close();
        string sql = "insert into UserAdmin(OwnedUser,ConpanyName,UserName,UserPwd,DomainNames,AddTime,EndTime,Email,IsOpen,linkpeaplo,MTemp,setdo,userlx) values('" + OwnedUser + "','" + ConpanyName + "','" + this.UserName.Text + "','" + this.UserPwd.Text + "','" + DomainNames + "','" + DateTime.Now.ToString() + "','1','" + this.Email.Text + "','"+isopen+"','" + this.linkpeaplo.Text + "','"+MTemp.Text+"','"+setdo+"','5')";
        if (Doadmin.Exec(sql))
        {
            Response.Write("<script>alert('修改成功!');location.href='SysMag.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('此次操作失败!')</script>");
        }
    }
}
