public string IsPowerful(String user) { try { PM_EM_EMPLOYEE entity = new PM_EM_EMPLOYEE(); entity.IsTeamLeader = true; entity.EmployeeCardID = user; IList <PM_EM_EMPLOYEE> list = emEmployeeBO.GetEntitieByID(entity); if (list.Count > 0) { return("2");//班长 } else { PM_EM_EMPLOYEE entityUser = new PM_EM_EMPLOYEE(); entityUser.EmployeeCardID = user.ToString(); IList <PM_EM_EMPLOYEE> list1 = emEmployeeBO.GetEntities(entityUser); if (list1.Count > 0) { return("您没有操作权限"); } else { return("1"); //主任及以上级别 } } } catch (Exception ex) { return("查询失败:" + ex.Message); } }
public void EditEmployee(PM_EM_EMPLOYEE definitions) { definitions.EntryTime = definitions.EntryTime.Value.AddHours(8); if (definitions.LeveTime != null) { definitions.LeveTime = definitions.LeveTime.Value.AddHours(8); } if (!string.IsNullOrEmpty(definitions.LeveTime.ToString())) { definitions.EmployeeStatus = "2"; } definitions.RowDeleted = false; employeeBO.Update(definitions); }
public HttpResponseMessage AddEmployee(PM_EM_EMPLOYEE definitions) { definitions.EmployeeGuid = Guid.NewGuid(); definitions.CreatedOn = SSGlobalConfig.Now; definitions.RowDeleted = false; PM_EM_EMPLOYEE employee = new PM_EM_EMPLOYEE(); employee.EmployeeCardID = definitions.EmployeeCardID; employee.RowDeleted = false; IList <PM_EM_EMPLOYEE> list = new List <PM_EM_EMPLOYEE>(); list = employeeBO.GetEntities(employee); if (list.Count != 0) { return(Request.CreateResponse(HttpStatusCode.OK, "该用户已经存在")); } else { definitions.EntryTime = definitions.EntryTime.Value.AddHours(8); if (definitions.LeveTime != null) { definitions.LeveTime = definitions.LeveTime.Value.AddHours(8); } if (!string.IsNullOrEmpty(definitions.LeveTime.ToString())) { definitions.EmployeeStatus = "2"; } PM_EM_EMPLOYEE mmExt = employeeBO.Insert(definitions); if (mmExt != null) { return(Request.CreateResponse(HttpStatusCode.OK, "新增成功")); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败")); } } }
public string IsTeamLeader(string ID) { PM_EM_EMPLOYEE employeeModel = new PM_EM_EMPLOYEE(); employeeModel.EmployeeCardID = ID; IList <PM_EM_EMPLOYEE> employeeList = employeeBO.GetEntities(employeeModel); if (employeeList == null || employeeList.Count == 0) { return("-1"); } else { if ((bool)employeeList[0].IsTeamLeader) { return("1"); } else { return("0"); } } }
//判断员工是否存在 public IList<PM_EM_TS_ATTENDANCE> GetAttendance(String EmployeeCardID) { IList<PM_EM_TS_ATTENDANCE> AtList = new List<PM_EM_TS_ATTENDANCE>(); try { //根据员工id查询guid(employee) //if (EmployeeCardID != null) { PM_EM_EMPLOYEE em = new PM_EM_EMPLOYEE(); em.EmployeeCardID = EmployeeCardID; IList<PM_EM_EMPLOYEE> EmList = new List<PM_EM_EMPLOYEE>(); //根据CardId查询员工的Uuid EmList = EmployeeBo.GetEntities(em); if (EmList != null && EmList.Count > 0) { PM_EM_TS_ATTENDANCE attendance = new PM_EM_TS_ATTENDANCE(); attendance.EmployeeGuid = EmList[0].EmployeeGuid; AtList = AttendanceBo.GetEntities(attendance); } return AtList; } } catch (Exception e) { throw e; } }
public string InputExcel(string filePath, string userid) { string strReturn = "true"; IWorkbook workbook = null; FileStream file = File.OpenRead(filePath); string extension = System.IO.Path.GetExtension(filePath); try { if (extension.Equals(".xls")) { workbook = new HSSFWorkbook(file); } else { workbook = new XSSFWorkbook(file);//07版本及以上 } file.Close(); //读取当前表数据 ISheet sheet = workbook.GetSheetAt(0); IRow row = sheet.GetRow(0); for (int i = 1; i < sheet.LastRowNum + 1; i++) //lastRownum是总行数-1 { PM_EM_EMPLOYEE employee = new PM_EM_EMPLOYEE(); row = sheet.GetRow(i); if (row != null) { employee.EmployeeCardID = row.GetCell(0).ToString().Trim(); CV_PM_EM_EMPLOYEE qp = new CV_PM_EM_EMPLOYEE(); qp.EmployeeCardID = employee.EmployeeCardID; IList <CV_PM_EM_EMPLOYEE> emlist = new List <CV_PM_EM_EMPLOYEE>(); emlist = cvemployeeBO.GetEntities(qp); if (emlist.Count != 0) { return("工号[" + employee.EmployeeCardID + "]已存在"); } else { employee.EmployeeName = row.GetCell(1).ToString().Trim(); employee.EmployeeStatus = row.GetCell(2).ToString().Trim(); if (employee.EmployeeStatus == "在职") { employee.EmployeeStatus = "1"; } else if (employee.EmployeeStatus == "离职") { employee.EmployeeStatus = "2"; } else if (employee.EmployeeStatus == "待岗") { employee.EmployeeStatus = "3"; } else { return("【员工状态】的值不正确"); } string strLeader = row.GetCell(3).ToString().Trim(); if (strLeader == "是" || strLeader == "1") { employee.IsTeamLeader = true; } else if (strLeader == "否" || strLeader == "0" || strLeader == "") { employee.IsTeamLeader = false; } else { return("【是否为班长】的值不正确"); } //employee.IsTeamLeader = Convert.ToBoolean(strLeader); employee.EntryTime = SSGlobalConfig.Now; employee.CreatedBy = userid; this.AddEmployee(employee); } } } } catch (Exception e) { strReturn = e.Message; } return(strReturn); }