public byte[] GetEmployeePhoto(string employeeid) { using (CommDal <T_HR_EMPLOYEE> cdl = new CommDal <T_HR_EMPLOYEE>()) { var q = from ent in cdl.GetObjects <T_HR_EMPLOYEE>() where ent.EMPLOYEEID == employeeid select ent.PHOTO; if (q.Count() > 0) { return(q.FirstOrDefault()); } else { return(null); } } }
/// <summary> /// 获取所有部门 /// </summary> /// <returns>所有有效的部门</returns> public List<DepartmentModel> GetAllDepartment() { using (CommDal<T_HR_DEPARTMENT> cdl = new CommDal<T_HR_DEPARTMENT>()) { var departmentList = from v in cdl.GetObjects() .Include("T_HR_COMPANY") .Include("T_HR_DEPARTMENTDICTIONARY") .Where(s => s.EDITSTATE == "1" && s.CHECKSTATE == "2") select new DepartmentModel { DeptID = v.DEPARTMENTID, DepartName = v.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME, CompanyID = v.T_HR_COMPANY.COMPANYID, ParentID = v.FATHERID, SORTINDEX = v.SORTINDEX, FatherType = v.FATHERTYPE }; return departmentList.ToList(); } }
/// <summary> /// 获取所有部门 /// </summary> /// <returns>所有有效的部门</returns> public List <DepartmentModel> GetAllDepartment() { using (CommDal <T_HR_DEPARTMENT> cdl = new CommDal <T_HR_DEPARTMENT>()) { var departmentList = from v in cdl.GetObjects() .Include("T_HR_COMPANY") .Include("T_HR_DEPARTMENTDICTIONARY") .Where(s => s.EDITSTATE == "1" && s.CHECKSTATE == "2") select new DepartmentModel { DeptID = v.DEPARTMENTID, DepartName = v.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME, CompanyID = v.T_HR_COMPANY.COMPANYID, ParentID = v.FATHERID, SORTINDEX = v.SORTINDEX, FatherType = v.FATHERTYPE }; return(departmentList.ToList()); } }
/// <summary> /// 获取员工 /// </summary> /// <returns>所有有效的员工</returns> public List <EmployeeModel> GetEmployeeComm() { using (CommDal <T_HR_EMPLOYEE> cdl = new CommDal <T_HR_EMPLOYEE>()) { var ents = from o in cdl.GetObjects() join ep in cdl.GetObjects <T_HR_EMPLOYEEPOST>() on o.EMPLOYEEID equals ep.T_HR_EMPLOYEE.EMPLOYEEID join p in cdl.GetObjects <T_HR_POST>() on ep.T_HR_POST.POSTID equals p.POSTID join pd in cdl.GetObjects <T_HR_POSTDICTIONARY>() on p.T_HR_POSTDICTIONARY.POSTDICTIONARYID equals pd.POSTDICTIONARYID join d in cdl.GetObjects <T_HR_DEPARTMENT>() on p.T_HR_DEPARTMENT.DEPARTMENTID equals d.DEPARTMENTID join c in cdl.GetObjects <T_HR_COMPANY>() on d.T_HR_COMPANY.COMPANYID equals c.COMPANYID join cd in cdl.GetObjects <T_HR_DEPARTMENTDICTIONARY>() on d.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID equals cd.DEPARTMENTDICTIONARYID where o.EDITSTATE == "1" && o.EMPLOYEESTATE != "2" && ep.CHECKSTATE == "2" && ep.EDITSTATE == "1" select new EmployeeModel { CompanyName = c.CNAME, EmployeeId = o.EMPLOYEEID, EmployeeName = o.EMPLOYEECNAME, LoginAccount = o.EMPLOYEEENAME, Sex = o.SEX, Age = "", Email = o.EMAIL, Address = o.FAMILYADDRESS, AddCode = "", Mobile = o.MOBILE, Tel = o.OFFICEPHONE, Nation = "", Province = "", City = "", Remark = o.REMARK, DeptID = d.DEPARTMENTID, DepartMentName = cd.DEPARTMENTNAME, PostName = pd.POSTNAME, PostID = p.POSTID, IsAgencePost = ep.ISAGENCY }; return(ents.ToList()); } }
/// <summary> /// 获取员工 /// </summary> /// <returns>所有有效的员工</returns> public List<EmployeeModel> GetEmployeeComm() { using (CommDal<T_HR_EMPLOYEE> cdl = new CommDal<T_HR_EMPLOYEE>()) { var ents = from o in cdl.GetObjects() join ep in cdl.GetObjects<T_HR_EMPLOYEEPOST>() on o.EMPLOYEEID equals ep.T_HR_EMPLOYEE.EMPLOYEEID join p in cdl.GetObjects<T_HR_POST>() on ep.T_HR_POST.POSTID equals p.POSTID join pd in cdl.GetObjects<T_HR_POSTDICTIONARY>() on p.T_HR_POSTDICTIONARY.POSTDICTIONARYID equals pd.POSTDICTIONARYID join d in cdl.GetObjects<T_HR_DEPARTMENT>() on p.T_HR_DEPARTMENT.DEPARTMENTID equals d.DEPARTMENTID join c in cdl.GetObjects<T_HR_COMPANY>() on d.T_HR_COMPANY.COMPANYID equals c.COMPANYID join cd in cdl.GetObjects<T_HR_DEPARTMENTDICTIONARY>() on d.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID equals cd.DEPARTMENTDICTIONARYID where o.EDITSTATE == "1" && o.EMPLOYEESTATE != "2" && ep.CHECKSTATE == "2" && ep.EDITSTATE == "1" select new EmployeeModel { CompanyName = c.CNAME, EmployeeId = o.EMPLOYEEID, EmployeeName = o.EMPLOYEECNAME, LoginAccount = o.EMPLOYEEENAME, Sex = o.SEX, Age = "", Email = o.EMAIL, Address = o.FAMILYADDRESS, AddCode = "", Mobile = o.MOBILE, Tel = o.OFFICEPHONE, Nation = "", Province = "", City = "", Remark = o.REMARK, DeptID = d.DEPARTMENTID, DepartMentName = cd.DEPARTMENTNAME, PostName = pd.POSTNAME, PostID = p.POSTID, IsAgencePost=ep.ISAGENCY }; return ents.ToList(); } }
public byte[] GetEmployeePhoto(string employeeid) { using (CommDal<T_HR_EMPLOYEE> cdl = new CommDal<T_HR_EMPLOYEE>()) { var q = from ent in cdl.GetObjects<T_HR_EMPLOYEE>() where ent.EMPLOYEEID == employeeid select ent.PHOTO; if (q.Count() > 0) return q.FirstOrDefault(); else return null; } }
/// <summary> /// 根据帐号获取员工信息 /// </summary> /// <param name="loginAccount"></param> /// <returns></returns> public string GetEmployeeInfo(string loginAccount) { StringBuilder StrReturn = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = true; try { using (XmlWriter writer = XmlWriter.Create(StrReturn, settings)) { using (CommDal<T_HR_EMPLOYEE> cdl = new CommDal<T_HR_EMPLOYEE>()) { var ents = from ent in cdl.GetObjects<T_HR_EMPLOYEE>() where ent.EMPLOYEEENAME == loginAccount select ent; if (ents.Count() > 0) { EmployeeModel employee = new EmployeeModel(); if (ents.FirstOrDefault() != null) { T_HR_EMPLOYEE UserInfo = ents.FirstOrDefault(); employee = GetSingelEmployee(UserInfo.EMPLOYEEID); if (employee != null) { writer.WriteStartElement("BizRegReq"); writer.WriteStartElement("Employee"); writer.WriteAttributeString("EmployeeId", employee.EmployeeId); writer.WriteAttributeString("EmployeeName", employee.EmployeeName); writer.WriteAttributeString("LoginAccount", employee.LoginAccount); writer.WriteAttributeString("Sex", employee.Sex); //writer.WriteAttributeString("Age", ""); writer.WriteAttributeString("PostName", employee.PostName); writer.WriteAttributeString("Email", employee.Email); writer.WriteAttributeString("Address", employee.Address); writer.WriteAttributeString("AddCode", "");//没有默认为空 writer.WriteAttributeString("Mobile", employee.Mobile); writer.WriteAttributeString("Tel", employee.Tel); writer.WriteAttributeString("Nation", ""); writer.WriteAttributeString("Province", ""); writer.WriteAttributeString("City", ""); writer.WriteAttributeString("PostID", employee.PostID); writer.WriteAttributeString("Remark", employee.Remark); writer.WriteAttributeString("CompanyName", employee.CompanyName); writer.WriteEndElement();//完成Employee节点 writer.WriteEndElement();//完成BizRegReq节点 } else { ErrorMessage(writer, "没有获取到该员工信息"); } } else { ErrorMessage(writer, "没有获取到该员工信息"); } } else { ErrorMessage(writer, "没有获取到该员工信息"); } writer.Flush(); } } } catch (Exception ex) { using (XmlWriter catchError = XmlWriter.Create(StrReturn, settings)) { ErrorMessage(catchError, "服务器错误"); Tracer.Debug("即时通讯-GetEmployeeInfo:" + ex.ToString() + System.DateTime.Now); catchError.Flush(); } } return StrReturn.ToString().Replace("\r", "").Replace("\n", ""); }
/// <summary> /// 根据帐号获取员工信息 /// </summary> /// <param name="loginAccount"></param> /// <returns></returns> public string GetEmployeeInfo(string loginAccount) { StringBuilder StrReturn = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = true; try { using (XmlWriter writer = XmlWriter.Create(StrReturn, settings)) { using (CommDal <T_HR_EMPLOYEE> cdl = new CommDal <T_HR_EMPLOYEE>()) { var ents = from ent in cdl.GetObjects <T_HR_EMPLOYEE>() where ent.EMPLOYEEENAME == loginAccount select ent; if (ents.Count() > 0) { EmployeeModel employee = new EmployeeModel(); if (ents.FirstOrDefault() != null) { T_HR_EMPLOYEE UserInfo = ents.FirstOrDefault(); employee = GetSingelEmployee(UserInfo.EMPLOYEEID); if (employee != null) { writer.WriteStartElement("BizRegReq"); writer.WriteStartElement("Employee"); writer.WriteAttributeString("EmployeeId", employee.EmployeeId); writer.WriteAttributeString("EmployeeName", employee.EmployeeName); writer.WriteAttributeString("LoginAccount", employee.LoginAccount); writer.WriteAttributeString("Sex", employee.Sex); //writer.WriteAttributeString("Age", ""); writer.WriteAttributeString("PostName", employee.PostName); writer.WriteAttributeString("Email", employee.Email); writer.WriteAttributeString("Address", employee.Address); writer.WriteAttributeString("AddCode", "");//没有默认为空 writer.WriteAttributeString("Mobile", employee.Mobile); writer.WriteAttributeString("Tel", employee.Tel); writer.WriteAttributeString("Nation", ""); writer.WriteAttributeString("Province", ""); writer.WriteAttributeString("City", ""); writer.WriteAttributeString("PostID", employee.PostID); writer.WriteAttributeString("Remark", employee.Remark); writer.WriteAttributeString("CompanyName", employee.CompanyName); writer.WriteEndElement(); //完成Employee节点 writer.WriteEndElement(); //完成BizRegReq节点 } else { ErrorMessage(writer, "没有获取到该员工信息"); } } else { ErrorMessage(writer, "没有获取到该员工信息"); } } else { ErrorMessage(writer, "没有获取到该员工信息"); } writer.Flush(); } } } catch (Exception ex) { using (XmlWriter catchError = XmlWriter.Create(StrReturn, settings)) { ErrorMessage(catchError, "服务器错误"); Tracer.Debug("即时通讯-GetEmployeeInfo:" + ex.ToString() + System.DateTime.Now); catchError.Flush(); } } return(StrReturn.ToString().Replace("\r", "").Replace("\n", "")); }
/// <summary> /// 根据设置的日历重新初始化考勤 /// </summary> /// <param name="entVacRd"></param> private void reInitAttandeceRecordWithOutWorkDaySet(string VACATIONID) { try { using (dal = new CommDal <T_HR_VACATIONSET>()) { var q = from ent in dal.GetObjects <T_HR_VACATIONSET>().Include("T_HR_OUTPLANDAYS") where ent.VACATIONID == VACATIONID select ent; var entVacRd = q.FirstOrDefault(); if (entVacRd == null) { Tracer.Debug("根据设置的日历重新初始化考勤跳过,获取的T_HR_VACATIONSET为空,id:" + VACATIONID); } List <T_HR_OUTPLANDAYS> entOutPlanDays = entVacRd.T_HR_OUTPLANDAYS.ToList(); bool needInitCompanyAttanceDayAgain = false; string strCurYearMonth = string.Empty; if (entOutPlanDays.Count == 0) { Tracer.Debug("根据设置的日历重新初始化考勤跳过,明细为空"); } foreach (T_HR_OUTPLANDAYS item in entOutPlanDays) { #region 处理考勤初始化 if (item.DAYTYPE == (Convert.ToInt32(Common.OutPlanDaysType.Vacation) + 1).ToString()) { try { string sql = @"delete smthrm.t_hr_attendancerecord a where a.ownercompanyid = '" + entVacRd.ASSIGNEDOBJECTID + @"' and a.attendancedate >= To_Date('" + item.STARTDATE.Value.ToString("yyyy-MM-dd") + @"', 'yyyy-MM-dd') and a.attendancedate <= To_Date('" + item.ENDDATE.Value.ToString("yyyy-MM-dd") + @"', 'yyyy-MM-dd')"; var attdel = from ent in dal.GetObjects <T_HR_ATTENDANCERECORD>() where ent.OWNERCOMPANYID == entVacRd.ASSIGNEDOBJECTID && ent.ATTENDANCEDATE >= item.STARTDATE && ent.ATTENDANCEDATE <= item.ENDDATE select ent; int i = 0; foreach (var att in attdel) { i = i + dal.Delete(att); } //int i = dal.ExecuteNonQuery(sql); Tracer.Debug("新增假期设置删除设定日期整个公司考勤初始化记录,共删除:" + i.ToString() + " 条数据:转换出的sql" + sql); } catch (Exception ex) { Tracer.Debug("新增假期设置删除设定日期整个公司考勤初始化记录异常:" + ex.ToString()); } } //if (item.DAYTYPE == (Convert.ToInt32(Common.OutPlanDaysType.WorkDay) + 1).ToString()) //{ //如果设置的日期是当月,需要重新初始化公司考勤 if (item.STARTDATE.Value <= DateTime.Now.AddMonths(1).AddDays(-1)) { needInitCompanyAttanceDayAgain = true; strCurYearMonth = item.STARTDATE.Value.Year + "-" + item.STARTDATE.Value.Month; } if (item.ENDDATE.Value <= DateTime.Now.AddMonths(1).AddDays(-1)) { needInitCompanyAttanceDayAgain = true; strCurYearMonth = item.ENDDATE.Value.Year + "-" + item.ENDDATE.Value.Month; } //} #endregion } if (needInitCompanyAttanceDayAgain) { Tracer.Debug("====================================新增假期设置工作日开始初始化整个公司考勤记录"); using (AttendanceSolutionAsignBLL bllAttendanceSolutionAsign = new AttendanceSolutionAsignBLL()) { bllAttendanceSolutionAsign.AsignAttendanceSolutionByOrgID("1", entVacRd.ASSIGNEDOBJECTID, strCurYearMonth); } Tracer.Debug("====================================新增假期设置工作日初始化整个公司考勤记录完毕"); } } } catch (Exception ex) { Tracer.Debug(ex.ToString()); } }