/// <summary> /// 领导审核修改出差单据 /// </summary> /// <param name="onBusiness">出差单据数据集</param> /// <param name="roleType">角色类型</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool UpdateOnBusinessBill(HR_OnBusinessBill onBusiness, string roleType, out string error) { error = ""; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; dataContxt.Connection.Open(); dataContxt.Transaction = dataContxt.Connection.BeginTransaction(); try { var result = from a in dataContxt.HR_OnBusinessBill where a.ID == onBusiness.ID select a; if (result.Count() != 1) { error = "信息有误,请查证后再操作!"; return(false); } HR_OnBusinessBill bill = result.Single(); bill.BillStatus = onBusiness.BillStatus; switch (roleType) { case "部门主管审批": bill.DeptPrincipal += "," + BasicInfo.LoginID; bill.DeptSignatureDate = onBusiness.DeptSignatureDate; bill.WithinBudget = onBusiness.WithinBudget; bill.LeaderSignature = onBusiness.LeaderSignature; bill.LeaderSignatureDate = onBusiness.LeaderSignatureDate; bill.Authorize = onBusiness.Authorize; break; case "分管领导审批": bill.LeaderSignature = onBusiness.LeaderSignature; bill.LeaderSignatureDate = onBusiness.LeaderSignatureDate; bill.Authorize = onBusiness.Authorize; break; case "总经理审批": bill.GeneralManager = onBusiness.GeneralManager; bill.GM_SignatureDate = onBusiness.GM_SignatureDate; bill.Authorize = onBusiness.Authorize; break; case "随行人员部门确认": break; case "销差人确认": bill.RealBeginTime = onBusiness.RealBeginTime; bill.RealEndTime = onBusiness.RealEndTime; bill.Confirmor = onBusiness.Confirmor; bill.ConfirmorDate = onBusiness.ConfirmorDate; break; case "出差结果说明": bill.Result = onBusiness.Result; break; default: break; } dataContxt.SubmitChanges(); if (GlobalObject.GeneralFunction.StringConvertToEnum <OnBusinessBillStatus>(bill.BillStatus) == OnBusinessBillStatus.已完成 || GlobalObject.GeneralFunction.StringConvertToEnum <OnBusinessBillStatus>(bill.BillStatus) == OnBusinessBillStatus.等待出差结果说明) { ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>(); service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.出差); } dataContxt.Transaction.Commit(); return(true); } catch (Exception ex) { dataContxt.Transaction.Rollback(); error = ex.Message; return(false); } }
/// <summary> /// 修改请假信息 /// </summary> /// <param name="leave">请假申请数据集</param> /// <param name="roleType">角色类型(部门主管审批,部门负责人审批 /// 分管领导审批,总经理审批,人力资源部复审)</param> /// <param name="error">错误信息</param> /// <returns>成功返回true,失败返回False</returns> public bool UpdateLeave(HR_LeaveBill leave, string roleType, out string error) { error = ""; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; dataContxt.Connection.Open(); dataContxt.Transaction = dataContxt.Connection.BeginTransaction(); try { var result = from a in dataContxt.HR_LeaveBill where a.ID == leave.ID select a; if (result.Count() != 1) { error = "信息有误,请查证后再操作!"; return(false); } HR_LeaveBill bill = result.Single(); bill.BillStatus = leave.BillStatus; switch (roleType) { case "部门主管审批": bill.DeptDirector = leave.DeptDirector; bill.DeptDirectorSignatureDate = leave.DeptDirectorSignatureDate; break; case "部门负责人审批": bill.DeptPrincipal = leave.DeptPrincipal; bill.DeptPrincipalSignatureDate = leave.DeptPrincipalSignatureDate; bill.Authorize = leave.Authorize; bill.UnexcusedReason = leave.UnexcusedReason; bill.Leader = leave.Leader; bill.LeaderSignatureDate = leave.LeaderSignatureDate; break; case "分管领导审批": bill.Leader = leave.Leader; bill.LeaderSignatureDate = leave.LeaderSignatureDate; bill.Authorize = leave.Authorize; bill.UnexcusedReason = leave.UnexcusedReason; break; case "总经理审批": bill.GeneralManager = leave.GeneralManager; bill.GM_SignatureDate = leave.GM_SignatureDate; bill.Authorize = leave.Authorize; bill.UnexcusedReason = leave.UnexcusedReason; break; case "人力资源部复审": bill.HR_Signature = leave.HR_Signature; bill.HR_SignatureDate = leave.HR_SignatureDate; bill.LeaveTypeID = leave.LeaveTypeID; break; default: break; } dataContxt.SubmitChanges(); if (GlobalObject.GeneralFunction.StringConvertToEnum <LeaveBillStatus>(bill.BillStatus) == LeaveBillStatus.已完成) { ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>(); service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.请假); } dataContxt.Transaction.Commit(); return(true); } catch (Exception ex) { dataContxt.Transaction.Rollback(); error = ex.Message; return(false); } }
/// <summary> /// 领导审核修改加班单据 /// </summary> /// <param name="overTime">出差单据数据集</param> /// <param name="roleType">角色类型</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool UpdateOverTimeBill(HR_OvertimeBill overTime, string roleType, out string error) { error = ""; DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; dataContxt.Connection.Open(); dataContxt.Transaction = dataContxt.Connection.BeginTransaction(); try { var result = from a in dataContxt.HR_OvertimeBill where a.ID == overTime.ID select a; if (result.Count() != 1) { error = "信息有误,请查证后再操作!"; return(false); } HR_OvertimeBill bill = result.Single(); List <string> list = new List <string>(); DataTable dt = GlobalObject.DatabaseServer.QueryInfo("select * from HR_OvertimePersonnel where billID=" + bill.ID); for (int i = 0; i < dt.Rows.Count; i++) { list.Add(dt.Rows[i]["WorkID"].ToString()); } bill.BillStatus = overTime.BillStatus; switch (roleType) { case "部门主管审批": bill.DeptDirector = overTime.DeptDirector; bill.DeptDirectorSignatureDate = overTime.DeptDirectorSignatureDate; break; case "分管领导审批": bill.Leader = overTime.Leader; bill.LeaderSignatureDate = overTime.LeaderSignatureDate; bill.Authorize = overTime.Authorize; bill.VerifyHours = overTime.VerifyHours; bill.RealHours = overTime.RealHours; break; case "部门负责人审批": bill.DeptPrincipal = overTime.DeptPrincipal; bill.DeptPrincipalSignatureDate = overTime.DeptPrincipalSignatureDate; bill.Authorize = overTime.Authorize; bill.VerifyHours = overTime.VerifyHours; bill.RealHours = overTime.RealHours; break; case "人力资源": bill.HR_Signature = overTime.HR_Signature; bill.HR_SignatureDate = overTime.HR_SignatureDate; break; case "确认加班完成情况": bill.Verifier = overTime.Verifier; bill.VerifyFinish = overTime.VerifyFinish; bill.VerifyHours = overTime.VerifyHours; bill.VerifySignaturDate = overTime.VerifySignaturDate; bill.RealHours = Convert.ToDouble(overTime.VerifyHours); break; default: break; } dataContxt.SubmitChanges(); if (GlobalObject.GeneralFunction.StringConvertToEnum <OverTimeBillStatus>(bill.BillStatus) == OverTimeBillStatus.已完成) { ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>(); service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.加班); } dataContxt.Transaction.Commit(); return(true); } catch (Exception ex) { dataContxt.Transaction.Rollback(); error = ex.Message; return(false); } }