Ejemplo n.º 1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtUserName.Text.Trim() == "")
     {
         MessageBox.Show("用户名不能为空!");
         return;
     }
     BLL.user_info userBll = new BLL.user_info();
     if (userBll.GetModel(txtUserName.Text.Trim()) != null)
     {
         MessageBox.Show("用户名已存在!");
         return;
     }
     if (txtUserPwd.Text == "")
     {
         MessageBox.Show("密码不能为空!");
         return;
     }
     if (txtCrmPwd.Text != txtUserPwd.Text)
     {
         MessageBox.Show("两次输入的密码不相同!");
         return;
     }
     Model.user_info userModel = new Model.user_info();
     userModel.user_name    = txtUserName.Text.Trim();
     userModel.user_isadmin = rdBtnYes.Checked;
     userModel.user_pwd     = Maticsoft.Common.PasswordEncrypt.EncryptDES(txtUserPwd.Text);
     userModel.user_tel     = txtUserTel.Text.Trim();
     userModel.user_email   = txtUserEmail.Text.Trim();
     userModel.user_remark  = rchTxtUserRemark.Text.Trim();
     userBll.Add(userModel);
     this.Close();
 }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            BLL.user_info   userBll   = new BLL.user_info();
            Model.user_info userModel = new Model.user_info();
            string          userName  = txtUser.Text;
            string          userPwd   = txtPwd.Text;

            userModel = userBll.GetModel(userName);
            if (userModel == null)
            {
                MessageBox.Show("用户不存在!");
                return;
            }
            if (Maticsoft.Common.PasswordEncrypt.EncryptDES(userPwd) == userModel.user_pwd)
            {
                cfa.AppSettings.Settings["lastUser"].Value = userName;
                if (chkbxRmbrPwd.Checked)
                {
                    cfa.AppSettings.Settings["lastUserPwd"].Value = Maticsoft.Common.PasswordEncrypt.EncryptDES(userPwd);
                }
                else
                {
                    cfa.AppSettings.Settings["lastUserPwd"].Value = "";
                }
                cfa.Save();
                constants.currentUser = userModel;
                this.Hide();
                MainForm main = new MainForm();
                main.Show();
            }
            else
            {
                MessageBox.Show("密码错误!");
            }
        }
Ejemplo n.º 3
0
 private void initAdmin()
 {
     BLL.user_info   userBll = new BLL.user_info();
     Model.user_info admin   = new Model.user_info();
     admin.user_id      = 1;
     admin.user_name    = "admin";
     admin.user_remark  = "系统管理员";
     admin.user_pwd     = Maticsoft.Common.PasswordEncrypt.EncryptDES("admin");
     admin.user_isadmin = true;
     userBll.Add(admin);
 }
Ejemplo n.º 4
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtPwd.Text == "")
     {
         MessageBox.Show("密码不能为空!");
         return;
     }
     if (txtPwd.Text != txtCfmPwd.Text)
     {
         MessageBox.Show("两次输入的密码不相同!");
         return;
     }
     editUser.user_pwd = Maticsoft.Common.PasswordEncrypt.EncryptDES(txtPwd.Text);
     BLL.user_info userBll = new BLL.user_info();
     userBll.Update(editUser);
     MessageBox.Show("修改成功!");
     this.Close();
 }
Ejemplo n.º 5
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtUserName.Text.Trim() == "")
     {
         MessageBox.Show("用户名不能为空!");
         return;
     }
     BLL.user_info   userBll   = new BLL.user_info();
     Model.user_info userModel = userBll.GetModel(txtUserName.Text.Trim());
     if (userModel != null && userModel.user_id != this.editUser.user_id)
     {
         MessageBox.Show("用户名已存在!");
         return;
     }
     editUser.user_name    = txtUserName.Text.Trim();
     editUser.user_tel     = txtUserTel.Text.Trim();
     editUser.user_isadmin = rdBtnYes.Checked;
     editUser.user_email   = txtUserEmail.Text.Trim();
     editUser.user_remark  = rchTxtUserRemark.Text.Trim();
     userBll.Update(editUser);
     MessageBox.Show("修改成功!");
     this.Close();
 }
Ejemplo n.º 6
0
 private void btnDeleteUser_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 0)
     {
         MessageBox.Show("请选择要删除的项!");
     }
     else
     {
         if (MessageBox.Show("是否删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             int delID = (int)listView1.SelectedItems[0].Tag;
             if (delID == 1)
             {
                 MessageBox.Show("不能删除默认管理员!");
                 return;
             }
             BLL.user_info userBll = new BLL.user_info();
             bool          succ    = false;
             try { succ = userBll.Delete(delID); }
             catch
             {
                 MessageBox.Show("该项正在使用中!");
                 return;
             }
             if (succ)
             {
                 MessageBox.Show("删除成功!");
                 getAllUser();
             }
             else
             {
                 MessageBox.Show("操作失败!");
             }
         }
     }
 }
Ejemplo n.º 7
0
 private void getAllUser()
 {
     BLL.user_info userBll = new BLL.user_info();
     userList = userBll.GetModelList("1=1 order by user_id desc");
     loadUserList();
 }
Ejemplo n.º 8
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     BLL.user_info userBll = new BLL.user_info();
     userList = userBll.GetModelList("user_name like '%" + txtUserName.Text.Trim() + "%' order by user_id desc");
     loadUserList();
 }