public override void FormOnLoad() { this.staffEntity = RDIFrameworkService.Instance.StaffService.GetEntity(base.UserInfo, this.StaffId); BindCategory(); // 显示内容 this.ShowStaffEntity(); }
/// <summary> /// 员工信息 /// </summary> /// <returns>实体</returns> private PiStaffEntity GetStaffEntity() { var staffEntity = new PiStaffEntity { Code = this.txtCode.Text, RealName = this.txtRealName.Text, UserName = this.txtUserName.Text, Gender = this.cboGender.SelectedValue == null ? null : this.cboGender.SelectedValue.ToString(), Birthday = BusinessLogic.ConvertToNullableDateTime(this.mtxtBirthday.Text), Age = this.txtAge.Text.Trim(), IdentificationCode = this.txtIdentificationCode.Text.Trim(), BankCode = this.txtBankCode.Text.Trim(), Email = this.txtEmail.Text.Trim(), Mobile = this.txtMobile.Text.Trim(), ShortNumber = this.txtShortNumber.Text.Trim(), Telephone = this.txtTelphone.Text.Trim(), QICQ = this.txtQICQ.Text.Trim(), OfficePhone = this.txtOfficePhone.Text.Trim(), OfficeZipCode = this.txtOfficeZipCode.Text.Trim(), OfficeAddress = this.txtOfficeAddress.Text.Trim(), OfficeFax = this.txtOfficeFax.Text.Trim(), HomePhone = this.txtHomePhone.Text.Trim(), Education = this.cboEducation.SelectedValue == null ? null : this.cboEducation.SelectedValue.ToString(), School = this.txtSchool.Text.Trim(), Degree = this.cboDegree.SelectedValue == null ? null : this.cboDegree.SelectedValue.ToString(), Title = this.cboTitle.SelectedValue == null ? null : this.cboTitle.SelectedValue.ToString(), TitleDate = BusinessLogic.ConvertToNullableDateTime(this.mtxtTitleDate.Text), TitleLevel = this.cboTitleLevel.SelectedValue == null ? null : this.cboTitleLevel.SelectedValue.ToString(), WorkingDate = BusinessLogic.ConvertToNullableDateTime(this.mtxtWorkingDate.Text), JoinInDate = BusinessLogic.ConvertToNullableDateTime(this.mtxtJoinInDate.Text), HomeZipCode = this.txtHomeZipCode.Text.Trim(), HomeAddress = this.txtHomeAddress.Text.Trim(), HomeFax = this.txtHomeFax.Text.Trim(), NativePlace = this.txtNativePlace.Text.Trim(), Party = this.cboParty.SelectedValue == null ? null : this.cboParty.SelectedValue.ToString(), Nation = this.txtNation.Text.Trim(), Nationality = this.cboNationality.SelectedValue == null ? null : this.cboNationality.SelectedValue.ToString(), Major = this.txtMajor.Text.Trim(), WorkingProperty = this.cboWorkingProperty.SelectedValue == null ? null : this.cboWorkingProperty.SelectedValue.ToString(), IsDimission = BusinessLogic.ConvertToNullableInt(this.chkIsDimission.Checked ? 1 : 0), DimissionDate = BusinessLogic.ConvertToNullableDateTime(this.mtxtDimissionDate.Text), DimissionCause = this.txtDimissionCause.Text.Trim(), DimissionWhither = this.txtDimissionWhither.Text.Trim(), Enabled = BusinessLogic.ConvertToNullableInt(this.chkEnabled.Checked ? 1 : 0), Description = this.txtDescription.Text.Trim() }; return(staffEntity); }
/// <summary> /// 移动选择的用户 /// </summary> /// <param name="userId">用户主键</param> /// <param name="targetTreeNode">目录节点</param> private void MoveUserTo(string userId, TreeNode targetTreeNode) { // 目标机构信息 string companyId = null; var companyName = string.Empty; string departmentId = null; var departmentName = string.Empty; string workgroupId = null; var workgroupName = string.Empty; var userEntity = RDIFrameworkService.Instance.UserService.GetEntity(this.UserInfo, userId); var staffId = RDIFrameworkService.Instance.StaffService.GetId(this.UserInfo, PiStaffTable.FieldUserId, userEntity.Id); PiStaffEntity staffEntity = null; if (!string.IsNullOrEmpty(staffId)) { staffEntity = RDIFrameworkService.Instance.StaffService.GetEntity(this.UserInfo, staffId); } // 获得目标节点公司信息,其实只要从当前节点一直往上遍历就可以了,直接被拖到公司的,部门、工作自然就null了 while (targetTreeNode != null) { var targetOrganizeCategory = ((PiOrganizeEntity)targetTreeNode.Tag).Category; if (!string.IsNullOrEmpty(targetOrganizeCategory)) { if (targetOrganizeCategory == "WorkGroup") { workgroupId = ((PiOrganizeEntity)targetTreeNode.Tag).Id.ToString(); workgroupName = ((PiOrganizeEntity)targetTreeNode.Tag).FullName; } if ((targetOrganizeCategory == "Department" || targetOrganizeCategory == "SubDepartment") && string.IsNullOrEmpty(departmentName)) { departmentId = ((PiOrganizeEntity)targetTreeNode.Tag).Id.ToString(); departmentName = ((PiOrganizeEntity)targetTreeNode.Tag).FullName; } if ((targetOrganizeCategory == "Company" || targetOrganizeCategory == "SubCompany") && string.IsNullOrEmpty(companyName)) { companyId = ((PiOrganizeEntity)targetTreeNode.Tag).Id; companyName = ((PiOrganizeEntity)targetTreeNode.Tag).FullName; break; } } targetTreeNode = targetTreeNode.Parent; } userEntity.CompanyId = companyId; userEntity.CompanyName = companyName; userEntity.DepartmentId = departmentId; userEntity.DepartmentName = departmentName; userEntity.WorkgroupId = workgroupId; userEntity.WorkgroupName = workgroupName; var statusCode = string.Empty; var statusMessage = string.Empty; RDIFrameworkService.Instance.UserService.UpdateUser(this.UserInfo, userEntity, out statusCode, out statusMessage); if (staffEntity != null) { var organizeId = string.Empty; if (!string.IsNullOrEmpty(companyId)) { organizeId = companyId; } if (!string.IsNullOrEmpty(departmentId)) { organizeId = departmentId; } if (!string.IsNullOrEmpty(workgroupId)) { organizeId = workgroupId; } if (!string.IsNullOrEmpty(organizeId)) { RDIFrameworkService.Instance.StaffService.MoveTo(this.UserInfo, staffEntity.Id.ToString(), organizeId); } } }