private void InitPresenter(bool ispostback) { _View.ReasonMessage = string.Empty; _View.ResultMessage = string.Empty; _View.ProjectNameMessage = string.Empty; if (!ispostback) { OverWork OverWork = _IOverWork.GetOverWorkByOverWorkID(_View.ApplicationID); _View.EmployeeName = OverWork.Account.Name; _View.EmployeeID = OverWork.Account.Id; _View.ApplicationItemList = OverWork.Item; _View.TimeSpan = OverWork.FromDate + " ~ " + OverWork.ToDate; _View.CostTime = OverWork.CostTime.ToString(); _View.ProjectName = OverWork.ProjectName; _View.Reason = OverWork.Reason; _View.SubmitDate = OverWork.SubmitDate; _View.btnOKText = "暂 存"; _View.btnCancelText = "提 交"; _View.OperationType = "修改加班"; _View.SetReadOnly = false; if (OverWork.IfAutoCancel) { _View.Remind = "注:当前加班单已有提交记录,如果再次编辑,系统将自动取消之前的所有流程,并以编辑后的信息为准重新进行“暂存”/“提交”操作。"; } } }
/// <summary> /// </summary> public OverWork GetOverWorkByOverWorkID(int pKID) { OverWork overwork = null; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = pKID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOverWorkByOverWorkID", cmd)) { while (sdr.Read()) { List <OverWorkItem> overWorkItem = GetOverWorkItemByOverWorkID(Convert.ToInt32(sdr[_DbPKID])); Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); overwork = new OverWork(pKID, account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), overWorkItem, sdr[_DbProjectName].ToString()); overwork.DiyProcess = RequestUtility.GetDiyProcess(sdr[_DbDiyProcess].ToString()); break; } } return(overwork); }
/// <summary> /// </summary> public OverWork GetOverWorkByOverWorkID(int pKID) { OverWork OverWork = _OverWorkDal.GetOverWorkByOverWorkID(pKID); OverWork.Account = _AccountBll.GetAccountById(OverWork.Account.Id); return(OverWork); }
/// <summary> /// </summary> public List <OverWork> GetConfirmHistroy(int accountID, DateTime fromTime, DateTime toTime) { List <OverWork> iRet = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_OperatorID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = fromTime; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = toTime; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOverWorkConfirmHistroy", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OverWork overWork = new OverWork(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), GetOverWorkItemByOverWorkID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbProjectName].ToString()); iRet.Add(overWork); } return(iRet); } }
/// <summary> /// /// </summary> public void SetCanChangeAdjust(OverWork overWork) { foreach (OverWorkItem item in overWork.Item) { item.CanChangeAdjust = new OverWorkDiyProcessUtility().CanChangeAdjust(overWork.DiyProcess, item); } }
private void InitPresenter(bool ispostback) { AttachViewEvent(); _View.ReasonMessage = string.Empty; _View.ResultMessage = string.Empty; _View.ProjectNameMessage = string.Empty; _View.NotCalculate = true; if (!ispostback) { GetFlowList(); OverWork OverWork = _IOverWork.GetOverWorkByOverWorkID(_View.ApplicationID); _View.EmployeeName = OverWork.Account.Name; _View.EmployeeID = OverWork.Account.Id; _View.ApplicationItemList = OverWork.Item; _View.TimeSpan = OverWork.FromDate + " ~ " + OverWork.ToDate; _View.CostTime = OverWork.CostTime.ToString(); _View.ProjectName = OverWork.ProjectName; _View.Reason = OverWork.Reason; _View.SubmitDate = OverWork.SubmitDate; _View.OperationType = "加班详情"; _View.btnOKText = "确 定"; _View.btnCancelText = "取 消"; _View.SetReadOnly = true; } }
/// <summary> /// </summary> /// <param name="overWork"></param> /// <param name="isAdd">是新增还是修改</param> public ValidateRequestItemRepeat(OverWork overWork, bool isAdd) { _IsAdd = isAdd; _Request = new Request(overWork); _IsOverWorkJoinToCheck = true; _IsLeaveJoinToCheck = true; }
protected override void Validation() { _OverWork = new GetOverWork().GetOverWorkByOverWorkID(_OverWorkID); if (_OverWork == null) { HrmisUtility.ThrowException(HrmisUtility._OverWork_Not_Exit); } }
/// <summary> /// </summary> public ApproveOverWorkItem(int itemID, int accountID, bool isAgree, string remark, bool isAdjust, int OverWorkID, decimal adjustHour) { _Account = _DalAccountBll.GetAccountById(accountID); _OverWork = _OverWorkDal.GetOverWorkByOverWorkID(OverWorkID); _ItemID = itemID; _Remark = remark; _IsAgree = isAgree; _IsAdjust = isAdjust; _AdjustHour = adjustHour; }
/// <summary> /// /// </summary> private static string BuildBody(OverWork overWork, OverWorkItem item) { StringBuilder Content = new StringBuilder(); Content.AppendFormat("请审批{0}提交的{6}申请,从{2}到{3},共{4}小时,项目:{1},理由:{5}", overWork.Account.Name, overWork.ProjectName, item.FromDate, item.ToDate, item.CostTime , overWork.Reason, OverWorkUtility.GetOverWorkTypeName(item.OverWorkType)); return(Content.ToString()); }
/// <summary> /// </summary> public ApproveOverWorkItem(int itemID, int accountID, bool isAgree, string remark) { _Account = _DalAccountBll.GetAccountById(accountID); _OverWorkItem = _OverWorkDal.GetOverWorkItemByItemID(itemID); _OverWork = _OverWorkDal.GetOverWorkByOverWorkID(_OverWorkItem.OverWorkID); _ItemID = itemID; _Remark = remark; _IsAgree = isAgree; _IsAdjust = _OverWorkItem.Adjust; _AdjustHour = _OverWorkItem.AdjustHour; }
private void Init() { OverWork OverWork = _IOverWork.GetOverWorkByOverWorkID(_View.ApplicationID); _View.EmployeeName = OverWork.Account.Name; _View.EmployeeID = OverWork.Account.Id; _View.TimeSpan = OverWork.FromDate + " ~ " + OverWork.ToDate; _View.CostTime = OverWork.CostTime.ToString(); _View.OutLocation = OverWork.ProjectName; _View.OperationType = OperationType.Cancel; _View.ApproveStatusSource = RequestUtility.GetCancelChose(); _View.Reason = OverWork.Reason; _View.ApplicationItemList = OverWork.Item; }
/// <summary> /// </summary> public int UpdateOverWork(OverWork overWork) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = overWork.PKID; cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = overWork.Account.Id; cmd.Parameters.Add(_SubmitDate, SqlDbType.DateTime).Value = overWork.SubmitDate; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = overWork.FromDate; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = overWork.ToDate; cmd.Parameters.Add(_CostTime, SqlDbType.Decimal).Value = overWork.CostTime; cmd.Parameters.Add(_Reason, SqlDbType.Text).Value = overWork.Reason; cmd.Parameters.Add(_ProjectName, SqlDbType.NVarChar, 250).Value = overWork.ProjectName; cmd.Parameters.Add(_DiyProcess, SqlDbType.Text).Value = RequestUtility.DiyProcessToString(overWork.DiyProcess); return(SqlHelper.ExecuteNonQuery("OverWorkUpdate", cmd)); }
public List <OverWork> GetOverWorkDetailByEmployee(int accountID, DateTime date) { List <OverWork> overworkList = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_Date, SqlDbType.DateTime).Value = date; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOverWorkDetailByEmployee", cmd)) { while (sdr.Read()) { OverWork overwork = GetOverWorkByOverWorkID(Convert.ToInt32(sdr[_DbPKID])); overworkList.Add(overwork); } } return(overworkList); }
/// <summary> /// </summary> public int InsertOverWork(OverWork overWork) { int pkid; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = overWork.Account.Id; cmd.Parameters.Add(_SubmitDate, SqlDbType.DateTime).Value = overWork.SubmitDate; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = overWork.FromDate; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = overWork.ToDate; cmd.Parameters.Add(_CostTime, SqlDbType.Decimal).Value = overWork.CostTime; cmd.Parameters.Add(_Reason, SqlDbType.Text).Value = overWork.Reason; cmd.Parameters.Add(_ProjectName, SqlDbType.NVarChar, 250).Value = overWork.ProjectName; cmd.Parameters.Add(_DiyProcess, SqlDbType.Text).Value = RequestUtility.DiyProcessToString(overWork.DiyProcess); SqlHelper.ExecuteNonQueryReturnPKID("OverWorkInsert", cmd, out pkid); return(pkid); }
public OverWork OverWorkCollector(RequestStatus status) { Account account = new Account(_View.EmployeeID, "", _View.EmployeeName); List <OverWorkItem> applicationitems = _View.ApplicationItemList; foreach (OverWorkItem item in applicationitems) { item.Status = status; } OverWork outApplicatin = new OverWork(_View.ApplicationID, account, _View.SubmitDate, _View.Reason, GetFromDate(applicationitems), GetToDate(applicationitems), GetCostTime(applicationitems), applicationitems, _View.ProjectName); return(outApplicatin); }
private void Init() { OverWork OverWork = _IOverWork.GetOverWorkByOverWorkID(_View.ApplicationID); _View.EmployeeName = OverWork.Account.Name; _View.EmployeeID = OverWork.Account.Id; _View.TimeSpan = OverWork.FromDate + " ~ " + OverWork.ToDate; _View.CostTime = OverWork.CostTime.ToString(); _View.OutLocation = OverWork.ProjectName; _View.OperationType = OperationType.Confirm; _View.ApproveStatusSource = RequestUtility.GetConfirmChose(); _View.Reason = OverWork.Reason; _IOverWork.SetCanChangeAdjust(OverWork); _View.ApplicationItemList = OverWork.Item; _View.SurplusAdjustRest = "剩余调休" + _IEmployeeAttendanceFacade.GetAdjustRestRemainedDaysByEmployeeID( OverWork.Account.Id) + "小时"; }
///<summary> /// ²éѯÉêÇë ///</summary> ///<param name="employeeID"></param> ///<param name="formTime"></param> ///<param name="toTime"></param> ///<param name="status"></param> ///<returns></returns> public List <OverWork> GetOverWorkByCondition(int employeeID, DateTime formTime, DateTime toTime, RequestStatus status) { List <OverWork> overworkList = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = employeeID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = formTime; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = toTime; cmd.Parameters.Add(_Status, SqlDbType.Int).Value = status.Id; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOverWorkByCondition", cmd)) { while (sdr.Read()) { OverWork overwork = GetOverWorkByOverWorkID(Convert.ToInt32(sdr[_DbPKID])); overworkList.Add(overwork); } } return(overworkList); }
/// <summary> /// /// </summary> public static string BuildBody(OverWork overWork) { StringBuilder mailContent = new StringBuilder(); mailContent.AppendFormat("加班员工:{0}", overWork.Account.Name); mailContent.Append("<br />"); mailContent.AppendFormat("加班项目:{0}", overWork.ProjectName); mailContent.Append("<br />"); mailContent.AppendFormat("加班理由:{0}", overWork.Reason); mailContent.Append("<br />"); mailContent.AppendFormat("子项:"); mailContent.Append("<br />"); foreach (OverWorkItem item in overWork.Item) { mailContent.AppendFormat("从{0}到{1},加班类型为{2},加班{3}小时,状态为{4}", item.FromDate, item.ToDate, OverWorkUtility.GetOverWorkTypeName(item.OverWorkType), item.CostTime, RequestStatus.FindRequestStatus(item.Status.Id).Name); mailContent.Append("<br />"); } return(mailContent.ToString()); }
public List <OverWork> GetOverWorkByAccountAndRelatedDate(int accountID, DateTime from, DateTime to) { List <OverWork> overWorkList = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = from; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = to; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOverWorkForCalendar", cmd)) { while (sdr.Read()) { OverWork overwork = OverWork.FindOverWorkByPKID(overWorkList, Convert.ToInt32(sdr[_DbPKID])); if (overwork == null) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); overwork = new OverWork(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), new List <OverWorkItem>(), sdr[_DbProjectName].ToString()); overWorkList.Add(overwork); } OverWorkItem overworkItem = new OverWorkItem(Convert.ToInt32(sdr[_DbTOverWorkItemPKID]), Convert.ToDateTime(sdr[_DbTOverWorkItemFrom]), Convert.ToDateTime(sdr[_DbTOverWorkItemTo]), Convert.ToDecimal(sdr[_DbTOverWorkItemCostTime]), RequestStatus.FindRequestStatus(Convert.ToInt32(sdr[_DbTOverWorkItemStatus])), (OverWorkType)sdr[_DbTOverWorkItemOverWorkType], OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbTOverWorkItemAdjust])), Convert.ToDecimal(sdr[_DbTOverWorkItemAdjustHour])); overworkItem.OverWorkID = Convert.ToInt32(sdr[_DbTOverWorkItemOverWorkID]); overwork.Item.Add(overworkItem); } return(overWorkList); } }
/// <summary> /// </summary> public List <OverWork> GetAllOverWorkByAccountID(int accountID) { List <OverWork> overWorkList = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOverWorkByAccountID", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OverWork overwork = new OverWork(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), GetOverWorkItemByOverWorkID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbProjectName].ToString()); overWorkList.Add(overwork); } } return(overWorkList); }
/// <summary> /// </summary> public List <OverWork> GetNeedConfirmOverWork() { List <OverWork> iRet = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetNeedConfirmOverWork", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OverWork overWork = new OverWork(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), GetOverWorkItemByOverWorkID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbProjectName].ToString()); overWork.DiyProcess = RequestUtility.GetDiyProcess(sdr[_DbDiyProcess].ToString()); iRet.Add(overWork); } return(iRet); } }
/// <summary> /// /// </summary> public UpdateOverWork(OverWork overWork, List <Account> cclist) { _OverWork = overWork; _CCList = cclist; _OldOverWork = _OverWorkDal.GetOverWorkByOverWorkID(overWork.PKID); }
/// <summary> /// </summary> public void UpdateOverWork(OverWork OverWork, List <Account> ccList) { new UpdateOverWork(OverWork, ccList).Excute(); }
/// <summary> /// </summary> public OverWorkSubmitMail(int overWorkId, List <Account> cclist) { _OverWork = _OverWorkDal.GetOverWorkByOverWorkID(overWorkId); _OverWork.Account = _AccountBll.GetAccountById(_OverWork.Account.Id); _CCList = cclist; }
/// <summary> /// /// </summary> public OverWorkConfirmPhone(int overWorkId, int itemID) { _OverWork = _OverWorkDal.GetOverWorkByOverWorkID(overWorkId); _OverWorkItem = _OverWorkDal.GetOverWorkItemByItemID(itemID); _OverWork.Account = _AccountBll.GetAccountById(_OverWork.Account.Id); }
/// <summary> /// </summary> public OverWorkCancelMail(int overWorkId) { _OverWork = _OverWorkDal.GetOverWorkByOverWorkID(overWorkId); _OverWork.Account = _AccountBll.GetAccountById(_OverWork.Account.Id); }
/// <summary> /// </summary> public bool ApproveOneItem(OverWorkItem item, bool isAgree, Account account, OverWork overWork, string remark, IOverWork dalOverWork, OverWorkDiyProcessUtility overWorkDiyProcessUtility, bool isAdjust, bool isChangeAdjust, decimal adjustHour, out Account nextOperator) { if (!isAdjust) { adjustHour = 0; } nextOperator = null; item = dalOverWork.GetOverWorkItemByItemID(item.ItemID); item.AdjustHour = adjustHour; bool valide = RequestStatus.CanApproveStatus(item.Status) && account.Id == overWorkDiyProcessUtility.GetNextOperator(overWork.DiyProcess, item, overWork.Account.Id).Id; if (valide) { if (!isAgree) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, 1); dalOverWork.UpdateOverWorkItemStatusByItemID(item.ItemID, requestStatus); item.Status = requestStatus; if (isChangeAdjust) { dalOverWork.UpdateOverWorkItemAdjustByItemID(item.ItemID, isAdjust, adjustHour); item.Adjust = isAdjust; } dalOverWork.InsertOverWorkFlow(item.ItemID, new OverWorkFlow(0, account, DateTime.Now, remark, requestStatus, -1)); new UpdateAdjustRestByOverWork(item, overWork.Account.Id).Excute(); ts.Complete(); } nextOperator = null; } else { int step = overWorkDiyProcessUtility.GetNextStep(item.OverWorkFlow, overWork.DiyProcess); RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, step); OverWorkFlow OverWorkFlow = new OverWorkFlow(0, account, DateTime.Now, remark, requestStatus, step); using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { dalOverWork.InsertOverWorkFlow(item.ItemID, OverWorkFlow); dalOverWork.UpdateOverWorkItemStatusByItemID(item.ItemID, requestStatus); item.Status = requestStatus; if (isChangeAdjust) { dalOverWork.UpdateOverWorkItemAdjustByItemID(item.ItemID, isAdjust, adjustHour); item.Adjust = isAdjust; } new UpdateAdjustRestByOverWork(item, overWork.Account.Id).Excute(); ts.Complete(); } nextOperator = overWorkDiyProcessUtility.GetNextOperator(overWork.DiyProcess, step, overWork.Account.Id); } } return(valide); }
/// <summary> /// /// </summary> public OverWorkErrorMail(int applicationID) { _OverWork = _OverWorkDal.GetOverWorkByOverWorkID(applicationID); _OverWork.Account = _AccountBll.GetAccountById(_OverWork.Account.Id); _Accounts = _GetDiyProcess.GetHRPrincipalByAccountID(_OverWork.Account.Id);; }
/// <summary> /// /// </summary> public AddOverWork(OverWork overWork, List <Account> ccList) { _OverWork = overWork; _CCList = ccList; }