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 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 <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 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 <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 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 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 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 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); } }
private string columnsJson(List <ColumnMdl> columns) { StringBuilder json = new StringBuilder(); for (int i = 0; i < columns.Count; i++) { ColumnMdl mdl = columns[i]; string isRequired = mdl.IsRequired.Equals(string.Empty) ? "False" : mdl.IsRequired.Equals(Public_Flag.Y.ToString()).ToString(); string isPrimaryKey = mdl.IsPrimaryKey.Equals(string.Empty) ? "False" : mdl.IsPrimaryKey.Equals(Public_Flag.Y.ToString()).ToString(); string resourceId = mdl.ResourceId.Equals(string.Empty) ? mdl.ColumnName : "HRMSRes." + mdl.ResourceId; string display = mdl.IsDisplay.Equals(string.Empty) ? "False" : mdl.IsDisplay.Equals(Public_Flag.Y.ToString()).ToString(); string defaultValue = mdl.DefaultValue; string defaultValueFormula = mdl.DefaultValue; if (!defaultValue.Equals(string.Empty)) { if (defaultValue.Equals(Public_DefaultValue.sysuser.ToString())) { defaultValue = "ContextInfo.currentUser"; } else if (defaultValue.Equals(Public_DefaultValue.sysdate.ToString())) { defaultValue = "\"" + UtilDatetime.FormateDateTime1(DateTime.Now) + "\""; } else { defaultValue = "\"" + defaultValue + "\""; } } else { defaultValue = "\"" + defaultValue + "\""; } json.Append("{"); json.Append("header:typeof ").Append(resourceId).Append(" ==\"undefined\"").Append("?\"").Append(mdl.ColumnName).Append("\":").Append(resourceId).Append(",") .Append("sortable:true").Append(",") .Append("isPk:\"").Append(mdl.IsPrimaryKey.Equals(Public_Flag.Y.ToString())).Append("\",") .Append("required:\"").Append(isRequired).Append("\",") .Append("type:\"").Append(mdl.DataType).Append("\",") .Append("size:").Append(mdl.DataSize).Append(",") .Append("precision:\"").Append(mdl.DataPrecision).Append("\",") .Append("defaultValue:").Append(defaultValue).Append(",") .Append("defaultValueFormula:\"").Append(defaultValueFormula).Append("\",") .Append("isDisplay:\"").Append(display).Append("\",") .Append("align:").Append(GetPostionByType(mdl.DataType)).Append(",") .Append("dataIndex:\"").Append(mdl.ColumnName).Append("\"").Append(","); if (mdl.DataType == "datetime") { switch (mdl.DefaultValue.ToUpper()) { case "SYSDATE": case "DATE TIME": case "": default: json.Append("renderer:formatDate").Append(","); break; case "DATE ONLY": json.Append("renderer:formatDateNoTime").Append(","); break; } //if (mdl.DefaultValue == "sysdate") // json.Append("renderer:formatDate").Append(","); //else //{ // if (mdl.DefaultValue.ToUpper() == "DATE ONLY") // { // json.Append("renderer:formatDateNoTime").Append(","); // } // else // { // if (mdl.DefaultValue == null || mdl.DefaultValue.Trim() == string.Empty) // json.Append("renderer:formatDate").Append(","); // else // json.Append("renderer:formatDateNoTime").Append(","); // } //} } json.Append("controlType:\"").Append(mdl.ControlType).Append("\"").Append(""); json.Append("}"); if (i < columns.Count - 1) { json.Append(","); } } if (json.Length > 0) { json.Insert(0, "["); json.Append("]"); } else { json.Append("[]"); } return(json.ToString()); }