using BLL; using System; namespace FineUIPro.Web.Person { public partial class PersonView : PageBase { #region 定义项 /// /// 主键 /// public string PersonId { get { return (string)ViewState["PersonId"]; } set { ViewState["PersonId"] = value; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.PersonId = Request.Params["PersonId"]; this.InitDropDownList(); if (!string.IsNullOrEmpty(this.PersonId)) { var person = BLL.Person_PersonsService.GetPerson_PersonsById(this.PersonId); if (person != null) { #region 基本信息 this.txtPersonName.Text = person.PersonName; this.txtJobNum.Text = person.JobNum; this.drpUnit.SelectedValue = person.UnitId; if (!string.IsNullOrEmpty(person.DepartId)) { this.drpDepart.SelectedValue = person.DepartId; } this.txtAccount.Text = person.Account; if (!string.IsNullOrEmpty(person.RoleIds)) { this.drpRole.SelectedValueArray = person.RoleIds.Split(','); } if (!string.IsNullOrEmpty(person.WorkPostId)) { this.drpWorkPost.SelectedValue = person.WorkPostId; } if (person.IsForeign.HasValue) { this.ckIsForeign.Checked = person.IsForeign.Value; } this.txtPersonType.Text = DropListService.getPersonTypeNameByValue(person.PersonType); if (!string.IsNullOrEmpty(person.IdcardType)) { this.drpIdcardType.SelectedValue = person.IdcardType; } this.txtIdentityCard.Text = person.IdentityCard; this.txtIdcardAddress.Text = person.IdcardAddress; if (!string.IsNullOrEmpty(person.IdcardForever)) { this.rblIdcardForever.SelectedValue = person.IdcardForever; if (person.IdcardForever == "Y") { this.txtIdcardEndDate.ShowRedStar = false; this.txtIdcardEndDate.Required = false; } } this.txtIdcardStartDate.Text = string.Format("{0:yyyy-MM-dd}", person.IdcardStartDate); this.txtIdcardEndDate.Text = string.Format("{0:yyyy-MM-dd}", person.IdcardEndDate); if (!string.IsNullOrEmpty(person.Sex)) { this.rblSex.SelectedValue = person.Sex; } if (person.Birthday.HasValue) { this.txtBirthday.Text = string.Format("{0:yyyy-MM-dd}", person.Birthday); this.txtAge.Text = IDCardValid.CalculateAgeCorrect(person.Birthday.Value).ToString(); } this.txtTelephone.Text = person.Telephone; if (!string.IsNullOrEmpty(person.PhotoUrl)) { imgPhoto.ImageUrl = ("~/" + person.PhotoUrl); } if (!string.IsNullOrEmpty(person.QRCodeAttachUrl)) { imgQR.ImageUrl = ("~/" + person.QRCodeAttachUrl); } if (!string.IsNullOrEmpty(person.IDCardUrl)) { imgIDCard.ImageUrl = ("~/" + person.IDCardUrl); } if (!string.IsNullOrEmpty(person.IDCardBackUrl)) { imgIDCardBack.ImageUrl = ("~/" + person.IDCardBackUrl); } #endregion #region 详细信息 this.txtIntoDate.Text = string.Format("{0:yyyy-MM-dd}", person.IntoDate); this.txtWorkDate.Text = string.Format("{0:yyyy-MM-dd}", person.WorkDate); this.txtRetirementDate.Text = string.Format("{0:yyyy-MM-dd}", person.RetirementDate); this.txtValidityDate.Text = string.Format("{0:yyyy-MM-dd}", person.ValidityDate); if (!string.IsNullOrEmpty(person.PositionId)) { this.drpPosition.SelectedValue = person.PositionId; } if (!string.IsNullOrEmpty(person.PostTitleId)) { this.drpPostTitle.SelectedValue = person.PostTitleId; } this.txtPostTitleDate.Text = string.Format("{0:yyyy-MM-dd}", person.PostTitleDate); this.txtGraduate.Text = person.Graduate; this.txtMajor.Text = person.Major; this.txtForeignLanguage.Text = person.ForeignLanguage; if (!string.IsNullOrEmpty(person.CountryCode)) { this.drpCountryCode.SelectedValue = person.CountryCode; CityService.InitCityDropDownList(this.drpProvinceCode, person.CountryCode, false); } if (!string.IsNullOrEmpty(person.ProvinceCode)) { this.drpProvinceCode.SelectedValue = person.ProvinceCode; } if (!string.IsNullOrEmpty(person.Nation)) { this.drpNation.SelectedValue = person.Nation; } if (!string.IsNullOrEmpty(person.PoliticsStatus)) { this.drpPoliticsStatus.SelectedValue = person.PoliticsStatus; } if (!string.IsNullOrEmpty(person.EduLevel)) { this.drpEduLevel.SelectedValue = person.EduLevel; } if (!string.IsNullOrEmpty(person.MaritalStatus)) { this.drpMaritalStatus.SelectedValue = person.MaritalStatus; } this.txtRelativeName.Text = person.RelativeName; this.txtRelativeTel.Text = person.RelativeTel; this.txtAddress.Text = person.Address; #endregion } } getInitGridTestRecord(); getInitGridProjectInOut(); } } #endregion #region 下拉框初始化 /// /// 初始化下拉框 /// private void InitDropDownList() { UnitService.InitUnitDropDownList(this.drpUnit, string.Empty, false); this.drpUnit.SelectedValue = this.CurrUser.UnitId ?? Const.UnitId_SEDIN; DepartService.InitDepartDropDownList(this.drpDepart, true); RoleService.InitRoleDropDownList(this.drpRole, null, null, true); WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true); PositionService.InitPositionDropDownList(this.drpPosition, true); PostTitleService.InitPostTitleDropDownList(this.drpPostTitle, true); BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpEduLevel, "EDU_LEVEL", true); BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpMaritalStatus, "MARITAL_STATUS", true); BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpIdcardType, "ZHENGJIAN_TYPE", false); this.drpIdcardType.SelectedValue = "SHENFEN_ZHENGJIAN"; BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpPoliticsStatus, "POLITICAL_LANDSCAPE", true); BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpNation, "MINZU_TYPE", true); SynchroSetService.InitCountryDropDownList(this.drpCountryCode, false); this.drpCountryCode.SelectedValue = "101"; CityService.InitCityDropDownList(this.drpProvinceCode, this.drpCountryCode.SelectedValue, true); PositionService.InitPositionDropDownList(this.drpPosition, true); ; } #endregion #region 人员培训考试记录 /// /// /// private void getInitGridTestRecord() { Funs.DropDownPageSize(this.ddlPageSizeGridTestRecord); BindGridTestRecord(); } #region 绑定数据 /// /// 绑定数据 /// private void BindGridTestRecord() { var getData = TestRecordService.getListData(this.PersonId, GridTestRecord); GridTestRecord.RecordCount = TestRecordService.count; GridTestRecord.DataSource = getData; GridTestRecord.DataBind(); } #endregion #region 分页 /// /// 分页 /// /// /// protected void GridTestRecord_PageIndexChange(object sender, GridPageEventArgs e) { BindGridTestRecord(); } /// /// 分页显示条数下拉框 /// /// /// protected void ddlPageSizeGridTestRecord_SelectedIndexChanged(object sender, EventArgs e) { GridTestRecord.PageSize = Convert.ToInt32(ddlPageSizeGridTestRecord.SelectedValue); BindGridTestRecord(); } /// /// 排序 /// /// /// protected void GridTestRecord_Sort(object sender, FineUIPro.GridSortEventArgs e) { BindGridTestRecord(); } #endregion #endregion #region 人员项目出入场信息 /// /// /// private void getInitGridProjectInOut() { Funs.DropDownPageSize(this.ddlPageSizeGridProjectInOut); BindGridProjectInOut(); } #region 绑定数据 /// /// 绑定数据 /// private void BindGridProjectInOut() { var getData = SitePerson_PersonItemService.getListData(null, null, this.PersonId, null, null, null, null, GridProjectInOut); GridProjectInOut.RecordCount = Person_PersonsService.count; GridProjectInOut.DataSource = getData; GridProjectInOut.DataBind(); } #endregion #region 分页 /// /// 分页 /// /// /// protected void GridProjectInOut_PageIndexChange(object sender, GridPageEventArgs e) { BindGridProjectInOut(); } /// /// 分页显示条数下拉框 /// /// /// protected void ddlPageSizeGridProjectInOut_SelectedIndexChanged(object sender, EventArgs e) { GridProjectInOut.PageSize = Convert.ToInt32(ddlPageSizeGridProjectInOut.SelectedValue); BindGridProjectInOut(); } /// /// 排序 /// /// /// protected void GridProjectInOut_Sort(object sender, FineUIPro.GridSortEventArgs e) { BindGridProjectInOut(); } #endregion #endregion } }