示例#1
0
        public void getEdit()
        {
            string message = "{}";

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

                tpsemplym obj = JavaScriptConvert.DeserializeObject <tpsemplym>(record);

                new psemplymBll().UpdateEmployment(obj, new List <ColumnInfo> {
                    new ColumnInfo()
                    {
                        ColumnName = "emno", ColumnValue = obj.emno
                    }
                }, action);
                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);
        }
示例#2
0
        public void InsertEmployment(tpsemplym _emp)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                DoInsert <tpsemplym>(_emp);

                //保存历史,New Join
                CopyEmpToHistory(_emp, "sys$0");

                scope.Complete();
            }
        }
示例#3
0
        public void UpdateEmployment(tpsemplym _emp, List <ColumnInfo> _parameter, string _action)
        {
            string changeType = _action;

            using (TransactionScope scope = new TransactionScope())
            {
                DoUpdate <tpsemplym>(_emp, _parameter);

                //保存历史,New Join
                if ((changeType != "unknown") && (changeType != string.Empty))
                {
                    CopyEmpToHistory(_emp, changeType);
                }

                scope.Complete();
            }
        }
示例#4
0
        public void getNew()
        {
            string message = "{}";

            try
            {
                string    record = this.Request["record"];
                tpsemplym obj    = JavaScriptConvert.DeserializeObject <tpsemplym>(record);

                psemplymBll bll = new psemplymBll();
                bll.InsertEmployment(obj);

                message = "{status:'success',msg:'" + HRMSRes.Public_Message_AddWell + "'}";
            }
            catch (Exception ex)
            {
                message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_AddBad, ex, true) + "'}";
            }
            Response.Write(message);
        }
示例#5
0
        public void CopyEmpToHistory(tpsemplym _emp, string _changeType)
        {
            tpsemphi his = new tpsemphi();

            foreach (PropertyInfo prop in typeof(tpsemphi).GetProperties())
            {
                if ((prop.PropertyType.IsValueType) || (prop.PropertyType.FullName == "System.String"))
                {
                    PropertyInfo empProps = typeof(tpsemplym).GetProperty(prop.Name);
                    if (empProps != null)
                    {
                        object value = empProps.GetValue(_emp, null);

                        prop.SetValue(his, value, null);
                    }
                }
            }

            int?t     = GetMaxsqno("tpsemphis", his.emno);
            int seqno = 0;

            if (t.HasValue)
            {
                seqno = t.Value;
            }
            else
            {
                seqno = 0;
            }

            his.sqno = seqno + 1;
            his.ctcd = _changeType;
            his.isdt = DateTime.Now;
            his.isby = Function.GetCurrentUser();

            DoInsert <tpsemphi>(his);
        }
示例#6
0
        public void InsertEmpChange(List <tpsempchg> _list)
        {
            try
            {
                if (_list.Count <= 0)
                {
                    return;
                }

                int?t     = GetMaxsqno("tpsempchg", _list[0].emno);
                int seqno = 0;
                if (t.HasValue)
                {
                    seqno = t.Value;
                }
                else
                {
                    seqno = 0;
                }

                string gpid = UtilDatetime.FormatDateTime4(DateTime.Now);

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "emno", ColumnValue = _list[0].emno
                    }
                };
                tpsemplym emp = GetSelectedObject <tpsemplym>(parameters);
                bool      isUpdateEmployment = false;
                string    changeType         = _list[0].ctcd;

                using (TransactionScope scope = new TransactionScope())
                {
                    for (int i = 0; i < _list.Count; i++)
                    {
                        tpsempchg obj = _list[i];

                        obj.sqno = seqno + i + 1;
                        obj.lmtm = DateTime.Now;
                        obj.lmur = Function.GetCurrentUser();
                        obj.gpid = gpid;
                        //get old value
                        PropertyInfo props = emp.GetType().GetProperty(obj.chfi);
                        if (props != null)
                        {
                            object v = props.GetValue(emp, null);
                            obj.olva = v == null ? null : v.ToString();
                        }


                        //判断是否立即生效
                        if ((obj.isim == "Y") || (obj.efdt <= DateTime.Now))
                        {
                            props.SetValue(emp, obj.neva, null);

                            obj.isby           = Function.GetCurrentUser();
                            obj.isdt           = DateTime.Now;
                            obj.issu           = "Y";
                            isUpdateEmployment = true;
                        }

                        DoInsert <tpsempchg>(obj);
                    }

                    if (isUpdateEmployment)
                    {
                        DoUpdate <tpsemplym>(emp);
                        //更新雇佣历史
                        psemplymBll empBll = new psemplymBll();
                        empBll.CopyEmpToHistory(emp, changeType);
                    }

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
示例#7
0
        public void UpdateEmpChange(tpsempchg _obj)
        {
            try
            {
                if (_obj == null)
                {
                    return;
                }

                List <ColumnInfo> dtlParameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "emno", ColumnValue = _obj.emno
                    },
                    new ColumnInfo()
                    {
                        ColumnName = "sqno", ColumnValue = _obj.sqno.ToString(), ColumnType = "int"
                    }
                };
                List <ColumnInfo> empParameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "emno", ColumnValue = _obj.emno
                    }
                };
                tpsemplym emp = GetSelectedObject <tpsemplym>(empParameters);
                bool      isUpdateEmployment = false;
                string    changeType         = _obj.ctcd;

                using (TransactionScope scope = new TransactionScope())
                {
                    //get old value
                    PropertyInfo props = emp.GetType().GetProperty(_obj.chfi);
                    if (props != null)
                    {
                        object v = props.GetValue(emp, null);
                        _obj.olva = v == null ? null : v.ToString();
                    }


                    //判断是否立即生效
                    if ((_obj.isim == "Y") || (_obj.efdt <= DateTime.Now))
                    {
                        props.SetValue(emp, _obj.neva, null);

                        _obj.isby          = Function.GetCurrentUser();
                        _obj.isdt          = DateTime.Now;
                        _obj.issu          = "Y";
                        isUpdateEmployment = true;
                    }

                    DoUpdate <tpsempchg>(_obj, dtlParameters);

                    if (isUpdateEmployment)
                    {
                        DoUpdate <tpsemplym>(emp, empParameters);
                        //更新雇佣历史
                        psemplymBll empBll = new psemplymBll();
                        empBll.CopyEmpToHistory(emp, changeType);
                    }

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