private bool AddToOrganize() { bool result = false; string statusCode = string.Empty; string statusMessage = string.Empty; PiUserOrganizeEntity userOrganizeEntity = this.GetUserOrganizeEntity(); this.EntityId = RDIFrameworkService.Instance.UserService.AddUserToOrganize(this.UserInfo, userOrganizeEntity, out statusCode, out statusMessage); if (statusCode == StatusCode.OKAdd.ToString()) { // 没审核通过的,才可以有提示信息 if (SystemInfo.ShowInformation && !this.chkEnabled.Checked) { MessageBoxHelper.ShowSuccessMsg(RDIFrameworkMessage.MSG0235); } result = true; this.DialogResult = DialogResult.OK; this.Close(); } else { if (statusCode == StatusCode.Exist.ToString()) { MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0008, RDIFrameworkMessage.MSG9971)); } } return(result); }
/// <summary> /// 获取用户组织机构数据 /// </summary> /// <returns>用户组织机构实体</returns> private PiUserOrganizeEntity GetUserOrganizeEntity() { var userOrganizeEntity = new PiUserOrganizeEntity { UserId = !string.IsNullOrEmpty(this.UserId) ? this.UserId : null, CompanyId = !string.IsNullOrEmpty(this.txtCompany.SelectedId) ? this.txtCompany.SelectedId : null, SubCompanyId = !string.IsNullOrEmpty(this.txtSubCompany.SelectedId) ? this.txtSubCompany.SelectedId : null, DepartmentId = !string.IsNullOrEmpty(this.txtDepartment.SelectedId) ? this.txtDepartment.SelectedId : null, SubDepartmentId = !string.IsNullOrEmpty(this.txtSubDepartment.SelectedId) ? this.txtSubDepartment.SelectedId : null, WorkgroupId = !string.IsNullOrEmpty(this.txtWorkGroup.SelectedId) ? this.txtWorkGroup.SelectedId : null, Enabled = this.chkEnabled.Checked ? 1 : 0, Description = this.txtDescription.Text, DeleteMark = 0 }; return(userOrganizeEntity); }