Beispiel #1
0
        public void applyto()
        {
            string message;

            try
            {
                string record = this.Request["record"];

                Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record);

                List <string> empParameters = JavaScriptConvert.DeserializeObject <List <string> >(ht["empparams"].ToString());
                tlvdfbyem     obj           = JavaScriptConvert.DeserializeObject <tlvdfbyem>(ht["objparams"].ToString());

                lvdfbyempBll bll = new lvdfbyempBll();

                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);
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public void ApplyTo(List <string> _emps, tlvdfbyem 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 = "sqno", ColumnValue = obj.sqno.ToString(), ColumnType = "int"
                                }
                            };

                            tlvdfbyem oldobj = GetSelectedObject <tlvdfbyem>(parameters);

                            if (oldobj == null)
                            {
                                //新增
                                tlvdfbyem newobj = new tlvdfbyem();
                                newobj.emno = _emps[i];
                                newobj.days = obj.days;
                                newobj.exdt = obj.exdt;
                                newobj.lmtm = obj.lmtm;
                                newobj.lmur = obj.lmur;
                                newobj.ltcd = obj.ltcd;
                                newobj.remk = obj.remk;

                                int?maxsqno = GetMaxsqno("tlvdfbyem", _emps[i]);
                                newobj.sqno = maxsqno.HasValue ? maxsqno.Value : 1;

                                DoInsert <tlvdfbyem>(newobj);
                            }
                            else
                            {
                                //更新
                                oldobj.days = obj.days;
                                oldobj.exdt = obj.exdt;
                                oldobj.lmtm = obj.lmtm;
                                oldobj.lmur = obj.lmur;
                                oldobj.ltcd = obj.ltcd;
                                oldobj.remk = obj.remk;

                                DoUpdate <tlvdfbyem>(oldobj);
                            }
                        }
                    }

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }