示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (CheckAdminLogin())
            return;//已经登录过了

        string validate = StringHelp.FilterSymbolStr(q("validate"));
        if (string.IsNullOrEmpty(validate))
            return;//参数丢失;
        if (string.Compare(validate, Session["LVNum"].ToString(), true) == 0)//不区分大小写比较验证码
        {
            string count = q("paramName");
            string pwd = q("paramPwd");

            if (string.IsNullOrEmpty(count) || string.IsNullOrEmpty(pwd))
                Response.Write("1|" + Test_BUL.sysParam.ErrorPageTip("1"));
            if (RequestCheck.CheckKeyWord(count) || RequestCheck.CheckKeyWord(pwd))
                Response.Write("3|" + Test_BUL.sysParam.ErrorPageTip("3"));
            else
            {
                string strsql = common.GetCustomDSsql("tb_sys_admin", "id,count,password,loginIP,loginTime,telephone,email,sex,birthday,createTime,roleid,adminTag,AccountState,PowerLeave ", " count='" + count + "' ");
                DataSet ds = common.GetList(strsql);
                if (Tools.Validator.CheckDataSet(ds, 0))
                {
                    if (ds.Tables[0].Rows[0]["password"].ToString() == EncryptAdmin(pwd))
                    {
                        string state = ds.Tables[0].Rows[0]["AccountState"].ToString();
                        //账号状态:10正常,20冻结,30禁用
                        if (state == "20")
                            Response.Write("20|" + Test_BUL.sysParam.ErrorPageTip("11"));
                        else if (state == "30")
                            Response.Write("30|" + Test_BUL.sysParam.ErrorPageTip("12"));
                        else
                        {
                            string tempRoleId = ds.Tables[0].Rows[0]["roleid"].ToString();
                            string tempAdminTag = ds.Tables[0].Rows[0]["adminTag"].ToString();

                            if (string.IsNullOrEmpty(tempRoleId) || state != "10" || string.IsNullOrEmpty(tempAdminTag))
                                Response.Write("14|" + Test_BUL.sysParam.ErrorPageTip("14"));
                            else
                            {
                                SetUserCookie(ds.Tables[0]);//用户信息写入Cookies
                                Test_BUL.sys_admin blladmin = new Test_BUL.sys_admin(); //更新登录IP和登录时间
                                blladmin.UpdateLogin(count, Tools.IPHelp.ClientIP, DateTime.Now);
                                Response.Write("10|" + Test_BUL.sysParam.ErrorPageTip("10"));
                            }
                        }
                    }
                    else
                        Response.Write("9|" + Test_BUL.sysParam.ErrorPageTip("9"));
                }
                else
                    Response.Write("8|" + Test_BUL.sysParam.ErrorPageTip("8"));
            }
        }
        else
            Response.Write("15|" + Test_BUL.sysParam.ErrorPageTip("15"));
    }
示例#2
0
    /// <summary>
    /// 保存操作
    /// </summary>
    protected void btnSend_Click(object sender, EventArgs e)
    {
        Test_BUL.sys_admin   bulAdmin   = new Test_BUL.sys_admin();
        Test_Model.sys_admin modeladmin = new Test_Model.sys_admin();

        string  tempCount = this.txtcount.Value.Trim();
        DataSet temds     = common.GetList(" select [count] FROM tb_sys_admin where [count]='" + tempCount + "' ");

        if (Tools.Validator.CheckDataSet(temds, 0))
        {
            FinalMessage("此账号已经存在,请更换!", "Add_SysUser.aspx", 1);
        }

        modeladmin.count        = tempCount;
        modeladmin.password     = EncryptAdmin(this.txtPwd.Text.Trim());
        modeladmin.loginIP      = GetUserIp;
        modeladmin.loginTime    = null;
        modeladmin.telephone    = this.txtTelephone.Value.Trim();
        modeladmin.email        = this.txtEmail.Value.Trim();
        modeladmin.sex          = Tools.StringHelp.GetInt(this.rbSex.SelectedValue) == 1 ? true : false;
        modeladmin.birthday     = Tools.StringHelp.GetDateTime(this.txtBirthday.Value.Trim());
        modeladmin.createTime   = DateTime.Now;
        modeladmin.roleid       = Tools.StringHelp.GetInt(this.ddlRole.SelectedValue);
        modeladmin.AccountState = 10;
        modeladmin.PowerLeave   = this.ddlPowerLeave.SelectedValue;

        //判断超管标记
        if (adminGetadminTag == Test_BUL.sysParam.AdministratorTagH)
        {
            if (this.Page.FindControl("chkIsAdmin") != null && this.chkIsAdmin.Checked == true)
            {
                modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagH);//符合条件
            }
            else
            {
                modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//普通的系统用户
            }
        }
        else
        {
            modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//当前用户不具有添加超管的权限
        }
        if (bulAdmin.Add(modeladmin) > 0)
        {
            Response.Redirect("Manage_SysUser.aspx");
        }
        else
        {
            FinalMessage("新增用户失败!", "Add_SysUser.aspx", 1);
        }
    }
示例#3
0
    /// <summary>
    /// 保存操作
    /// </summary>
    protected void btnSend_Click(object sender, EventArgs e)
    {
        Test_BUL.sys_admin bulAdmin = new Test_BUL.sys_admin();
        Test_Model.sys_admin modeladmin = new Test_Model.sys_admin();

        string tempCount = this.txtcount.Value.Trim();
        DataSet temds = common.GetList(" select [count] FROM tb_sys_admin where [count]='" + tempCount + "' ");
        if (Tools.Validator.CheckDataSet(temds, 0))
            FinalMessage("此账号已经存在,请更换!", "Add_SysUser.aspx", 1);

        modeladmin.count = tempCount;
        modeladmin.password = EncryptAdmin(this.txtPwd.Text.Trim());
        modeladmin.loginIP = GetUserIp;
        modeladmin.loginTime = null;
        modeladmin.telephone = this.txtTelephone.Value.Trim();
        modeladmin.email = this.txtEmail.Value.Trim();
        modeladmin.sex = Tools.StringHelp.GetInt(this.rbSex.SelectedValue) == 1 ? true : false;
        modeladmin.birthday = Tools.StringHelp.GetDateTime(this.txtBirthday.Value.Trim());
        modeladmin.createTime = DateTime.Now;
        modeladmin.roleid = Tools.StringHelp.GetInt(this.ddlRole.SelectedValue);
        modeladmin.AccountState = 10;
        modeladmin.PowerLeave = this.ddlPowerLeave.SelectedValue;

        //判断超管标记
        if (adminGetadminTag == Test_BUL.sysParam.AdministratorTagH)
        {
            if (this.Page.FindControl("chkIsAdmin") != null && this.chkIsAdmin.Checked == true)
                modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagH);//符合条件
            else
                modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//普通的系统用户
        }
        else
            modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//当前用户不具有添加超管的权限

        if (bulAdmin.Add(modeladmin) > 0)
            Response.Redirect("Manage_SysUser.aspx");
        else
            FinalMessage("新增用户失败!", "Add_SysUser.aspx", 1);
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (CheckAdminLogin())
        {
            return;//已经登录过了
        }
        string validate = StringHelp.FilterSymbolStr(q("validate"));

        if (string.IsNullOrEmpty(validate))
        {
            return;                                                           //参数丢失;
        }
        if (string.Compare(validate, Session["LVNum"].ToString(), true) == 0) //不区分大小写比较验证码
        {
            string count = q("paramName");
            string pwd   = q("paramPwd");

            if (string.IsNullOrEmpty(count) || string.IsNullOrEmpty(pwd))
            {
                Response.Write("1|" + Test_BUL.sysParam.ErrorPageTip("1"));
            }
            if (RequestCheck.CheckKeyWord(count) || RequestCheck.CheckKeyWord(pwd))
            {
                Response.Write("3|" + Test_BUL.sysParam.ErrorPageTip("3"));
            }
            else
            {
                string  strsql = common.GetCustomDSsql("tb_sys_admin", "id,count,password,loginIP,loginTime,telephone,email,sex,birthday,createTime,roleid,adminTag,AccountState,PowerLeave ", " count='" + count + "' ");
                DataSet ds     = common.GetList(strsql);
                if (Tools.Validator.CheckDataSet(ds, 0))
                {
                    if (ds.Tables[0].Rows[0]["password"].ToString() == EncryptAdmin(pwd))
                    {
                        string state = ds.Tables[0].Rows[0]["AccountState"].ToString();
                        //账号状态:10正常,20冻结,30禁用
                        if (state == "20")
                        {
                            Response.Write("20|" + Test_BUL.sysParam.ErrorPageTip("11"));
                        }
                        else if (state == "30")
                        {
                            Response.Write("30|" + Test_BUL.sysParam.ErrorPageTip("12"));
                        }
                        else
                        {
                            string tempRoleId   = ds.Tables[0].Rows[0]["roleid"].ToString();
                            string tempAdminTag = ds.Tables[0].Rows[0]["adminTag"].ToString();

                            if (string.IsNullOrEmpty(tempRoleId) || state != "10" || string.IsNullOrEmpty(tempAdminTag))
                            {
                                Response.Write("14|" + Test_BUL.sysParam.ErrorPageTip("14"));
                            }
                            else
                            {
                                SetUserCookie(ds.Tables[0]);                            //用户信息写入Cookies
                                Test_BUL.sys_admin blladmin = new Test_BUL.sys_admin(); //更新登录IP和登录时间
                                blladmin.UpdateLogin(count, Tools.IPHelp.ClientIP, DateTime.Now);
                                Response.Write("10|" + Test_BUL.sysParam.ErrorPageTip("10"));
                            }
                        }
                    }
                    else
                    {
                        Response.Write("9|" + Test_BUL.sysParam.ErrorPageTip("9"));
                    }
                }
                else
                {
                    Response.Write("8|" + Test_BUL.sysParam.ErrorPageTip("8"));
                }
            }
        }
        else
        {
            Response.Write("15|" + Test_BUL.sysParam.ErrorPageTip("15"));
        }
    }