Example #1
0
        protected void btnLogin_OnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbxAccount.Text))
            {
                WebUtil.Alert("用户名不能为空!");
                return;
            }
            if (string.IsNullOrWhiteSpace(tbxPassword.Text))
            {
                WebUtil.Alert("密码不能为空!");
                return;
            }
            var admin = AdministratorBll.Login(tbxAccount.Text.Trim(), DESUtil.Encrypt(tbxPassword.Text));

            if (admin != null)
            {
                AdministratorBll.AddAdminLog(new Ye_AdminLog()
                {
                    AdminID     = admin.AdministratorID,
                    LogTypeName = LogType.登录系统.ToString(),
                    CreateTime  = DateTime.Now
                });
                Session["YeAdministratorId"] = admin.AdministratorID;
                Cache["YeAdministrator"]     = admin;
                Response.Redirect("~/YellEatAdmin/Default.aspx", true);
            }
            else
            {
                WebUtil.AlertAndRedirect("用户名或密码不正确!", "Login.aspx");
            }
        }
 public int Login(string AdministratorAccount, string AdministratorPwd)
 {
     try
     {
         Administrator administrator = new Administrator
         {
             AdministratorAccount = AdministratorAccount,
             AdministratorPwd     = AdministratorPwd
         };
         return(abll.Login(administrator));
     }
     catch (Exception)
     {
         return(0);
     }
 }
Example #3
0
 public bool Login(string username, string password)
 {
     return(AdministratorBll.Login(username, DESUtil.Encrypt(password)) != null);
 }