public Exception_ErrorMessage ClosePeriod(tstperiod _periodMdl) { try { _periodMdl.csby = Function.GetCurrentUser(); _periodMdl.cstm = DateTime.Now; _periodMdl.psts = HRMS_Period_Status.Closed.ToString(); _periodMdl.remk = " [Closed by " + _periodMdl.csby + " at " + UtilDatetime.FormateDateTime1(_periodMdl.cstm) + "]"; List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "perd", ColumnValue = _periodMdl.perd } }; DoUpdate <tstperiod>(_periodMdl, parameters); return(Exception_ErrorMessage.NoError); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } finally { } }
public string getNewAppNo() { try { //得到最大请假单号 string maxNo = dal.getMaxAppNo(); string nextNo = string.Empty; if (maxNo.Equals(string.Empty)) { nextNo = UtilDatetime.FormatDate3(DateTime.Now) + ("1").PadLeft(3, '0'); } else { nextNo = Convert.ToString(Convert.ToDouble(maxNo) + 1); } return(nextNo); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public string getMaxAppNo() { try { string t = UtilDatetime.FormatDate3(DateTime.Now); var q = (from p in gDB.totaplctns where p.apno.Contains(t) select p.apno).Max(); if (q == null) { return(string.Empty); } return(q.ToString()); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public override List <T> GetSelectedRecords <T>(List <ColumnInfo> _parameter, bool paging, int start, int num, ref int totalRecordCount) { try { string sSql1 = BuildWhereSql("otcd,from|apdt,to|apdt,from|lmtm,to|lmtm,lmur", _parameter); string sSql2 = BuildWhereSql("sfid,stfn,emno", _parameter); var q = from p in gDB.totaplctns.Where(sSql1) join t in gDB.vw_employments.Where(sSql2) on p.emno equals t.emno join s in gDB.tottypes on p.otcd equals s.otcd select new { p.emno, t.sfid, stfn = t.ntnm, p.lmtm, p.lmur, p.remk, p.apdt, p.frtm, p.apno, p.othr, p.othm, p.otst, p.otcd, p.totm, frtm_date = UtilDatetime.FormatDate1(p.frtm), frtm_time = UtilDatetime.FormatTime1(p.frtm), totm_date = UtilDatetime.FormatDate1(p.totm), totm_time = UtilDatetime.FormatTime1(p.totm) }; List <T> obj = q.Cast <T>().ToList(); totalRecordCount = obj.Count; List <T> appList = null; if (paging) { appList = obj.Skip(start).Take(num).ToList(); } else { appList = obj; } return(appList); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public void ApplyTo(List <vw_employment> _emps, tatpricld obj) { try { for (int i = 0; i < _emps.Count; i++) { if (_emps[i].emno != obj.emno) { List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = _emps[i].emno }, new ColumnInfo() { ColumnName = "cddt", ColumnValue = UtilDatetime.FormatDate1(obj.cddt), ColumnType = "datetime" } }; tatpricld oldobj = GetSelectedObject <tatpricld>(parameters); if (oldobj == null) { //新增 tatpricld newobj = new tatpricld(); newobj.emno = _emps[i].emno; newobj.cddt = obj.cddt; newobj.htcd = obj.htcd; newobj.otcd = obj.otcd; newobj.lmtm = obj.lmtm; newobj.lmur = obj.lmur; DoInsert <tatpricld>(newobj); } else { //更新 oldobj.htcd = obj.htcd; oldobj.otcd = obj.otcd; oldobj.lmtm = obj.lmtm; oldobj.lmur = obj.lmur; DoUpdate <tatpricld>(oldobj); } } } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public void UpdateLeaveApplication(tlvleaapp _leaveApp) { try { //分析请假并保存 lvanalevBll bll = new lvanalevBll(); List <ColumnInfo> dateParameters = new List <ColumnInfo>(); dateParameters.Add(new ColumnInfo() { ColumnName = "lvstart", ColumnValue = UtilDatetime.FormateDateTime1(_leaveApp.frtm) }); dateParameters.Add(new ColumnInfo() { ColumnName = "lvend", ColumnValue = UtilDatetime.FormateDateTime1(_leaveApp.totm), ColumnType = "datetime" }); List <ColumnInfo> personParameters = new List <ColumnInfo>(); personParameters.Add(new ColumnInfo() { ColumnName = "emp.emno", ColumnValue = _leaveApp.emno }); using (TransactionScope scope = new TransactionScope()) { //先删除leave detail List <ColumnInfo> apnoParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "apno", ColumnValue = _leaveApp.apno } }; dal.DeleteLeaveAppDtl(apnoParameters); //如果审核过,则分析休假,并生成leave detail if (_leaveApp.lvst == "Approved") { bll.AnalyzeLeave(dateParameters, personParameters, _leaveApp, true); } DoUpdate <tlvleaapp>(_leaveApp, apnoParameters); scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public List <tlvleaapd> GetLeaveDetailForPayroll(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = "select a.* from tlvleaapd a,vw_employment emp where a.emno = emp.emno " + (_sStaffSql.Trim() == string.Empty ? "" : " and " + _sStaffSql) + " and a.frtm >='" + UtilDatetime.FormateDateTime1(_startDate) + "' " + " and a.frtm <'" + UtilDatetime.FormateDateTime1(_endDate) + "' "; IEnumerable <tlvleaapd> ret = gDB.ExecuteQuery <tlvleaapd>(sSql); return(ret.ToList()); }
public List <tpraddrst> GetAdditionalRuleSetDtlForPayroll(string _sStaffSql, DateTime _startDate, DateTime _endDate, string _payDay) { string sSql = "select a.* from tpraddrst a,vw_employment emp where a.emno = emp.emno " + (_sStaffSql.Trim() == string.Empty ? "" : " and " + _sStaffSql) + " and a.perd ='" + UtilDatetime.FormateDateTime1(_endDate.AddDays(-1)) + "' " + (_payDay.Equals(string.Empty) ? string.Empty : " and pdcd ='" + _payDay + "'"); IEnumerable <tpraddrst> ret = gDB.ExecuteQuery <tpraddrst>(sSql); return(ret.ToList()); }
public List <tprpbrhi> GetStaffPubRuleSetHis(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = "select a.* from tprpbrhis a,vw_employment emp where a.emno = emp.emno " + (_sStaffSql.Trim() == string.Empty ? "" : " and " + _sStaffSql) + " and a.efdt <='" + UtilDatetime.FormateDateTime1(_startDate) + "' " + " and (a.exdt is null or a.exdt >'" + UtilDatetime.FormateDateTime1(_endDate) + "') "; IEnumerable <tprpbrhi> ret = gDB.ExecuteQuery <tprpbrhi>(sSql); return(ret.ToList()); }
public int DeleteDummyData(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = @"delete from tatanarst from tatanarst b inner join vw_employment emp on b.emno=emp.emno and " + _sStaffSql + @" where (b.iscf is null or b.iscf='N') and b.atdt >='" + UtilDatetime.FormatDate1(_startDate) + @"' and b.atdt<'" + UtilDatetime.FormatDate1(_endDate) + "'"; object[] parameters = { }; return(gDB.ExecuteCommand(sSql, parameters)); }
public List <tprprirst> GetPrivateRuleSetDtlForPayroll(string _sStaffSql, DateTime _startDate, DateTime _endDate, string _payDay) { string sSql = "select a.* from tprprirst a,vw_employment emp where a.emno = emp.emno " + (_sStaffSql.Trim() == string.Empty ? "" : " and " + _sStaffSql) + " and a.efdt <='" + UtilDatetime.FormateDateTime1(_startDate) + "' " + " and (a.exdt is null or a.exdt >'" + UtilDatetime.FormateDateTime1(_endDate) + "') " + (_payDay.Equals(string.Empty) ? string.Empty : " and pdcd ='" + _payDay + "'"); IEnumerable <tprprirst> ret = gDB.ExecuteQuery <tprprirst>(sSql); return(ret.ToList()); }
public void SaveOTDetail(string _emno, string _ottype, DateTime _otdt, DateTime _sttm, DateTime _endtime, double _othr, double _othrr, double _othm) { List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = _emno }, new ColumnInfo() { ColumnName = "otdt", ColumnValue = UtilDatetime.FormatDate1(_otdt), ColumnType = "datetime" }, new ColumnInfo() { ColumnName = "sttm", ColumnValue = UtilDatetime.FormateDateTime1(_sttm), ColumnType = "datetime" }, }; List <totdetail> list = new BaseDal().GetSelectedRecords <totdetail>(parameters); if (list.Count <= 0) { totdetail otdetail = new totdetail(); otdetail.emno = _emno; otdetail.edtm = _endtime; otdetail.otdt = _otdt; otdetail.oths = _othr; otdetail.othm = _othm; otdetail.othr = _othrr; otdetail.otcd = _ottype; otdetail.sttm = _sttm; otdetail.lmtm = DateTime.Now; otdetail.lmur = Function.GetCurrentUser(); gDB.totdetails.InsertOnSubmit(otdetail); } else { totdetail otdetail = list.First(); otdetail.edtm = _endtime; otdetail.otcd = _ottype; otdetail.othr = _othr; otdetail.othr = _othrr; otdetail.lmtm = DateTime.Now; otdetail.lmur = Function.GetCurrentUser(); } gDB.SubmitChanges(); }
//public void delete() //{ // string msg = string.Empty; // try // { // PeriodBll periodBll = new PeriodBll(); // string year = Request.Form["Year"]; // string period = Request.Form["Period"]; // Exception_ErrorMessage error = periodBll.DeletePeriod(year, period); // if (error == Exception_ErrorMessage.NoError) // { // msg = "{status:'success',msg:'" + HRMSRes.Public_Message_DeleteWell + "'}"; // } // } // catch (Exception ex) // { // msg = "{status:'failure',msg:'" + HRMSRes.Public_Message_DeleteBad + "'}"; // } // Response.Output.Write(msg); //} public void list() { string message = string.Empty; try { string record = this.Request["record"]; string startStr = this.Request["start"]; string limitStr = this.Request["limit"]; if ((record == null) || (record.Length < 1)) { record = "{\"year\":\"" + UtilDatetime.FormatDate3(DateTime.Now).Substring(0, 4) + "\"}"; } Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record); int start = 0; if (startStr != null) { start = Convert.ToInt32(startStr); } int limit = 0; if (limitStr != null) { limit = Convert.ToInt32(limitStr); } stperiodBll bll = new stperiodBll(); List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "year", ColumnValue = ht["year"].ToString() } }; int total = 0; List <tstperiod> periodList = bll.GetSelectedRecords <tstperiod>(parameters, true, start, start + limit, ref total); string json = JavaScriptConvert.SerializeObject(periodList); json = "{results:" + total + ",rows:" + json + "}"; Response.Write(json); } catch (Exception ex) { message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}"; Response.Output.Write(message); } }
public List <tatdatmnu> GetManualData(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = @"select a.* from tatdatmnu a inner join vw_employment emp on a.emno = emp.emno where (" + _sStaffSql + @") and atdt>='" + UtilDatetime.FormatDate1(_startDate) + @"' and atdt <'" + UtilDatetime.FormatDate1(_endDate) + "'"; List <tatdatmnu> obj = gDB.ExecuteQuery <tatdatmnu>(sSql).ToList(); return(obj); }
public void InitLog() { string pathName = AppDomain.CurrentDomain.BaseDirectory + @"\Log\"; string fileName = "CumulationCalc" + "_" + UtilDatetime.FormatDateTime5(DateTime.Now) + ".trc"; //file header List <string> header = new List <string>(); header.Add("Cumulation allocation log at " + UtilDatetime.FormatDateTime5(DateTime.Now) + " by " + Function.GetCurrentUser()); header.Add("LOG"); log.LogHeader(fileName, header); log = new UtilLog(fileName, Log_LoggingLevel.Admin); }
public List <tatoridat> GetOriginalData(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = @"select a.* from tatoridat a inner join vw_employment emp on a.sfid = emp.sfid where (" + _sStaffSql + @") and retm>='" + UtilDatetime.FormatDate1(_startDate) + @"' and retm <'" + UtilDatetime.FormatDate1(_endDate) + "'"; List <tatoridat> obj = gDB.ExecuteQuery <tatoridat>(sSql).ToList(); return(obj); }
public int DeleteDummyData(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = @"delete from totdetail from totdetail a where (isnull(a.othm,0) <= 0) and exists (select b.atdt,b.emno,b.iscf from tatanarst b inner join vw_employment emp on b.emno=emp.emno and " + _sStaffSql + @" where b.emno=a.emno and b.atdt=a.otdt and (b.iscf is null or b.iscf='N') and b.atdt >='" + UtilDatetime.FormatDate1(_startDate) + @"' and b.atdt<'" + UtilDatetime.FormatDate1(_endDate) + "')"; object[] parameters = { }; return(gDB.ExecuteCommand(sSql, parameters)); }
public List <totdetail> GetOTDetailForPayroll(string _sStaffSql, DateTime _startDate, DateTime _endDate) { //var q = from p in gDB.totdetails // join t in _lstStaff on p.emno equals t.emno // where p.otdt >= _startDate // && p.otdt < _endDate // select p; string sSql = "select a.* from totdetail a,vw_employment emp where a.emno = emp.emno " + (_sStaffSql.Trim() == string.Empty ? "" : " and " + _sStaffSql) + " and a.otdt >='" + UtilDatetime.FormateDateTime1(_startDate) + "' " + " and a.otdt <'" + UtilDatetime.FormateDateTime1(_endDate) + "' "; IEnumerable <totdetail> ret = gDB.ExecuteQuery <totdetail>(sSql); return(ret.ToList()); }
private string BuildAlarmBodyForLeaveApplication(tlvleaapp _leaveApp, vw_employment emp) { string bdtx = string.Empty; bdtx += "<LeaveApplication>"; //<LeaveApplication> bdtx += "<No>" + _leaveApp.apno + "</No>"; //No bdtx += "<Employee>" + emp.sfid + " - " + emp.ntnm + "</Employee>"; //Employee bdtx += "<Leave Type>" + _leaveApp.tlvleatyp.ltnm + "</Leave Type>"; //Leave Type bdtx += "<Leave Reason>" + _leaveApp.tlvlearsn.lrnm + "</Leave Reason>"; //Leave Reason bdtx += "<From Time>" + UtilDatetime.FormateDateTime1(_leaveApp.frtm) + "</From Time>"; //From Time bdtx += "<To Time>" + UtilDatetime.FormateDateTime1(_leaveApp.totm) + "</To Time>"; //To Time bdtx += "<Summary>" + "D:" + _leaveApp.days.ToString() + " / H:" + _leaveApp.hurs.ToString() + "</TSummary>"; //Summary bdtx += "<Remark>" + _leaveApp.remk + "</Remark>"; //Remark bdtx += "<br></LeaveApplication>"; //</LeaveApplication> return(bdtx); }
public void InsertPubRuleSet(tprpubrst obj, List <tprprsdtl> list) { try { using (TransactionScope scope = new TransactionScope()) { //insert DoInsert <tprpubrst>(obj); for (int i = 0; i < list.Count; i++) { string rlcd = UtilDatetime.FormatTime4(DateTime.Now); if (list[i].vtyp == "Sum") { list[i].rlcd = rlcd; } DoInsert <tprprsdtl>(list[i]); if (list[i].vtyp == "Sum") { string[] arr = list[i].valu.Split(','); for (int j = 0; j < arr.Length; j++) { tprrstsit sit = new tprrstsit(); sit.itcd = arr[j].Substring(1, arr[j].Length - 2); sit.lmtm = list[i].lmtm; sit.lmur = list[i].lmur; sit.rlcd = rlcd; DoInsert <tprrstsit>(sit); } } } scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public List <tatroshi> GetRosterHistory(string _sStaffSql, DateTime _startDate, DateTime _endDate) { string sSql = @"select a.* from tatroshis a inner join tatroster c on a.rscd=c.rscd inner join vw_employment emp on a.emno = emp.emno where (isnull(a.exdt,'3000-01-01') > '" + UtilDatetime.FormatDate1(_startDate) + @"' and isnull(a.efdt,'3000-01-01') <='" + UtilDatetime.FormatDate1(_endDate) + @"') and (isnull(a.exdt,'3000-01-01') > '" + UtilDatetime.FormatDate1(_startDate) + @"' and isnull(a.efdt,'3000-01-01') <='" + UtilDatetime.FormatDate1(_endDate) + @"') and a.iaod='Y' and (" + _sStaffSql + @") order by a.efdt"; List <tatroshi> obj = gDB.ExecuteQuery <tatroshi>(sSql).ToList(); return(obj); }
public Exception_ErrorMessage OpenPeriod(tstperiod _periodMdl) { try { //check before open List <tstperiod> lstPeriod = GetPeriodByStatus(HRMS_Period_Status.Open.ToString()); if (lstPeriod.Count > 0) { throw new UtilException(lstPeriod[0].perd, Exception_ErrorMessage.OpenPeriodFoundOpenDenied, null); } _periodMdl.csby = Function.GetCurrentUser(); _periodMdl.cstm = DateTime.Now; _periodMdl.psts = HRMS_Period_Status.Open.ToString(); _periodMdl.remk = " [Open by " + _periodMdl.csby + " at " + UtilDatetime.FormateDateTime1(_periodMdl.cstm) + "]"; List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "perd", ColumnValue = _periodMdl.perd } }; DoUpdate <tstperiod>(_periodMdl, parameters); return(Exception_ErrorMessage.NoError); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } finally { } }
public void exportExcel() { string message = string.Empty; try { string record = this.Request["record"]; string header = this.Request["header"]; if ((record == null) || (record.Length < 1)) { record = "{\"year\":\"" + UtilDatetime.FormatDate3(DateTime.Now).Substring(0, 4) + "\"}"; } if (header == null || header.Equals(string.Empty)) { return; } Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record); List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(header); stperiodBll bll = new stperiodBll(); List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "year", ColumnValue = ht["year"].ToString() } }; List <tstperiod> yearList = bll.GetSelectedRecords <tstperiod>(parameters); if (yearList != null) { UtilExcel.ExportToExcel(Response, this.GetType().Name.GetPageName(), headers, yearList); } } catch (Exception ex) { message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_ExportExcelFail, ex, true) + "'}"; Response.Output.Write(message); } }
public double TransferToLeave(totdetail _otdetail, tottype _ottype, ref int lvdefseq) { otanaovtBll bll = new otanaovtBll(); LvSettingInfo settingInfo = bll.GetEmpOTSettings(_otdetail.emno, _otdetail.otcd, _otdetail.sttm); double hoursToTTLV = 0; double hoursForTTLV = (((_otdetail.othm == 0)) ? _otdetail.othr : _otdetail.othm).Value; if (settingInfo.MinBalance >= hoursForTTLV) { hoursToTTLV = hoursForTTLV; } else { hoursToTTLV = settingInfo.MinBalance; } if (hoursToTTLV > 0) { tlvdfbyem lvemp = new tlvdfbyem(); //problem here,转换成天数后怎么统计 lvemp.days = hoursToTTLV; lvemp.emno = _otdetail.emno; lvemp.exdt = _otdetail.sttm.AddYears(1); //default 1 year later lvemp.lmtm = DateTime.Now; lvemp.lmur = Constant.SYSTEM_USER_ID; lvemp.ltcd = _ottype.ttlv; lvemp.remk = "Transfer from overtime[" + "frtm:" + UtilDatetime.FormateDateTime1(_otdetail.sttm) + ",totm:" + UtilDatetime.FormateDateTime1(_otdetail.edtm) + "]"; int?maxsqno = GetMaxsqno("tlvdfbyem", _otdetail.emno); maxsqno = maxsqno.HasValue == false ? 0 : maxsqno.Value; lvemp.sqno = maxsqno.Value + 1; DoInsert <tlvdfbyem>(lvemp); lvdefseq = lvemp.sqno; } return(hoursToTTLV); }
public double TransferToLeave(totaplctn _overtimeApp, tottype _ottype, ref int lvdefseq) { //自动转换成休假,会检查limit otanaovtBll bll = new otanaovtBll(); LvSettingInfo settingInfo = bll.GetEmpOTSettings(_overtimeApp.emno, _overtimeApp.otcd, _overtimeApp.frtm); double hoursToTTLV = 0; double hoursForTTLV = (((_overtimeApp.othm == 0) || (_overtimeApp.othm.HasValue == false)) ? _overtimeApp.othr : _overtimeApp.othm).Value; if (settingInfo.MinBalance >= hoursForTTLV) { hoursToTTLV = hoursForTTLV; } else { hoursToTTLV = settingInfo.MinBalance; } if (hoursToTTLV > 0) { tlvdfbyem lvemp = new tlvdfbyem(); //problem here,转换成天数后怎么统计 lvemp.days = settingInfo.MinBalance; lvemp.emno = _overtimeApp.emno; lvemp.exdt = _overtimeApp.frtm.AddYears(1); //default 1 year later lvemp.lmtm = DateTime.Now; lvemp.lmur = Constant.SYSTEM_USER_ID; lvemp.ltcd = _ottype.ttlv; lvemp.remk = "Transfer from overtime[appno:" + _overtimeApp.apno + ",frtm:" + UtilDatetime.FormateDateTime1(_overtimeApp.frtm) + ",totm:" + UtilDatetime.FormateDateTime1(_overtimeApp.totm) + "]"; lvemp.sqno = GetMaxsqno("tlvdfbyem", _overtimeApp.emno).Value; DoInsert <tlvdfbyem>(lvemp); lvdefseq = lvemp.sqno; } return(hoursToTTLV); }
public List <tatanarst> GetAnalResult(List <ColumnInfo> _parameter, string _sSqlStaff, DateTime _startDate, DateTime _endDate) { try { string sSql = @"select a.* from tatanarst a,vw_employment emp where a.emno = emp.emno and " + _sSqlStaff + @" and a.atdt>='" + UtilDatetime.FormatDate1(_startDate) + @"' and a.atdt<'" + UtilDatetime.FormatDate1(_endDate) + @"'"; List <tatanarst> obj = gDB.ExecuteQuery <tatanarst>(sSql).ToList(); return(obj); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public string CalcLeaveTime(tlvleaapp leaveApp) { try { //只分析请假 lvanalevBll bll = new lvanalevBll(); List <ColumnInfo> dateParameters = new List <ColumnInfo>(); dateParameters.Add(new ColumnInfo() { ColumnName = "lvstart", ColumnValue = UtilDatetime.FormateDateTime1(leaveApp.frtm) }); dateParameters.Add(new ColumnInfo() { ColumnName = "lvend", ColumnValue = UtilDatetime.FormateDateTime1(leaveApp.totm), ColumnType = "datetime" }); List <ColumnInfo> personParameters = new List <ColumnInfo>(); personParameters.Add(new ColumnInfo() { ColumnName = "emp.emno", ColumnValue = leaveApp.emno }); bll.AnalyzeLeave(dateParameters, personParameters, null, false); return("totallvhours:'" + bll.TotalLvHours.ToString() + "',totallvdays:'" + bll.TotalLvDays.ToString() + "'"); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public string CalcOTTime(totaplctn _otApp) { try { //只分析请假 otanaovtBll bll = new otanaovtBll(); List <ColumnInfo> dateParameters = new List <ColumnInfo>(); dateParameters.Add(new ColumnInfo() { ColumnName = "otstart", ColumnValue = UtilDatetime.FormateDateTime1(_otApp.frtm), ColumnType = "datetime" }); dateParameters.Add(new ColumnInfo() { ColumnName = "otend", ColumnValue = UtilDatetime.FormateDateTime1(_otApp.totm), ColumnType = "datetime" }); List <ColumnInfo> personParameters = new List <ColumnInfo>(); personParameters.Add(new ColumnInfo() { ColumnName = "emp.emno", ColumnValue = _otApp.emno }); bll.AnalyzeOvertime(dateParameters, personParameters, null, false); return("totalothr:'" + bll.TotalOTHours.ToString() + "',otcd:'" + bll.otcd + "'"); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public void DoAnalyze(tlvleaapp _leaveApp, bool _isSaveDetail) { for (int i = 0; i < lstStaff.Count; i++) { TotalLvHours = 0; TotalLvDays = 0; try { DateTime calcStart = AnalStartDate; DateTime calcEnd = AnalEndDate; DateTime tmpStart = calcStart; DateTime tmpEnd; //如果请假跨天,需要拆分成多条数据 for (float k = 0; k < (calcEnd - calcStart).TotalDays; k++) { if ((calcEnd - tmpStart).TotalDays > 1) { tmpEnd = Convert.ToDateTime(UtilDatetime.FormatDate1(tmpStart.AddDays(1)) + " 00:00:00"); } else { tmpEnd = calcEnd; } //取轮班历史 List <tatroshi> lstEmpRosterHistory = lstRosterHistory.Where(p => p.emno == lstStaff[i].emno && ((p.exdt.HasValue == false) || (p.exdt.Value > tmpEnd)) && (p.efdt <= tmpStart) ).ToList(); //确定轮班和班次 if (lstEmpRosterHistory.Count > 0) { //如果发现多条,则只取第一条 tatroshi curRosterHistory = lstEmpRosterHistory[0]; List <tatrosdtl> lstEmpRosterDtl = lstRosterDetails.Where(p => p.rscd == curRosterHistory.rscd).ToList(); //确定轮班明细和班次 tatrosdtl curRosterDtl = getCurrentRoster(curRosterHistory, lstEmpRosterDtl, tmpStart); tatshift curShift = curRosterDtl.tatshift; //分析此天的休假 AnalyzeOneDay(lstStaff[i], curRosterDtl, curShift, curRosterHistory, tmpStart, tmpEnd, _leaveApp, _isSaveDetail); tmpStart = tmpEnd; } else { //如果没有定义轮班该如何计算???? } } } catch (Exception ex) { throw ex; } } }
public void UpdateCalendar(tatcaldar obj, List <tatclddtl> list, List <string> deleteddobj) { try { using (TransactionScope scope = new TransactionScope()) { //delete first for (int i = 0; i < deleteddobj.Count; i++) { List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "clcd", ColumnValue = obj.clcd }, new ColumnInfo() { ColumnName = "cddt", ColumnValue = deleteddobj[i], ColumnType = "datetime" } }; DoMultiDelete <tatclddtl>(parameters); //List<tatclddtl> oldList = GetSelectedRecords<tatclddtl>(parameters); //for (int j = 0; j < oldList.Count; j++) //{ // dal.DoDelete<tatclddtl>(oldList[j]); //} } for (int i = 0; i < list.Count; i++) { List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "clcd", ColumnValue = obj.clcd }, new ColumnInfo() { ColumnName = "cddt", ColumnValue = UtilDatetime.FormatDate1(list[i].cddt), ColumnType = "datetime" } }; DoMultiDelete <tatclddtl>(parameters); } List <ColumnInfo> cldParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "clcd", ColumnValue = obj.clcd } }; //update DoUpdate <tatcaldar>(obj, cldParameters); for (int i = 0; i < list.Count; i++) { dal.DoInsert <tatclddtl>(list[i]); } scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }