Ejemplo n.º 1
0
        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());
                tlvlealmt            obj           = JavaScriptConvert.DeserializeObject <tlvlealmt>(ht["objparams"].ToString());

                lvlealmtBll bll = new lvlealmtBll();

                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);
            }
        }
Ejemplo n.º 2
0
        public void ApplyTo(List <vw_employment> _emps, tlvlealmt obj)
        {
            try
            {
                int maxlmno = GetMaxNo("tlvlealmt", "lmno").Value;
                for (int i = 0; i < _emps.Count; i++)
                {
                    if (_emps[i].emno != obj.lmva)
                    {
                        List <ColumnInfo> parameters = new List <ColumnInfo>()
                        {
                            new ColumnInfo()
                            {
                                ColumnName = "lmby", ColumnValue = _emps[i].emno
                            },
                            new ColumnInfo()
                            {
                                ColumnName = "lmva", ColumnValue = obj.lmva
                            },
                            new ColumnInfo()
                            {
                                ColumnName = "lmsc", ColumnValue = obj.lmsp
                            },
                            new ColumnInfo()
                            {
                                ColumnName = "ltcd", ColumnValue = obj.ltcd
                            }
                        };

                        tlvlealmt oldobj = GetSelectedObject <tlvlealmt>(parameters);

                        if (oldobj == null)
                        {
                            //新增
                            maxlmno++;

                            tlvlealmt newobj = new tlvlealmt();
                            newobj.lmtm = obj.lmtm;
                            newobj.lmur = obj.lmur;
                            newobj.lmby = _emps[i].emno;
                            newobj.lmno = maxlmno;
                            newobj.lmsp = obj.lmsp;
                            newobj.lmtx = _emps[i].sfid + " - " + _emps[i].ntnm;
                            newobj.lmva = obj.lmva;
                            newobj.mxlh = obj.mxlh;
                            newobj.mxch = obj.mxch;
                            newobj.ltcd = obj.ltcd;

                            DoInsert <tlvlealmt>(newobj);
                        }
                        else
                        {
                            //更新
                            oldobj.lmtm = obj.lmtm;
                            oldobj.lmur = obj.lmur;
                            oldobj.mxlh = obj.mxlh;
                            oldobj.mxch = obj.mxch;
                            DoUpdate <tlvlealmt>(oldobj);
                        }
                    }
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }