public void applyto() { string message; try { string record = this.Request["record"]; Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record); List <vw_employment> empParameters = JavaScriptConvert.DeserializeObject <List <vw_employment> >(ht["empparams"].ToString()); totdetail obj = JavaScriptConvert.DeserializeObject <totdetail>(ht["objparams"].ToString()); otdetailBll bll = new otdetailBll(); bll.ApplyTo(empParameters, obj); message = "{status:'success',msg:'" + HRMSRes.Public_Message_AddWell + "'}"; Response.Write(message); } catch (Exception ex) { message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}"; Response.Output.Write(message); } }
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 SaveOTDetail(totdetail obj) { try { using (TransactionScope scope = new TransactionScope()) { //如果自动转换成休假,则新增lvdfbyemp double hoursToTTLV = 0; int lvdefseq = 0; List <ColumnInfo> ottypeParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "otcd", ColumnValue = obj.otcd } }; tottype otType = GetSelectedObject <tottype>(ottypeParameters); if (otType.autr == "Y") { otttlvBll ttlvBll = new otttlvBll(); hoursToTTLV = ttlvBll.TransferToLeave(obj, otType, ref lvdefseq); } //更新detail的ttlv信息 obj.istr = hoursToTTLV == 0 ? "N" : "Y"; obj.ttlv = hoursToTTLV == 0 ? "" : obj.tottype.otcd; obj.tlhr = hoursToTTLV; obj.tlrf = lvdefseq.ToString(); obj.lmur = Function.GetCurrentUser(); obj.lmtm = DateTime.Now; baseDal.DoInsert <totdetail>(obj); scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } finally { } }
public void DeleteOTApplication(List <ColumnInfo> _parameters) { try { using (TransactionScope scope = new TransactionScope()) { totdetail dtl = GetSelectedObject <totdetail>(_parameters); if (dtl != null) { //删除lvdfbyemp //如果转换成的休假已经被申请了,则无法控制 List <ColumnInfo> lvdefempParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = dtl.emno }, new ColumnInfo() { ColumnName = "sqno", ColumnValue = dtl.tlrf.ToString(), ColumnType = "int" } }; DoDelete <tlvdfbyem>(lvdefempParameters); //删除otdetail dal.DeleteOTDtl(_parameters); } DoDelete <totaplctn>(_parameters); scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
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 void BatchTransferToLeave(List <ColumnInfo> _transferParameters, List <ColumnInfo> _personalParameters) { try { using (TransactionScope scope = new TransactionScope()) { DateTime frtm = Convert.ToDateTime(_transferParameters[0].ColumnValue); DateTime totm = Convert.ToDateTime(_transferParameters[1].ColumnValue).AddDays(1); List <totdetail> lstOTDetail = dal.GetOTDetailForTTLV(_personalParameters, frtm, totm); for (int i = 0; i < lstOTDetail.Count; i++) { totdetail dtl = lstOTDetail[i]; int lvdefseq = 0; double hoursToTTLV = TransferToLeave(dtl, dtl.tottype, ref lvdefseq); //更新detail的ttlv信息 dtl.istr = hoursToTTLV == 0 ? "N" : "Y"; dtl.ttlv = hoursToTTLV == 0 ? "" : dtl.tottype.otcd; dtl.tlhr = hoursToTTLV; dtl.tlrf = lvdefseq.ToString(); dtl.lmur = Function.GetCurrentUser(); dtl.lmtm = DateTime.Now; DoUpdate <totdetail>(dtl); } scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
private void SaveToOvertimeDetail(totaplctn _overtimeApp, double _hoursToTTLV, int _lvdefseq) { //如果OT申请审核了话,则插入otdetail totdetail dtl = new totdetail(); dtl.emno = _overtimeApp.emno; dtl.edtm = _overtimeApp.totm; dtl.lmtm = _overtimeApp.lmtm; dtl.lmur = _overtimeApp.lmur; dtl.otdt = _overtimeApp.frtm; dtl.othr = _overtimeApp.othr; dtl.othm = _overtimeApp.othm; dtl.othr = 0; dtl.otcd = _overtimeApp.otcd; dtl.rfno = _overtimeApp.apno; dtl.sttm = _overtimeApp.frtm; dtl.istr = _hoursToTTLV == 0 ? "N" : "Y"; dtl.ttlv = _hoursToTTLV == 0 ? "" : _overtimeApp.tottype.otcd; dtl.tlhr = _hoursToTTLV; dtl.tlrf = _lvdefseq.ToString(); DoInsert <totdetail>(dtl); }
public void getEdit() { string message = "{}"; try { string record = this.Request["record"]; Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record); List <ColumnInfo> parameters = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["keycolumns"].ToString()); totdetail obj = JavaScriptConvert.DeserializeObject <totdetail>(ht["params"].ToString()); otdetailBll bll = new otdetailBll(); //bll.DoUpdate<T>(obj, parameters); bll.UpdateOTDetail(obj, parameters); message = "{status:'success',msg:'" + HRMSRes.Public_Message_EditWell + "'}"; } catch (Exception ex) { message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_EditBad, ex, true) + "'}"; } Response.Write(message); }
public void UpdateOTApplication(totaplctn _overtimeApp) { try { using (TransactionScope scope = new TransactionScope()) { otaplctnBll bll = new otaplctnBll(); List <ColumnInfo> apnoParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "apno", ColumnValue = _overtimeApp.apno } }; List <ColumnInfo> dtlParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "refno", ColumnValue = _overtimeApp.apno } }; totdetail dtl = GetSelectedObject <totdetail>(dtlParameters); if (dtl != null) { //删除lvdfbyemp //如果转换成的休假已经被申请了,则无法控制 List <ColumnInfo> lvdefempParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = dtl.emno }, new ColumnInfo() { ColumnName = "sqno", ColumnValue = dtl.tlrf.ToString(), ColumnType = "int" } }; DoDelete <tlvdfbyem>(lvdefempParameters); //删除otdetail dal.DeleteOTDtl(dtlParameters); } if (_overtimeApp.otst == "Approved") { //如果自动转换成休假,则新增lvdfbyemp double hoursToTTLV = 0; int lvdefseq = 0; List <ColumnInfo> ottypeParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "otcd", ColumnValue = _overtimeApp.otcd } }; tottype otType = GetSelectedObject <tottype>(ottypeParameters); if (otType.autr == "Y") { otttlvBll ttlvBll = new otttlvBll(); hoursToTTLV = ttlvBll.TransferToLeave(_overtimeApp, otType, ref lvdefseq); } //如果审核,则更新otdetail SaveToOvertimeDetail(_overtimeApp, hoursToTTLV, lvdefseq); } DoUpdate <totaplctn>(_overtimeApp, apnoParameters); scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public void UpdateOTDetail(totdetail obj, List <ColumnInfo> _parameters) { try { using (TransactionScope scope = new TransactionScope()) { List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = obj.emno }, new ColumnInfo() { ColumnName = "otdt", ColumnValue = UtilDatetime.FormatDate1(obj.otdt), ColumnType = "datetime" }, new ColumnInfo() { ColumnName = "sttm", ColumnValue = UtilDatetime.FormatDate1(obj.sttm), ColumnType = "datetime" } }; totdetail oldobj = GetSelectedObject <totdetail>(parameters); //删除lvdfbyemp //如果转换成的休假已经被申请了,则无法控制 List <ColumnInfo> lvdefempParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = oldobj.emno }, new ColumnInfo() { ColumnName = "sqno", ColumnValue = oldobj.tlrf.ToString(), ColumnType = "int" } }; DoDelete <tlvdfbyem>(lvdefempParameters); //如果自动转换成休假,则新增lvdfbyemp double hoursToTTLV = 0; int lvdefseq = 0; List <ColumnInfo> ottypeParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "otcd", ColumnValue = oldobj.otcd } }; tottype otType = GetSelectedObject <tottype>(ottypeParameters); if (otType.autr == "Y") { otttlvBll ttlvBll = new otttlvBll(); hoursToTTLV = ttlvBll.TransferToLeave(obj, otType, ref lvdefseq); } //更新detail的ttlv信息 obj.istr = hoursToTTLV == 0 ? "N" : "Y"; obj.ttlv = hoursToTTLV == 0 ? "" : otType.otcd; obj.tlhr = hoursToTTLV; obj.tlrf = lvdefseq.ToString(); obj.lmur = Function.GetCurrentUser(); obj.lmtm = DateTime.Now; DoUpdate <totdetail>(obj, _parameters); scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } finally { } }
public void ApplyTo(List <string> _emps, totdetail obj) { try { using (TransactionScope scope = new TransactionScope()) { for (int i = 0; i < _emps.Count; i++) { if (_emps[i] != obj.emno) { List <ColumnInfo> parameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = _emps[i] }, new ColumnInfo() { ColumnName = "otdt", ColumnValue = UtilDatetime.FormatDate1(obj.otdt), ColumnType = "datetime" }, new ColumnInfo() { ColumnName = "sttm", ColumnValue = UtilDatetime.FormatDate1(obj.sttm), ColumnType = "datetime" } }; totdetail oldobj = GetSelectedObject <totdetail>(parameters); if (oldobj == null) { //新增 totdetail newobj = new totdetail(); newobj.emno = _emps[i]; newobj.edtm = obj.edtm; newobj.lmtm = obj.lmtm; newobj.lmur = obj.lmur; newobj.otdt = obj.otdt; newobj.othr = obj.othr; newobj.othm = obj.othm; newobj.oths = obj.oths; newobj.otcd = obj.otcd; newobj.sttm = obj.sttm; DoInsert <totdetail>(newobj); } else { //更新 oldobj.edtm = obj.edtm; oldobj.lmtm = obj.lmtm; oldobj.lmur = obj.lmur; oldobj.othr = obj.othr; oldobj.othm = obj.othm; oldobj.oths = obj.oths; oldobj.otcd = obj.otcd; DoUpdate <totdetail>(oldobj); } } } scope.Complete(); } } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }