예제 #1
0
        private void lblOk_Click(object sender, EventArgs e)
        {
            EmployeeDto employeeDto = new EmployeeDto();

            if (txtUserName.Text == string.Empty)
            {
                XtraMessageBox.Show("用户名不能为空!");
                return;
            }
            if (txtUserPassWord.Text == string.Empty)
            {
                XtraMessageBox.Show("密码不能为空!");
                return;
            }
            try
            {
                employeeDto.Emplcode     = txtUserName.Text;
                employeeDto.Userpassword = txtUserPassWord.Text;
                var employee = _rightsQueryService.GetUserByLoginNameAsync(txtUserName.Text.ToString()).GetAwaiter().GetResult();;
                if (employee != null)
                {
                    if (_rightsUploadService.LoginAsync(employeeDto).GetAwaiter().GetResult())
                    {
                        var ic = communicator.getImplicitContext();
                        //创建登录用户
                        ic.setContext(new Dictionary <string, string>
                        {
                            { Extensions.LoginUserKey, System.Text.Json.JsonSerializer.Serialize(new LoginUser
                                {
                                    Sysid    = employee.Sysid,
                                    Emplcode = employee.Emplcode,
                                    Username = employee.Username
                                }) }
                        });
                        this.employee             = employee;
                        vusermenuList             = _rightsQueryService.getUserMenuByLoginNameAsync(txtUserName.Text.ToString()).GetAwaiter().GetResult();
                        GCClientData.rightManageC = new RightManageC
                        {
                            employee      = employee,
                            vusermenuList = vusermenuList.rows
                        };
                        this.DialogResult = DialogResult.OK;
                    }
                }
                else
                {
                    XtraMessageBox.Show("员工工号或者密码错误!");
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return;
            }
        }
예제 #2
0
        public MainForm(VusermenuDtoPage vusermenuList, ServiceProvider serviceProvider)
        {
            InitializeComponent();
            strCurrentPath       = Application.StartupPath;
            this.vusermenuList   = vusermenuList;
            this.serviceProvider = serviceProvider;
            strClientVersion     = LoadGCClientVersion(Application.StartupPath + "\\Version.ini");
            topMenus             = from Vusermenu in vusermenuList.rows
                                   where Vusermenu.Parentid == null || Vusermenu.Parentid == ""
                                   orderby Vusermenu.Menuindex
                                   select Vusermenu;

            assemblies = new Assembly[]
            {
                Assembly.GetAssembly(this.GetType()),
                //Assembly.LoadFile(Application.StartupPath + @"\Enterprise.dll")
            };
        }