Exemplo n.º 1
0
    public void DataBinds()
    {
        int pageCount = 0;
        int Counts    = 0;

        if (this.txtPageSize.Value.ToString() != "" && int.TryParse(txtPageSize.Value.Trim(), out pageCount))
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        List <Hi.Model.SYS_AdminUser> Lorg = new Hi.BLL.SYS_AdminUser().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", false, SearchWhere(), out pageCount, out Counts);

        this.Rpt_OrgUser.DataSource = Lorg;
        this.Rpt_OrgUser.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
        //this.ddlOrg.SelectedValue = this.OrgID == 0 ? ddlOrg.SelectedValue : this.OrgID.ToString();
        this.ddlOrg.SelectedIndex = 0;
    }
Exemplo n.º 2
0
 public void DataBinds()
 {
     Hi.Model.SYS_AdminUser user = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
     if (user != null)
     {
         if (user.UserType != 3 && user.UserType != 4)
         {
             Response.Write("该用户不是机构用户");
         }
         txtLoginName.Value = user.LoginName;
         txtTrueName.Value  = user.TrueName;
         txtPhone.Value     = user.Phone;
         if (user.IsEnabled == 0)
         {
             rdEbleYes.Checked = false;
             rdEbleNo.Checked  = true;
         }
         txtUpwd.Attributes.Add("value", user.LoginPwd);
     }
     else
     {
         Response.Write("数据不存在");
         Response.End();
     }
 }
Exemplo n.º 3
0
    protected void btnModify_Click(object sender, EventArgs e)
    {
        Hi.Model.SYS_AdminUser User = new Hi.BLL.SYS_AdminUser().GetModel(UserID);
        string OldLoginPwd          = this.txtOldPassWord.Value.Trim().ToString();
        string NewLoginPwd          = this.txtNewPassWord.Value.Trim().ToString();
        string ConfrimNewPassWord   = this.txtConfrimNewPassWord.Value.Trim();

        //修改的密码,两次填写不一致
        if (ConfrimNewPassWord == NewLoginPwd)
        {
            if (User.LoginPwd.ToString() == OldLoginPwd)
            {
                if (new Hi.BLL.SYS_AdminUser().UpdatePassWord(NewLoginPwd, UserID.ToString()))
                {
                    JScript.AlertMsgMo(this, "修改成功", "function(){ window.location.href='changePwd.aspx'; }");
                }
            }
            else
            {
                JScript.AlertMsg(this, "原始密码错误,请重新输入!");
                return;
            }
        }
        else
        {
            JScript.AlertMsg(this, "密码填写不一致!");
            return;
        }
    }
Exemplo n.º 4
0
    public void Databind()
    {
        if (KeyID != 0)
        {
            txtusername.Style["display"] = "none";
            Hi.Model.SYS_AdminUser adminuser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
            try
            {
                lblusername.InnerText = adminuser.LoginName;
                txtusername.Value     = adminuser.LoginName;
                txtpwd.Attributes.Add("value", adminuser.LoginPwd);
                txtpwd2.Attributes.Add("value", adminuser.LoginPwd);

                txtturename.Value = adminuser.TrueName;
                txttel.Value      = adminuser.Phone;
                txtRemark.Value   = adminuser.Remark;
                int status = adminuser.IsEnabled;
                this.rdoStatus1.Checked = (status != 1);
                this.rdoStatus0.Checked = (status == 1);
            }
            catch (Exception ex)
            {
            }
        }
    }
Exemplo n.º 5
0
    public void UserDataBind()
    {
        int pageCount = 0;
        int Counts    = 0;
        List <Hi.Model.SYS_AdminUser> LDis = new Hi.BLL.SYS_AdminUser().GetList(Pager.PageSize, Pager.CurrentPageIndex, "Createdate", false, " and isnull(dr,0)=0  and OrgID=" + KeyID + " ", out pageCount, out Counts);

        this.Rpt_User.DataSource = LDis;
        this.Rpt_User.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Exemplo n.º 6
0
    /// <summary>
    /// 后台帐号
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        List <Hi.Model.SYS_AdminUser> ListUsers = new Hi.BLL.SYS_AdminUser().GetList("", "", "");

        for (int i = 0; i < ListUsers.Count; i++)
        {
            Hi.Model.SYS_AdminUser user = new Hi.BLL.SYS_AdminUser().GetModel(ListUsers[i].ID);
            user.LoginPwd = SHA1Encrypt(SHA1Encrypt(ListUsers[i].LoginPwd));
            bool result = new Hi.BLL.SYS_AdminUser().Update(user);
        }
    }
Exemplo n.º 7
0
 public void DataBinds()
 {
     if (KeyID > 0)
     {
         Hi.Model.BD_Org Org = new Hi.BLL.BD_Org().GetModel(KeyID);
         if (Org != null)
         {
             if (UserType == 3 || UserType == 4)
             {
                 if (Org.ID != OrgID)
                 {
                     Response.Write("数据错误");
                     Response.End();
                 }
             }
             Atitle.InnerText   = "机构编辑";
             txtOrgName.Value   = Org.OrgName;
             txtPrincipal.Value = Org.Principal;
             txtPhone.Value     = Org.Phone;
             if (Org.IsEnabled == 0)
             {
                 rdEbleYes.Checked = false;
                 rdEbleNo.Checked  = true;
             }
             txtSortIndex.Value = Org.SortIndex;
             txtRemark.Value    = Org.Remark;
             List <Hi.Model.SYS_AdminUser> user = new Hi.BLL.SYS_AdminUser().GetList("", "  isnull(dr,0)=0 and  orgid='" + KeyID + "' and usertype in(3)", "");
             if (user.Count > 0)
             {
                 txtUsername.Disabled  = true;
                 txtUserPhone.Disabled = true;
                 txtUsername.Value     = user[0].LoginName;
                 txtUserPhone.Value    = user[0].Phone;
                 txtUserTrueName.Value = user[0].TrueName;
                 txtUpwd.Attributes.Add("value", user[0].LoginPwd);
                 txtUpwds.Attributes.Add("value", user[0].LoginPwd);
             }
         }
         else
         {
             Response.Write("数据错误");
             Response.End();
         }
     }
     else
     {
         txtUpwd.Attributes.Add("value", "123456");
         txtUpwds.Attributes.Add("value", "123456");
     }
 }
Exemplo n.º 8
0
 protected void btn_Del(object sender, EventArgs e)
 {
     Hi.Model.SYS_AdminUser AdminUser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
     if (AdminUser != null)
     {
         AdminUser.dr         = 1;
         AdminUser.ts         = DateTime.Now;
         AdminUser.modifyuser = UserID;
         if (new Hi.BLL.SYS_AdminUser().Delete(KeyID))
         {
             //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='UserList.aspx'; }");
             Response.Redirect("../Role/RoleInfo.aspx?KeyID=" + RoleID);
         }
     }
 }
Exemplo n.º 9
0
    public void Bind()
    {
        int pageSize  = 5;
        int pageCount = 0;
        int Counts    = 0;

        Pager.PageSize = pageSize;
        List <Hi.Model.SYS_AdminUser> LAdminuser = new Hi.BLL.SYS_AdminUser().GetList
                                                       (Pager.PageSize, Pager.CurrentPageIndex, "id", false, "and RoleID=" + KeyID + "  and isnull(dr,0)=0", out pageCount, out Counts);

        this.rpDtl.DataSource = LAdminuser;
        this.rpDtl.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Exemplo n.º 10
0
 public void DataBinds()
 {
     if (KeyID != 0)
     {
         Hi.Model.SYS_AdminUser adminuser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
         lblusername.InnerText = adminuser.LoginName;
         lbltruename.InnerText = adminuser.TrueName;
         lblphone.InnerText    = adminuser.Phone;
         lblRemark.InnerText   = adminuser.Remark;
         lblstate.InnerText    = adminuser.IsEnabled == 1 ? "启用" : "禁用";
     }
     else
     {
         Response.Redirect("../Role/RoleInfo.aspx?KeyID=" + RoleID);
     }
 }
Exemplo n.º 11
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     Hi.Model.SYS_AdminUser user = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
     if (user != null)
     {
         if (txtUpwd.Text.Trim() != user.LoginPwd)
         {
             user.LoginPwd = Util.md5(txtUpwd.Text.Trim());
         }
         user.TrueName   = Common.NoHTML(txtTrueName.Value.Trim());
         user.IsEnabled  = rdEbleYes.Checked ? 1 : 0;
         user.ts         = DateTime.Now;
         user.modifyuser = UserID;
         if (new Hi.BLL.SYS_AdminUser().Update(user))
         {
             Response.Redirect("OrgUserInfo.aspx?KeyID=" + KeyID);
         }
     }
 }
Exemplo n.º 12
0
    public bool DisExistsAttribute(string name, string value, string id = "")
    {
        bool exists = false;

        if (!string.IsNullOrEmpty(id))
        {
            List <Hi.Model.SYS_AdminUser> Adminuser = new Hi.BLL.SYS_AdminUser().GetList("", " " + name + "='" + value + "' and id<>'" + id + "' and isnull(dr,0)=0 ", "");
            if (Adminuser.Count > 0)
            {
                exists = true;
            }
        }
        else
        {
            List <Hi.Model.SYS_AdminUser> Adminuser = new Hi.BLL.SYS_AdminUser().GetList("", " " + name + "='" + value + "' and isnull(dr,0)=0 ", "");
            if (Adminuser.Count > 0)
            {
                exists = true;
            }
        }
        return(exists);
    }
Exemplo n.º 13
0
 protected void btn_NUse(object sender, EventArgs e)
 {
     Hi.Model.BD_Org Org = new Hi.BLL.BD_Org().GetModel(KeyID);
     if (Org != null)
     {
         Org.IsEnabled  = 0;
         Org.ts         = DateTime.Now;
         Org.modifyuser = UserID;
         if (new Hi.BLL.BD_Org().Update(Org))
         {
             List <Hi.Model.SYS_AdminUser> user = new Hi.BLL.SYS_AdminUser().GetList("", " isnull(dr,0)=0 and orgid=" + KeyID + "", "");
             foreach (Hi.Model.SYS_AdminUser model1 in user)
             {
                 model1.IsEnabled  = 0;
                 model1.ts         = DateTime.Now;
                 model1.modifyuser = UserID;
                 new Hi.BLL.SYS_AdminUser().Update(model1);
             }
             JScript.AlertMsgMo(this, "用户禁用成功", "function(){ window.location.href='OrgList.aspx'; }");
         }
     }
 }
Exemplo n.º 14
0
    public void Databind()
    {
        if (Request["ntype"] == "1")
        {
            if (KeyID != 0)
            {
                txtusername.Style["display"] = "none";
                Hi.Model.SYS_AdminUser adminuser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
                try
                {
                    lblusername.InnerText = adminuser.LoginName;
                    lblusername.Disabled  = true;
                    txtusername.Value     = adminuser.LoginName;
                    txtpwd.Attributes.Add("value", adminuser.LoginPwd);
                    txtpwd2.Attributes.Add("value", adminuser.LoginPwd);
                    txtturename.Value = adminuser.TrueName;
                    txttel.Value      = adminuser.Phone;
                    int usertype = adminuser.UserType;
                    //this.rdotype1.Checked = (usertype==1);
                    this.rdotype2.Checked = (usertype != 1);
                    //this.rdotype1.Disabled = true;

                    txtRemark.Value = adminuser.Remark;
                    int status = adminuser.IsEnabled;
                    this.rdoStatus1.Checked = (status != 1);
                    this.rdoStatus0.Checked = (status == 1);
                    if (adminuser.SalesManID != 0)
                    {
                        SalesManNames.InnerText = "(机构业务员:" + Common.getsalemanName(adminuser.SalesManID.ToString()) + ")";
                        rdotype3.Checked        = true;
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
    }
Exemplo n.º 15
0
 public void DataBinds()
 {
     Hi.Model.SYS_AdminUser user = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
     if (user != null)
     {
         if (user.UserType != 3 && user.UserType != 4)
         {
             Response.Write("该用户不是机构用户");
         }
         lblLoginName.InnerText = user.LoginName;
         lblTrueName.InnerText  = user.TrueName;
         lblOrgName.InnerText   = Common.GetOrgValue(user.OrgID, "OrgName").ToString();
         lblUtype.InnerText     = Common.GetUTypeName(user.UserType.ToString());
         lblIsEnabled.InnerHtml = user.IsEnabled == 1 ? "启用" : "<i style='color:red'>禁用</i>";
         lblPhone.InnerText     = user.Phone;
         lblRemark.InnerText    = user.Remark;
     }
     else
     {
         Response.Write("数据不存在");
         Response.End();
     }
 }
Exemplo n.º 16
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (KeyID > 0)
     {
         Hi.Model.BD_Org org = new Hi.BLL.BD_Org().GetModel(KeyID);
         if (org != null)
         {
             if (Common.OrgExistsAttribute("OrgName", txtOrgName.Value.Trim(), KeyID.ToString()))
             {
                 JScript.AlertMsg(this, "该机构名称已存在。");
                 return;
             }
             org.OrgName    = Common.NoHTML(txtOrgName.Value.Trim());
             org.Principal  = Common.NoHTML(txtPrincipal.Value.Trim());
             org.Phone      = Common.NoHTML(txtPhone.Value.Trim());
             org.IsEnabled  = rdEbleYes.Checked ? 1 : 0;
             org.SortIndex  = Common.NoHTML(txtSortIndex.Value.Trim());
             org.Remark     = Common.NoHTML(txtRemark.Value.Trim());
             org.ts         = DateTime.Now;
             org.modifyuser = UserID;
             if (new Hi.BLL.BD_Org().Update(org))
             {
                 List <Hi.Model.SYS_AdminUser> user = new Hi.BLL.SYS_AdminUser().GetList("", "  isnull(dr,0)=0 and  orgid='" + KeyID + "' and usertype in(3)", "");
                 if (user.Count > 0)
                 {
                     if (user[0].LoginPwd != txtUpwd.Text.Trim())
                     {
                         user[0].LoginPwd = Util.md5(txtUpwd.Text.Trim());
                     }
                     user[0].TrueName   = Common.NoHTML(txtUserTrueName.Value.Trim());
                     user[0].IsEnabled  = rdEbleYes.Checked ? 1 : 0;
                     user[0].ts         = DateTime.Now;
                     user[0].modifyuser = UserID;
                     new Hi.BLL.SYS_AdminUser().Update(user[0]);
                     Response.Redirect("OrgInfo.aspx?KeyID=" + KeyID + "&type=2&page=1");
                 }
                 else
                 {
                     Hi.Model.SYS_AdminUser userModel = new Hi.Model.SYS_AdminUser();
                     userModel.OrgID        = KeyID;
                     userModel.UserType     = 3;
                     userModel.IsEnabled    = rdEbleYes.Checked ? 1 : 0;
                     userModel.LoginName    = Common.NoHTML(txtUsername.Value.Trim());
                     userModel.LoginPwd     = Util.md5(txtUpwd.Text.Trim());
                     userModel.Phone        = Common.NoHTML(txtUserPhone.Value.Trim());
                     userModel.TrueName     = Common.NoHTML(txtUserTrueName.Value.Trim());
                     userModel.CreateDate   = DateTime.Now;
                     userModel.CreateUserID = UserID;
                     userModel.ts           = DateTime.Now;
                     userModel.modifyuser   = UserID;
                     if (new Hi.BLL.SYS_AdminUser().Add(userModel) > 0)
                     {
                         Response.Redirect("OrgInfo.aspx?KeyID=" + KeyID + "&type=2&page=1");
                     }
                     else
                     {
                         new Hi.BLL.BD_Org().Delete(KeyID);
                     }
                 }
             }
         }
     }
     else
     {
         if (Common.OrgExistsAttribute("OrgName", txtOrgName.Value.Trim()))
         {
             JScript.AlertMsg(this, "该机构名称已存在。");
             return;
         }
         if (Common.SysUserExistsAttribute("LoginName", txtUsername.Value.Trim()))
         {
             JScript.AlertMsg(this, "该登录帐号已存在。");
             return;
         }
         Hi.Model.BD_Org org = new Hi.Model.BD_Org();
         org.OrgName    = Common.NoHTML(txtOrgName.Value.Trim());
         org.Principal  = Common.NoHTML(txtPrincipal.Value.Trim());
         org.Phone      = Common.NoHTML(txtPhone.Value.Trim());
         org.IsEnabled  = rdEbleYes.Checked ? 1 : 0;
         org.SortIndex  = Common.NoHTML(txtSortIndex.Value.Trim());
         org.Remark     = Common.NoHTML(txtRemark.Value.Trim());
         org.ts         = DateTime.Now;
         org.modifyuser = UserID;
         int Orgid = 0;
         if ((Orgid = new Hi.BLL.BD_Org().Add(org)) > 0)
         {
             Hi.Model.SYS_AdminUser user = new Hi.Model.SYS_AdminUser();
             user.OrgID        = Orgid;
             user.UserType     = 3;
             user.IsEnabled    = rdEbleYes.Checked ? 1 : 0;
             user.LoginName    = Common.NoHTML(txtUsername.Value.Trim());
             user.LoginPwd     = Util.md5(txtUpwd.Text.Trim());
             user.Phone        = Common.NoHTML(txtUserPhone.Value.Trim());
             user.TrueName     = Common.NoHTML(txtUserTrueName.Value.Trim());
             user.CreateDate   = DateTime.Now;
             user.CreateUserID = UserID;
             user.ts           = DateTime.Now;
             user.modifyuser   = UserID;
             if (new Hi.BLL.SYS_AdminUser().Add(user) > 0)
             {
                 Response.Redirect("OrgInfo.aspx?KeyID=" + Orgid + "&type=2&page=1");
             }
             else
             {
                 new Hi.BLL.BD_Org().Delete(Orgid);
             }
         }
     }
 }
Exemplo n.º 17
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Hi.Model.SYS_AdminUser Adminuser = null;

        if (txtpwd.Text.Trim() != txtpwd2.Text.Trim())
        {
            JScript.AlertMsg(this, "两次密码不一致,请确认!");
            return;
        }
        if (KeyID != 0)
        {
            Adminuser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID);
            if (Adminuser.LoginPwd != Common.NoHTML(txtpwd.Text.Trim()))
            {
                Adminuser.LoginPwd = Util.md5(Common.NoHTML(txtpwd.Text.Trim()));
            }
            Adminuser.TrueName = Common.NoHTML(txtturename.Value.Trim());
            Adminuser.Phone    = Common.NoHTML(txttel.Value.Trim());
            Adminuser.Remark   = Common.NoHTML(txtRemark.Value.Trim());
            if (this.rdoStatus1.Checked)
            {
                Adminuser.IsEnabled = 0;
            }
            else
            {
                Adminuser.IsEnabled = 1;
            }
            if (this.rdotype2.Checked)
            {
                Adminuser.UserType = 2;//系统用户
            }
            if (salemanid.Value != "0")
            {
                Adminuser.UserType = 4;//系统用户
            }
            Adminuser.ts         = DateTime.Now;
            Adminuser.modifyuser = UserID;
            Adminuser.SalesManID = Convert.ToInt32(salemanid.Value);
            Adminuser.OrgID      = Convert.ToInt32(orgids.Value);
            if (new Hi.BLL.SYS_AdminUser().Update(Adminuser))
            {
                //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='UserInfo.aspx?KeyID=" + KeyID + "'; }");
                Response.Redirect("UserInfo.aspx?KeyID=" + KeyID);
            }
        }
        else
        {
            Adminuser           = new Hi.Model.SYS_AdminUser();
            Adminuser.LoginName = Common.NoHTML(txtusername.Value.Trim());
            if (DisExistsAttribute("LoginName", Adminuser.LoginName))
            {
                JScript.AlertMsg(this, "该登录帐号已存在。");
                return;
            }
            Adminuser.LoginPwd = Util.md5(txtpwd.Text.Trim());
            Adminuser.TrueName = Common.NoHTML(txtturename.Value.Trim());
            Adminuser.Phone    = Common.NoHTML(txttel.Value.Trim());
            if (this.rdotype2.Checked)
            {
                Adminuser.UserType = 2;//系统用户
            }
            if (salemanid.Value != "0")
            {
                Adminuser.UserType = 4;//系统用户
            }
            Adminuser.Remark = Common.NoHTML(txtRemark.Value.Trim());
            Adminuser.RoleID = Convert.ToInt32(Request["RoleID"]);
            if (this.rdoStatus1.Checked)
            {
                Adminuser.IsEnabled = 0;
            }
            else
            {
                Adminuser.IsEnabled = 1;
            }

            //标准参数
            Adminuser.CreateDate   = DateTime.Now;
            Adminuser.CreateUserID = UserID;
            Adminuser.ts           = DateTime.Now;
            Adminuser.modifyuser   = UserID;
            Adminuser.SalesManID   = Convert.ToInt32(salemanid.Value);
            Adminuser.OrgID        = Convert.ToInt32(orgids.Value);
            int newuserid = 0;
            newuserid = new Hi.BLL.SYS_AdminUser().Add(Adminuser);
            if (newuserid > 0)
            {
                Response.Redirect("../Role/RoleInfo.aspx?KeyID=" + Request["RoleID"]);
            }
        }
    }
Exemplo n.º 18
0
    protected void Bind()
    {
        string str = string.Empty;

        if (KeyID > 0)
        {
            //修改时控制账户类型是否可用
            ddltype.Disabled = false;

            Hi.Model.SYS_PaymentBank bankModel = new Hi.BLL.SYS_PaymentBank().GetModel(KeyID);

            this.txtDisUser.Value     = bankModel.AccountName;//账户名称
            this.txtbankcode.Value    = bankModel.bankcode;
            this.txtbankAddress.Value = bankModel.bankAddress;
            //this.txtphone.InnerText = bankModel.vdef4;
            this.hid_tel.Value     = bankModel.vdef4;
            this.hidProvince.Value = bankModel.bankPrivate;
            this.hidCity.Value     = bankModel.bankCity;
            this.hidArea.Value     = bankModel.vdef1;
            this.chkIsno.Checked   = bankModel.Isno == 1 ? true : false;
            this.txtRemark.Value   = bankModel.Remark;

            //现有银行列表
            string bankID_str = "102,103,104,105,301,100,303,305,306,302,310,309,401,403,307,308";
            string BankID     = Convert.ToString(bankModel.BankID);

            bool index = bankID_str.Contains(BankID);
            if (index)
            {
                this.ddlbank.Value = Convert.ToString(bankModel.BankID);
            }
            else
            {
                this.ddlbank.Items.Insert(0, new ListItem(new Hi.BLL.PAY_PrePayment().GetBankNameBYbankID(BankID), BankID));
                this.ddlbank.SelectedIndex = 0;
            }

            this.ddltype.Value = Convert.ToString(bankModel.type);
            if (bankModel.type == 11)
            {
                this.tbdis.Visible      = true;
                this.SltPesontype.Value = bankModel.vdef2;
                this.txtpesoncode.Value = bankModel.vdef3;
            }
            else
            {
                this.tbdis.Visible = false;
            }
        }
        else
        {
            //获取管理员手机号码
            string phone = new Hi.BLL.SYS_AdminUser().GetModel(UserID).Phone.ToString();
            // this.txtphone.InnerText = phone;
            this.hid_tel.Value = phone;
            //设置默认值
            ddltype.Value      = "11";
            SltPesontype.Value = "0";

            //判断是否显示默认账户
            List <Hi.Model.SYS_PaymentBank> Sysl = new Hi.BLL.SYS_PaymentBank().GetList("", " Isno=1", "");
            int num = Sysl.Count;
            if (num >= 1)
            {
                this.chkIsno.Checked = false;
            }
        }
    }
Exemplo n.º 19
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        try
        {
            string dt         = DateTime.Now.ToString();
            string adminName  = Common.NoHTML(this.txtLoginId.Value.Trim());
            string adminPwd   = this.txtPwd.Value.Trim();
            string admintcode = Common.NoHTML(this.txtcode.Value.Trim());
            string Chckcode   = Session["CheckCode"] != null ? Session["CheckCode"].ToString() : "";
            if (Util.IsEmpty(adminName))
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('请输入用户名!');</script>");
                this.txtLoginId.Focus();
                return;
            }

            if (Util.IsEmpty(adminPwd))
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('请输入密码!');</script>");
                this.txtPwd.Focus();
                return;
            }

            if (admintcode == "")
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('请输入验证码!');</script>");
                return;
            }
            if (admintcode != Chckcode)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('验证码输入错误!');</script>");
                this.txtcode.Value = "";
                return;
            }
            if (DBHelper.IsOpen() == false)
            {
                JScript.ShowAlert(this, "系统无法连接数据库服务器,请联系管理员!");
                return;
            }

            Hi.Model.SYS_AdminUser model = new Hi.BLL.SYS_AdminUser().GetModelByName(adminName);

            if (model == null)
            {
                //登录录日志
                //Utils.EditLog("安全日志",adminName, "用户" + adminName + "登录管理系统失败,该用户不存在。", "系统安全模块", "Admin/login.aspx", 0, 0);

                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('用户不存在!');</script>");
                this.txtLoginId.Focus();
                return;
            }
            else
            {
                if (Util.SHA1Encrypt(Util.SHA1Encrypt(model.LoginPwd)) == adminPwd)
                {
                    if (model.IsEnabled == 0)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('您的账户目前处在禁用状态,不能登录!');</script>");
                        return;
                    }
                    else
                    {
                        //保存登录信息

                        //保存Session信息
                        Session["AdminUser"]     = model;
                        Session["AdminUserDate"] = dt;
                        Session["UserType"]      = model.UserType;

                        //登录成功记录日志
                        Utils.EditLog("安全日志", adminName, "用户" + adminName + "登录管理系统成功。", "系统安全模块", "Admin/login.aspx", 0, 1, 0);
                        //Response.Redirect("index.aspx");

                        //Cookie记录登录名
                        HttpCookie cookie = new HttpCookie("LoginId", model.LoginName);
                        cookie.Expires  = DateTime.Now.AddDays(7);
                        cookie.HttpOnly = true;
                        Response.Cookies.Add(cookie);

                        //添加token验证
                        string MyTokenKey     = "__MYToken";
                        string MyUserNameKey  = "__MYUserName";
                        var    myTokenValue   = Guid.NewGuid().ToString("N");
                        var    responseCookie = new HttpCookie(MyTokenKey)
                        {
                            HttpOnly = true,
                            Value    = myTokenValue,
                            Expires  = DateTime.Now.AddDays(7)
                        };
                        Response.Cookies.Set(responseCookie);
                        Session[MyUserNameKey] = Util.md5(adminName + Util._salt);
                        Session[MyTokenKey]    = myTokenValue;

                        Response.Redirect("index.aspx");
                    }
                }
                else
                {
                    //登录录日志
                    Utils.EditLog("安全日志", adminName, "用户" + adminName + "登录管理系统失败,输入的密码错误。", "系统安全模块", "Admin/login.aspx", 0, 0, 1);
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('用户名或密码错误!');</script>");
                    this.txtPwd.Focus();
                    return;
                }
            }
        }
        catch (System.Threading.ThreadAbortException)
        {
            //捕捉线程终止异常   不处理
        }
        catch (Exception ex)
        {
            Tiannuo.LogHelper.LogHelper.Error("Error", ex);
            return;
        }
    }