示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Spread.BLL.Admin bll = new Spread.BLL.Admin();
            Spread.Model.Admin model = bll.GetModel(this.Id);

            string UserPwd = txtUserPwd.Text.Trim();
            string UserLevel = string.Empty;
            int UserType = 1;// Convert.ToInt32(rblUserType.SelectedValue);
            if (UserType > 1)
            {
                UserLevel = "," + Request.Form["cbLevel"].Trim() + ",";
            }
            if (UserPwd != null && UserPwd != "")
            {
                model.UserPwd = Spread.Common.DESEncrypt.Encrypt(UserPwd, Spread.Common.Param.EncCode);
            }
            model.ReadName = txtReadName.Text.Trim();
            model.UserEmail = txtUserEmail.Text.Trim();
            model.UserType = UserType;
            model.IsLock = Convert.ToBoolean(rblIsLock.SelectedValue);
            model.UserLevel = UserLevel;

            int count= bll.Update(model);
            if (count > 0)
            {
                JscriptPrint("管理员修改成功啦!", "List.aspx", "Success");
            }
            else { JscriptPrint("对不起,管理员修改失败!", "List.aspx", "Error"); }
        }
示例#2
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Spread.Model.Admin model = new Spread.Model.Admin();
            Spread.BLL.Admin bll = new Spread.BLL.Admin();
            string userLevel = string.Empty;
            string userName = txtUserName.Text.Trim();
            string userPwd = Spread.Common.DESEncrypt.Encrypt(txtUserPwd.Text.Trim(), Spread.Common.Param.EncCode);
            string readName = txtReadName.Text.Trim();
            string userEmail = txtUserEmail.Text.Trim();
            int userType = 1;// Convert.ToInt32(rblUserType.SelectedValue);
            bool isLock = Convert.ToBoolean(rblIsLock.SelectedValue);
            if (bll.Exists(userName))
            {
                JscriptMsg(350, 230, "错误提示", "<b>出现错误了!</b>用户名已存在,请输入别的管理帐号吧!", "", "Error");
                return;
            }
            if (userType > 1)
            {
                userLevel = "," + Request.Form["cbLevel"].Trim() + ",";
            }

            model.UserName = userName;
            model.UserPwd = userPwd;
            model.ReadName = readName;
            model.UserEmail = userEmail;
            model.UserType = userType;
            model.IsLock = isLock;
            model.UserLevel = userLevel;

            bll.Add(model);
            JscriptPrint("添加管理员成功啦!", "list.aspx", "Success");
        }
示例#3
0
 //赋值操作
 private void ShowInfo(int editID)
 {
     Spread.BLL.Admin bll = new Spread.BLL.Admin();
     Spread.Model.Admin model = new Spread.Model.Admin();
     model = bll.GetModel(editID);
     txtUserName.Text = model.UserName;
     if (model.IsLock == true)
     {
         this.rblIsLock.Items[1].Selected = true;
     }
     else
     {
         this.rblIsLock.Items[0].Selected = true;
     }
     txtReadName.Text = model.ReadName;
     txtUserEmail.Text = model.UserEmail;
     this.strLevel = model.UserLevel;
     this.strType = model.UserType;
     //if (model.UserType == 1)
     //{
     //    this.rblUserType.Items[0].Selected = true;
     //}
     //if (model.UserType == 2)
     //{
     //    this.rblUserType.Items[1].Selected = true;
     //}
     //if (model.UserType == 3)
     //{
     //    this.rblUserType.Items[2].Selected = true;
     //}
 }