/// <summary> /// 修改请假数据 /// </summary> /// <param name="leaveOffice"></param> /// <returns></returns> public bool UpdateLeaveOffices(LeaveOffice leaveOffice, ref string log) { try { int number = 0; _leaveOfficeResposit.StatrAffair(() => { number += _leaveOfficeResposit.UpdateInfo(x => new LeaveOffice { Reason = leaveOffice.Reason, UpdateTime = DateTime.Now }, x => x.Id == leaveOffice.Id); }); log = "成功"; return(number >= 0); } catch (Exception ex) { log = ex.ToString(); throw; } }
/// <summary> /// 增添员工离职申请 /// </summary> /// <param name="leaveOffice"></param> /// <returns></returns> public string addLeaveOfficesInfoAll(LeaveOffice leaveOffice) { string isOk = "添加失败!"; Staff staffInfo = _staffResposit.FindAll().FirstOrDefault(x => x.NoN == leaveOffice.NoN); if (staffInfo == null) { isOk = "未查询到此人"; return(isOk); } //开启事务 _leaveOfficeResposit.StatrAffair(() => { leaveOffice.ApplyDate = DateTime.Now; leaveOffice.isyes = 1; leaveOffice.IsDel = "0"; leaveOffice.ApplyPersonId = staffInfo.Id.ToString(); leaveOffice.CreateTime = DateTime.Now; int leaveId = _leaveOfficeResposit.AddCreateInfo(leaveOffice); ProcessStepRecord processStepRecord = new ProcessStepRecord(); processStepRecord.Typed = ProcessType.员工离职审批流程.ToString(); if (leaveOffice.JobId == (int)JobEmun.油站员工) { processStepRecord.OilStation = 1; } else if (leaveOffice.JobId == (int)JobEmun.人事员工) { processStepRecord.ExecutiveDirector = 1; //人事经理 } else if (leaveOffice.JobId == (int)JobEmun.油站经理 || leaveOffice.JobId == (int)JobEmun.财务经理) { processStepRecord.ExecutiveDirector = 1; //人事经理 processStepRecord.GeneralManagerOfPerson = 1; //主管 } else if (leaveOffice.JobId == (int)JobEmun.人事经理 || leaveOffice.JobId == (int)JobEmun.主管) { processStepRecord.GeneralManager = 1; //总经理 processStepRecord.ChiefInspector = 1; //总监 } else if (leaveOffice.JobId == (int)JobEmun.总经理) { processStepRecord.ChiefInspector = 1; } #region 生成non号 不可重复 (后期数据多了之后需要改进) bool isok = true; string non = ""; while (isok) { non = GetTime.randomPwd() + GetTime.randomPwd() + GetTime.randomPwd(); var list = (from pr in _processStepRecordResposit.FindAll() where non == pr.NoN select new { }).ToList(); if (list.Count == 0) { isok = false; } } #endregion processStepRecord.CreateTime = DateTime.Now; processStepRecord.WhetherToExecute = 1; processStepRecord.NoN = non; processStepRecord.RefOrderId = leaveId; //关联的离职申请表的主键id processStepRecord.Result = 0; _processStepRecordResposit.AddInfo(processStepRecord); isOk = "ok"; }); return(isOk); }