Example #1
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     if (ub.GetMd5(txt_OldPassword.Text) != UsersHelp.Userslist[0].UserPassword)
     {
         MessageBox.Show("旧密码错误!");
         txt_OldPassword.Text = "";
         txt_OldPassword.Focus();
         return;
     }
     if (la_passwordCheck.Text == "密码不一致!")
     {
         MessageBox.Show("密码不一致");
         txt_DeterminePassword.Text = "";
         txt_DeterminePassword.Focus();
         return;
     }
     if (ub.UpdatePasswordBll(UsersHelp.Userslist[0].UserName, txt_NewPassword.Text.Trim(), "updateUsersPassword"))
     {
         MessageBox.Show("密码修改成功!");
         this.Close();
     }
     else
     {
         MessageBox.Show("密码修改失败!");
     }
 }
Example #2
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            if (txt_UserName.Text == "")
            {
                MessageBox.Show("用户名不能为空!");
                return;
            }
            if (txt_Password.Text == "")
            {
                MessageBox.Show("密码不能为空!");
                return;
            }
            Loginlist = ub.UsersLoginBll(txt_UserName.Text.Trim(), ub.GetMd5(txt_Password.Text), "UsersLogin");

            if (Loginlist.Count > 0)
            {
                UsersHelp.SetUsers(Loginlist, true, Loginlist[0].Limite, Loginlist[0].AddUser, Loginlist[0].systemAdimin);
                List <PUsers_Function> pufbList = pufb.selectPUsers_FunctionLoginBll("selectPUsers_FunctionLogin", txt_UserName.Text.Trim()); //查询主功能权限
                Dictionary <string, Dictionary <string, bool> > pufbDic = new Dictionary <string, Dictionary <string, bool> >();
                pufbDic.Add("UserName", GetDic(pufbList, "PUsers_Function"));                                                                 //主功能权限信息添加进字典集合
                UsersHelp.SetJurisdiction(pufbDic);

                List <PUsers_Function_Detailed> pufdbList = pufdb.selectPUsers_Function_DetailedLoginBll("selectPUsers_Function_DetailedLogin", txt_UserName.Text.Trim());
                foreach (PUsers_Function item in pufbList)
                {
                    Dictionary <string, Dictionary <string, bool> > pufdbDic = new Dictionary <string, Dictionary <string, bool> >();
                    pufdbDic.Add(item.FunctionName, GetDic(pufdbList, item.FunctionGUID));
                    UsersHelp.SetJurisdiction(pufdbDic);
                }

                g.Setbar_txtb_user(txt_UserName.Text.Trim());
                MessageBox.Show("登录成功!");
                this.Close();
            }
            else
            {
                MessageBox.Show("账号或密码错误");
                txt_Password.Text = "";
            }
        }
Example #3
0
        private void btn_registered_Click(object sender, EventArgs e)
        {
            if (!checkUserName)
            {
                MessageBox.Show("用户名已存在!");
                return;
            }
            if (!checkPassword)
            {
                MessageBox.Show("密码不一致");
                return;
            }
            List <Users> list = new List <Users>();

            list.Add(new Users()
            {
                UserName     = txt_UserName.Text.Trim(),
                UserPassword = ub.GetMd5(txt_Password.Text),
                systemAdimin = false,
                Limite       = false,
                Department   = comb_Department.Text.Trim() == "无"?"":comb_Department.Text.Trim(),
                AddUser      = false
            });
            try
            {
                if (ub.insertUsersBll(list, "insertUsers"))
                {
                    foreach (PFunctionMenu item in PFmenuBll.selectPFunctionMenuFID0Bll("selectPFunctionMenuFID0"))//次级功能权限名
                    {
                        Guid guid = Guid.NewGuid();
                        List <PUsers_Function> pufList = new List <PUsers_Function>();
                        pufList.Add(new PUsers_Function
                        {
                            UserName             = list[0].UserName,
                            FunctionName         = item.FunctionName,
                            FunctionJurisdiction = false,
                            FunctionGUID         = guid.ToString()
                        });
                        if (!pufb.insertPUsers_FunctionBll(pufList, "insertPUsers_Function"))
                        {
                        }
                        foreach (PFunctionMenu item1 in PFmenuBll.selectPFunctionMenuFID0Bll("selectPFunctionMenuFID01"))//最下级功能权限名
                        {
                            if (item1.FID == item.ID)
                            {
                                List <PUsers_Function_Detailed> pufdList = new List <PUsers_Function_Detailed>();
                                pufdList.Add(new PUsers_Function_Detailed()
                                {
                                    UserName             = list[0].UserName,
                                    FunctionName         = item1.FunctionName,
                                    FunctionJurisdiction = false,
                                    FunctionGUID         = guid.ToString()
                                });
                                if (pufdb.insertPUsers_Function_DetailedBll(pufdList, "insertPUsers_Function_Detailed"))
                                {
                                }
                            }
                        }
                    }

                    MessageBox.Show("注册成功!");
                    this.ClearTxt();
                }
                else
                {
                    MessageBox.Show("注册失败!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }