918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/712bd9e6/ca967f19/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/712bd9e6/ca967f19/App_Web_l0cr3nog.5.cs
?#pragma checksum "D:\wwwroot\bgsciences\wwwroot\sysmanage\files\left\addmanager.aspx.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4BBAE16ABE165A4BD72FD192B5722B131BE5BF18"

#line 1 "D:\wwwroot\bgsciences\wwwroot\sysmanage\files\left\addmanager.aspx.cs"
using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


public partial class sysmanage_files_left_addmanager : System.Web.UI.Page
{
    protected string strtitle = "增长用户";
    protected string strshow = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        login.OnLine();

        if (!IsPostBack)
        {
            //if (Session["UserName"] == null)
            //{
            //    Page.Response.Write("<script language='javascript'> top.window.location = '../../login.aspx' </script>");
            //}
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);
                ViewState["id"] = id;
                strtitle = "编纂用户";
                strshow = "若密码无需批改,则留空不填";
                GetUserGroup();
                BindUserData(id);
            }
            else
            {
                GetUserGroup();
            }

        }
    }

    protected void BindUserData(int id)
    {
        DataTable dt = SQLServerHelper.ExecuteTable("select * from S_Users where id = " + id + "");
        try
        {


            if (dt.Rows.Count > 0)
            {
                this.txt_username.Text = dt.Rows[0]["username"].ToString();
                this.txt_name.Text = dt.Rows[0]["sname"].ToString();
                this.txt_tel.Text = dt.Rows[0]["tel"].ToString();
                this.ddl_group.SelectedValue = dt.Rows[0]["groupid"].ToString();
                if (dt.Rows[0]["ismanage"].ToString() == "3" || dt.Rows[0]["ismanage"].ToString() == "4")
                {
                    this.ddl_type.Enabled = false;
                }
                this.ddl_type.SelectedValue = dt.Rows[0]["ismanage"].ToString();
            }
        }
        catch (Exception ex)
        {

        }
    }


    protected void bt_add_Click(object sender, EventArgs e)
    {
        if (ViewState["id"] != null)
        {

                if (this.txt_pwd.Text.Trim() != null && this.txt_pwd.Text.Trim() != "")
                {

                    string sql = "update S_Users set username = '" + this.txt_username.Text.Trim() + "',passwords = '" + FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text.Trim(), "MD5") + "',sname = '" + this.txt_name.Text.Trim() + "',tel = '" + this.txt_tel.Text.Trim() + "',ismanage = '" + this.ddl_type.SelectedValue + "',groupid = '" + this.ddl_group.SelectedValue + "' where id = " + ViewState["id"] + "";
                    SQLServerHelper.execNonQuery(sql);
                    Response.Redirect("managelist.aspx");
                }
                else
                {
                    string sql = "update S_Users set username = '" + this.txt_username.Text.Trim() + "',sname = '" + this.txt_name.Text.Trim() + "',tel = '" + this.txt_tel.Text.Trim() + "',ismanage = '" + this.ddl_type.SelectedValue + "',groupid = '" + this.ddl_group.SelectedValue + "' where id = " + ViewState["id"] + "";
                    SQLServerHelper.execNonQuery(sql);
                    Response.Redirect("managelist.aspx");
                }
        }
        else
        {
            if (this.txt_pwd.Text.Trim() != null && this.txt_pwd.Text.Trim() != "")
            {
                string sql = "insert into S_Users (username,passwords,sname,tel,ismanage,groupid) values ('" + this.txt_username.Text.Trim() + "','" + FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text.Trim(), "MD5") + "','" + this.txt_name.Text.Trim() + "','" + this.txt_tel.Text.Trim() + "'," + this.ddl_type.SelectedValue + "," + this.ddl_group.SelectedValue + ")";
                SQLServerHelper.execNonQuery(sql);
                Response.Redirect("managelist.aspx");
            }
            else
            {
                MessageBox.Show(this, "请输入密码");
            }

        }
    }

    protected void bt_back_Click(object sender, EventArgs e)
    {
        Response.Redirect("managelist.aspx");
    }
    /// <summary>
    /// 加载用户组权限
    /// </summary>
    protected void GetUserGroup()
    {
        DataTable dt = SQLServerHelper.ExecuteTable("select * from S_Authorization");
        if (dt.Rows.Count > 0)
        {
            this.ddl_group.Items.Clear();
            this.ddl_group.Items.Add(new ListItem("请选择用户组", ""));
            this.ddl_group.DataSource = dt;
            this.ddl_group.DataValueField = "id";
            this.ddl_group.DataTextField = "sname";
            this.ddl_group.DataBind();
        }
    }
}


#line default
#line hidden