public string EditTeamEmployee(CV_PM_EM_EMPLOYEE param) { try { //如果已经拥有了分组,则更新;否则插入 PM_EM_TEAM_EMPLOYEE qryModel = new PM_EM_TEAM_EMPLOYEE(); PM_EM_TEAM_EMPLOYEE insrtModel = new PM_EM_TEAM_EMPLOYEE(); qryModel.EmployeeGuid = param.EmployeeGuid; //qryModel.TeamGuid = param.TeamGuid; //qryModel.PositionGuid = param.PositionGuid; IList <PM_EM_TEAM_EMPLOYEE> list = teamemployeeBO.GetEntities(qryModel); if (list == null || list.Count == 0) { insrtModel.TeamEmployeeGuid = Guid.NewGuid(); insrtModel.EmployeeGuid = param.EmployeeGuid; insrtModel.TeamGuid = param.TeamGuid; insrtModel.PositionGuid = param.PositionGuid; insrtModel.CreatedBy = param.CreatedBy; insrtModel.CreatedOn = SSGlobalConfig.Now; teamemployeeBO.Insert(insrtModel); } else { list[0].TeamGuid = param.TeamGuid; list[0].PositionGuid = param.PositionGuid; list[0].UpdatedOn = SSGlobalConfig.Now; teamemployeeBO.UpdateSome(list[0]); } return("编辑成功!"); } catch (Exception ex) { return("编辑失败:" + ex.Message); } }
public IList <CV_PM_EM_EMPLOYEE> GetAllMenu() { CV_PM_EM_EMPLOYEE qryModel = new CV_PM_EM_EMPLOYEE(); IList <CV_PM_EM_EMPLOYEE> list = new List <CV_PM_EM_EMPLOYEE>(); list = cvemployeeBO.GetEntities(qryModel); return(list); }
public IList <CV_PM_EM_EMPLOYEE> GetAllUnteamedEmployee() { try { CV_PM_EM_EMPLOYEE qryModel = new CV_PM_EM_EMPLOYEE(); qryModel.teamEmployeeStatus = "否"; IList <CV_PM_EM_EMPLOYEE> list = new List <CV_PM_EM_EMPLOYEE>(); list = cvemployeeBO.GetEntities(qryModel); return(list); } catch (Exception) { return(null); } }
public IList <CV_PM_EM_EMPLOYEE> GetEmployee(CV_PM_EM_EMPLOYEE definitions) { IList <CV_PM_EM_EMPLOYEE> list = new List <CV_PM_EM_EMPLOYEE>(); if (definitions != null) { try { switch (definitions.EmployeeStatus) { case "1": definitions.EmployeeStatus = "在职"; break; case "2": definitions.EmployeeStatus = "离职"; break; case "3": definitions.EmployeeStatus = "待岗"; break; } //definitions.EmployeeStatus = "在职"; list = cvemployeeBO.GetEntities(definitions); return(list); } catch (Exception e) { throw e; } } else { return(null); } }
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); }