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; } }