protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllAddress = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo modelAddressSearch = new EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo(); modelAddressSearch.UserName = WorkerName; IList <EyouSoft.Model.AdminCenterStructure.PersonnelInfo> listAddress = bllAddress.GetList(PageSize, PageIndex, ref RecordCount, CurrentUserCompanyID, modelAddressSearch); if (RecordCount == 0) { RecordCount = 1; } listAddress = bllAddress.GetList(RecordCount, 1, ref RecordCount, CurrentUserCompanyID, modelAddressSearch); if (listAddress != null && listAddress.Count > 0) { this.crptPrintAddressList.DataSource = listAddress; this.crptPrintAddressList.DataBind(); } else { this.crptPrintAddressList.EmptyText = "<tr><td colspan=\"8\"><div style=\"text-align:center; margin-top:75px; margin-bottom:75px;\">没有相关的数据!</span></div></td></tr>"; } } }
/// <summary> /// 绑定个人档案详细信息 /// </summary> protected void BindData() { EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllPersonnel = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo modelPersonnelSearch = new EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo(); if (FileNo != "") { modelPersonnelSearch.ArchiveNo = FileNo; } if (Name != "") { modelPersonnelSearch.UserName = Name; } if (Sex != 0) { modelPersonnelSearch.ContactSex = (EyouSoft.Model.EnumType.CompanyStructure.Sex)Sex; } modelPersonnelSearch.BirthDateFrom = BirthdayStart; modelPersonnelSearch.BirthDateTo = BirthdayEnd; modelPersonnelSearch.WorkYearFrom = WorkYearFrom; modelPersonnelSearch.WorkYearTo = WorkYearTo; if (JobPostion != 0) { modelPersonnelSearch.DutyId = JobPostion; } if (WorkerType != null && WorkerType != -1) { modelPersonnelSearch.PersonalType = (EyouSoft.Model.EnumType.AdminCenterStructure.PersonalType)(WorkerType); } if (WorkerState != "null") { modelPersonnelSearch.IsLeave = Convert.ToBoolean(WorkerState); } if (MarriageState != "null") { modelPersonnelSearch.IsMarried = Convert.ToBoolean(MarriageState); } int RecordCount = 0; IList <EyouSoft.Model.AdminCenterStructure.PersonnelInfo> listPersonnel = bllPersonnel.GetList(10000, 1, ref RecordCount, CurrentUserCompanyID, modelPersonnelSearch); if (listPersonnel != null && listPersonnel.Count != 0) { this.rptDataList.DataSource = listPersonnel; this.rptDataList.DataBind(); } else { this.rptDataList.EmptyText = "<tr><td colspan=\"12\"><div style=\"text-align:center; margin-top:75px; margin-bottom:75px;\">没有相关的数据!</span></div></td></tr>"; } }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllPersonnel = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo modelPersonnelSearch = GetPersonnelSearchInfo(); listPersonnel = bllPersonnel.GetList(PageSize, PageIndex, ref RecordCount, CurrentUserCompanyID, modelPersonnelSearch); if (listPersonnel != null && listPersonnel.Count > 0) { this.rptData.DataSource = listPersonnel; this.rptData.DataBind(); this.BindPage(); } else { this.rptData.EmptyText = "<tr><td colspan=\"12\"><div style=\"text-align:center; margin-top:75px; margin-bottom:75px;\">没有相关的数据!</span></div></td></tr>"; this.ExporPageInfoSelect1.Visible = false; } }
/// <summary> /// 得到查询对象 /// </summary> private EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo GetPersonnelSearchInfo() { EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo modelPersonnelSearch = new EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo(); if (FileNo != "") { modelPersonnelSearch.ArchiveNo = FileNo; } if (Name != "") { modelPersonnelSearch.UserName = Name; } if (Sex != 0) { modelPersonnelSearch.ContactSex = (EyouSoft.Model.EnumType.CompanyStructure.Sex)Sex; } modelPersonnelSearch.BirthDateFrom = BirthdayStart; modelPersonnelSearch.BirthDateTo = BirthdayEnd; modelPersonnelSearch.WorkYearFrom = WorkYearFrom; modelPersonnelSearch.WorkYearTo = WorkYearTo; if (JobPostion != 0) { modelPersonnelSearch.DutyId = JobPostion; } if (WorkerType != null && WorkerType != -1) { modelPersonnelSearch.PersonalType = (EyouSoft.Model.EnumType.AdminCenterStructure.PersonalType)(WorkerType); } if (WorkerState != "null") { modelPersonnelSearch.IsLeave = Convert.ToBoolean(WorkerState); } if (MarriageState != "null") { modelPersonnelSearch.IsMarried = Convert.ToBoolean(MarriageState); } return(modelPersonnelSearch); }
protected void Page_Load(object sender, EventArgs e) { string method = Utils.GetQueryStringValue("Method"); if (!IsPostBack && method == "") { WorkerName = Utils.GetQueryStringValue("WorkerName"); Department = Utils.GetIntNull(Request.QueryString["Department"]); PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); BindData(); } if (method == "GetExcel") { EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllAddress = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo modelAddressSearch = new EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo(); modelAddressSearch.UserName = WorkerName; IList <EyouSoft.Model.AdminCenterStructure.PersonnelInfo> listAddress = bllAddress.GetList(PageSize, PageIndex, ref RecordCount, CurrentUserCompanyID, modelAddressSearch); if (RecordCount > 0) { listAddress = bllAddress.GetList(RecordCount, 1, ref RecordCount, CurrentUserCompanyID, modelAddressSearch); if (listAddress != null && listAddress.Count > 0) { ToExcel(listAddress); } else { ToExcel(new List <EyouSoft.Model.AdminCenterStructure.PersonnelInfo>()); } } else { ToExcel(new List <EyouSoft.Model.AdminCenterStructure.PersonnelInfo>()); } } }
/// <summary> /// 获取人事档案列表信息 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="ReCordCount"></param> /// <param name="CompanyId">公司编号</param> /// <returns></returns> public IList <EyouSoft.Model.AdminCenterStructure.PersonnelInfo> GetList(int PageSize, int PageIndex, ref int ReCordCount, int CompanyId, EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo SearchInfo) { IList <EyouSoft.Model.AdminCenterStructure.PersonnelInfo> ResultList = null; #region SQL处理 string tableName = "tbl_PersonnelInfo"; string identityColumnName = "Id"; string orderByString = " IssueTime DESC"; StringBuilder fields = new StringBuilder(); fields.Append("[Id],[ArchiveNo],[BirthDate],[UserName],[ContactSex],MSN,QQ,EntryDate,DepartmentId,"); fields.AppendFormat("(SELECT [Id],[DepartName] FROM tbl_CompanyDepartment a WHERE a.[id] IN(select [value] from dbo.fn_split([tbl_PersonnelInfo].[DepartmentId],',')) AND [CompanyId]={0} FOR XML Raw,Root('Department'))AS [DepartmentXML],", CompanyId); fields.AppendFormat("(SELECT [JobName] FROM [tbl_DutyManager] b WHERE b.[id]=[tbl_PersonnelInfo].[dutyid] AND [CompanyId]={0}) AS [DutyName],", CompanyId); fields.Append("(SELECT DATEDIFF(YEAR,ISNULL(EntryDate,getdate()),getdate())) AS [WorkYear],[ContactTel],[ContactMobile],[Email]"); StringBuilder query = new StringBuilder(); query.AppendFormat("[CompanyId]={0}", CompanyId); if (!string.IsNullOrEmpty(SearchInfo.ArchiveNo)) { query.AppendFormat(" AND ArchiveNo like'%{0}%'", SearchInfo.ArchiveNo); } if (!string.IsNullOrEmpty(SearchInfo.UserName)) { query.AppendFormat(" AND UserName like'%{0}%'", SearchInfo.UserName); } if (SearchInfo.IsLeave.HasValue) { query.AppendFormat(" AND IsLeave={0}", SearchInfo.IsLeave == true ? 1 : 0); } if (SearchInfo.IsMarried.HasValue) { query.AppendFormat(" AND IsMarried={0}", SearchInfo.IsMarried == true ? 1 : 0); } if (SearchInfo.DutyId.HasValue) { query.AppendFormat(" AND DutyId={0}", SearchInfo.DutyId); } if (SearchInfo.BirthDateFrom.HasValue) { query.AppendFormat(" AND DATEDIFF(DAY,'{0}',BirthDate)>=0", SearchInfo.BirthDateFrom); } if (SearchInfo.BirthDateTo.HasValue) { query.AppendFormat(" AND DATEDIFF(DAY,BirthDate,'{0}')>=0", SearchInfo.BirthDateTo); } if (SearchInfo.PersonalType.HasValue && ((int)SearchInfo.PersonalType) >= 0) { query.AppendFormat(" AND PersonalType={0}", (int)SearchInfo.PersonalType); } if (SearchInfo.ContactSex.HasValue && ((int)SearchInfo.ContactSex) > 0) { query.AppendFormat(" AND ContactSex={0}", (int)SearchInfo.ContactSex); } if (SearchInfo.WorkYearFrom.HasValue && SearchInfo.WorkYearFrom > 0) { query.AppendFormat(" AND DATEDIFF(DAY,EntryDate,getdate())>={0}", SearchInfo.WorkYearFrom * 365); } if (SearchInfo.WorkYearTo.HasValue && SearchInfo.WorkYearTo > 0) { query.AppendFormat(" AND DATEDIFF(DAY,EntryDate,getdate())<={0}", SearchInfo.WorkYearTo * 365); } #endregion using (IDataReader dr = DbHelper.ExecuteReader(_db, PageSize, PageIndex, ref ReCordCount, tableName, identityColumnName, fields.ToString(), query.ToString(), orderByString)) { ResultList = new List <EyouSoft.Model.AdminCenterStructure.PersonnelInfo>(); while (dr.Read()) { EyouSoft.Model.AdminCenterStructure.PersonnelInfo model = new EyouSoft.Model.AdminCenterStructure.PersonnelInfo() { Id = dr.GetInt32(dr.GetOrdinal("Id")), ArchiveNo = dr.IsDBNull(dr.GetOrdinal("ArchiveNo")) ? "" : dr.GetString(dr.GetOrdinal("ArchiveNo")), MSN = dr.IsDBNull(dr.GetOrdinal("MSN")) ? "" : dr.GetString(dr.GetOrdinal("MSN")), QQ = dr.IsDBNull(dr.GetOrdinal("QQ")) ? "" : dr.GetString(dr.GetOrdinal("QQ")), UserName = dr.IsDBNull(dr.GetOrdinal("UserName")) ? "" : dr.GetString(dr.GetOrdinal("UserName")), ContactSex = (EyouSoft.Model.EnumType.CompanyStructure.Sex)Enum.Parse(typeof(EyouSoft.Model.EnumType.CompanyStructure.Sex), dr.GetInt32(dr.GetOrdinal("ContactSex")).ToString()), DepartmentList = this.GetDepartmentList(dr["DepartmentXML"].ToString()), DepartmentId = dr["DepartmentId"].ToString(), DutyName = dr.IsDBNull(dr.GetOrdinal("DutyName")) ? "" : dr.GetString(dr.GetOrdinal("DutyName")), WorkYear = dr.IsDBNull(dr.GetOrdinal("WorkYear")) ? 0 : Convert.ToInt32(dr["WorkYear"].ToString()), ContactTel = dr.IsDBNull(dr.GetOrdinal("ContactTel")) ? "" : dr.GetString(dr.GetOrdinal("ContactTel")), ContactMobile = dr.IsDBNull(dr.GetOrdinal("ContactMobile")) ? "" : dr.GetString(dr.GetOrdinal("ContactMobile")), Email = dr.IsDBNull(dr.GetOrdinal("Email")) ? "" : dr.GetString(dr.GetOrdinal("Email")) }; if (dr.IsDBNull(dr.GetOrdinal("EntryDate"))) { model.EntryDate = null; } else { model.EntryDate = dr.GetDateTime(dr.GetOrdinal("EntryDate")); } if (dr.IsDBNull(dr.GetOrdinal("BirthDate"))) { model.BirthDate = null; } else { model.BirthDate = dr.GetDateTime(dr.GetOrdinal("BirthDate")); } ResultList.Add(model); model = null; } }; return(ResultList); }
/// <summary> /// 获取人事档案列表(内部通讯录)信息 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="ReCordCount"></param> /// <param name="CompanyId">公司编号</param> /// <param name="SearchInfo">认识档案搜索实体</param> /// <returns></returns> public IList <EyouSoft.Model.AdminCenterStructure.PersonnelInfo> GetList(int PageSize, int PageIndex, ref int ReCordCount, int CompanyId, EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo SearchInfo) { return(idal.GetList(PageSize, PageIndex, ref ReCordCount, CompanyId, SearchInfo)); }
protected void Page_Load(object sender, EventArgs e) { #region 除参数 string Method = Utils.GetQueryStringValue("method"); int PersonnelID = Utils.GetInt(Utils.GetQueryStringValue("personnelID"), -1); PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); #endregion if (!IsPostBack && Method == "" && PersonnelID == -1) { if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_人事档案_修改档案)) { EditFlag = true; } if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_人事档案_删除档案)) { DeleteFlag = true; } GetOnSearchValue(); BindData(); } if (Method == "deletePersonnelInfo" && PersonnelID != -1)//删除 { EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllPersonnel = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); if (bllPersonnel.Delete(CurrentUserCompanyID, PersonnelID)) { Response.Clear(); Response.Write("True"); Response.End(); } else { Response.Clear(); Response.Write("False"); Response.End(); } } if (Method == "GetExcel" && PersonnelID == -1) // 导出Excel { GetOnSearchValue(); BindData(); EyouSoft.BLL.AdminCenterStructure.PersonnelInfo bllPersonnel = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo(); EyouSoft.Model.AdminCenterStructure.PersonnelSearchInfo modelPersonnelSearch = GetPersonnelSearchInfo(); if (RecordCount > 0) { listPersonnel = bllPersonnel.GetList(RecordCount, 1, ref RecordCount, CurrentUserCompanyID, modelPersonnelSearch); if (listPersonnel != null && listPersonnel.Count > 0) { ToExcel(listPersonnel); } else { ToExcel(new List <EyouSoft.Model.AdminCenterStructure.PersonnelInfo>()); } } else { ToExcel(new List <EyouSoft.Model.AdminCenterStructure.PersonnelInfo>()); } } }