Exemplo n.º 1
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 = "";
            }
        }