Exemplo n.º 1
0
        protected void rptUsers_OnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "setBlack":
            {
                UserBll.SetUserBlack(Convert.ToInt32(e.CommandArgument));
                AdministratorBll.AddAdminLog(new Ye_AdminLog()
                    {
                        LogTypeName = LogType.会员管理.ToString(),
                        CreateTime  = DateTime.Now,
                        AdminID     = YeAdministratorId
                    });
                pager1.CurrentPagerIndex = 0;
                BindData();
                break;
            }

            case "setWhite":
            {
                UserBll.SetUserWhite(Convert.ToInt32(e.CommandArgument));
                AdministratorBll.AddAdminLog(new Ye_AdminLog()
                    {
                        LogTypeName = LogType.会员管理.ToString(),
                        CreateTime  = DateTime.Now,
                        AdminID     = YeAdministratorId
                    });
                pager1.CurrentPagerIndex = 0;
                BindData();
                break;
            }
            }
        }
Exemplo n.º 2
0
 protected void btnSave_OnClick(object sender, EventArgs e)
 {
     if (ddl.SelectedValue == YeAdministratorId.ToString())
     {
         WebUtil.Alert("您无法修改自身的权限!");
     }
     else
     {
         var list = new List <int>();
         for (int i = 1; i < 12; i++)
         {
             var c = this.FindControl("cbx" + i.ToString()) as CheckBox;
             if (c.Checked)
             {
                 list.Add(i);
             }
         }
         if (AdministratorBll.UpdateAdminPower(YeAdministratorId, list))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.修改权限.ToString(),
                 CreateTime  = DateTime.Now
             });
             WebUtil.AlertAndRedirect("权限更新成功!", "");
         }
     }
 }
Exemplo n.º 3
0
 protected void rptUserFeedback_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         switch (e.CommandName)
         {
         case "del":
         {
             var id = Convert.ToInt32(e.CommandArgument);
             if (UserBll.DeleteUserFeedback(id))
             {
                 AdministratorBll.AddAdminLog(new Ye_AdminLog()
                     {
                         AdminID     = YeAdministratorId,
                         LogTypeName = LogType.会员管理.ToString(),
                         CreateTime  = DateTime.Now
                     });
                 pager1.CurrentPagerIndex = 0;
                 BindData();
             }
             break;
         }
         }
     }
 }
Exemplo n.º 4
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");
            }
        }
Exemplo n.º 5
0
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (YeAdministrator.Password != DESUtil.Encrypt(tbxOldPwd.Text))
     {
         WebUtil.Alert("您输入的当期登录密码不正确!");
         tbxOldPwd.Focus();
     }
     else
     {
         var newPwd = DESUtil.Encrypt(tbxNewPwd1.Text.Trim());
         if (AdministratorBll.ChangePassword(YeAdministratorId, newPwd))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.修改密码.ToString(),
                 CreateTime  = DateTime.Now
             });
             WebUtil.Alert("密码修改成功!");
             YeAdministrator.Password = newPwd;
         }
         else
         {
             WebUtil.Alert("密码修改失败!");
         }
     }
 }
Exemplo n.º 6
0
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (AdministratorBll.GetAdministrators().SingleOrDefault(a => a.Account == tbxAccount.Text) != null)
     {
         WebUtil.Alert("该用户名已存在!");
         return;
     }
     else
     {
         if (AdministratorBll.AddAdministrator(new Ye_Administrator()
         {
             Account = tbxAccount.Text.Trim(),
             Password = DESUtil.Encrypt(tbxPwd1.Text.Trim()),
             CreateTime = DateTime.Now,
             LastLoginTime = DateTime.Now
         }))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.添加管理员.ToString(),
                 CreateTime  = DateTime.Now
             });
             WebUtil.AlertAndReload("成功添加管理员!");
         }
         else
         {
             WebUtil.Alert("创建新管理员时出错!");
         }
     }
 }
Exemplo n.º 7
0
 private void BindData()
 {
     pager1.DataItemCount = AdministratorBll.GetAdministrators().Count();
     rpt.DataSource       = AdministratorBll.GetAdministrators().OrderBy(p => p.AdministratorID).Skip(pager1.PageSize * pager1.CurrentPagerIndex).Take(pager1.PageSize).ToArray();
     rpt.DataBind();
     pager1.SetPagerControlState();
 }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CheckPower(AdminPower.分配权限管理);
         WebControlUtil.BindDropDownList(ddl, AdministratorBll.GetAdministrators().ToArray(), "Account", "AdministratorID");
         ddl.SelectedValue = YeAdministratorId.ToString();
         BindData(YeAdministratorId);
     }
 }
Exemplo n.º 9
0
 protected void rptAdminLog_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         var id = Convert.ToInt32(e.CommandArgument);
         AdministratorBll.DeleteAdminLog(id);
         pager1.CurrentPagerIndex = 0;
         BindData();
     }
 }
Exemplo n.º 10
0
        private void BindData(int adminId)
        {
            var power = AdministratorBll.GetAdminPowerByAdminId(adminId).Select(p => "cbx" + p.ToString());
            var cbxes = updatePanel.ContentTemplateContainer.Controls.OfType <CheckBox>();

            cbxes.ToList().ForEach(p => p.Checked = false);
            cbxes.Where(p => power.Contains(p.ID)).ToList().ForEach(c => c.Checked = true);
            cbx1_OnCheckedChanged(this, EventArgs.Empty);
            cbx3_OnCheckedChanged(this, EventArgs.Empty);
            cbx6_OnCheckedChanged(this, EventArgs.Empty);
        }
Exemplo n.º 11
0
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (ShopBll.HandleShopFeedback(Convert.ToInt32(Request.QueryString["id"]), tbxFeedbackAnswer.Text))
     {
         AdministratorBll.AddAdminLog(new Ye_AdminLog()
         {
             AdminID     = YeAdministratorId,
             LogTypeName = LogType.餐馆管理.ToString(),
             CreateTime  = DateTime.Now
         });
         WebUtil.AlertAndRedirect("反馈处理已提交保存!", "ShopFeedbackList.aspx");
     }
     else
     {
         WebUtil.Alert("反馈意见保存失败!");
     }
 }
Exemplo n.º 12
0
 //删除项
 protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         var id = Convert.ToInt32(e.CommandArgument);
         if (AdministratorBll.DeleteAdministrator(id))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.除管理员.ToString(),
                 CreateTime  = DateTime.Now
             });
         }
         BindData();
     }
 }
Exemplo n.º 13
0
 private void BindData()
 {
     pager1.DataItemCount   = AdministratorBll.GetAdministrators().Count();
     rptAdminLog.DataSource =
         (from log in AdministratorBll.GetAdminLogs()
          join admin in AdministratorBll.GetAdministrators()
          on log.AdminID equals admin.AdministratorID
          select new
     {
         log.CreateTime,
         AdminName = admin.Account,
         log.LogTypeName,
         log.LogID
     })
         .OrderBy(p => p.CreateTime)
         .Skip(pager1.CurrentPagerIndex * pager1.PageSize)
         .Take(pager1.PageSize)
         .ToArray();
     rptAdminLog.DataBind();
     pager1.SetPagerControlState();
 }
Exemplo n.º 14
0
 protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         switch (e.CommandName)
         {
         case "sh":
         {
             var shop = e.CommandArgument.ToString().Split(',');
             ShopBll.SetShopCheckState(Convert.ToInt32(shop[0]), !Convert.ToBoolean(shop[1]));
             pager1.CurrentPagerIndex = 0;
             BindData();
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
                 {
                     AdminID     = YeAdministratorId,
                     LogTypeName = LogType.餐馆管理.ToString(),
                     CreateTime  = DateTime.Now
                 });
             break;
         }
         }
     }
 }
Exemplo n.º 15
0
 public bool Login(string username, string password)
 {
     return(AdministratorBll.Login(username, DESUtil.Encrypt(password)) != null);
 }