Example #1
0
        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());

                tprpubrst        obj     = JavaScriptConvert.DeserializeObject <tprpubrst>(ht["params"].ToString());
                List <tprprsdtl> listDtl = JavaScriptConvert.DeserializeObject <List <tprprsdtl> >(ht["dtlparams"].ToString());

                prpubrstBll bll = new prpubrstBll();

                bll.UpdatePubRuleSet(obj, listDtl);
                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);
        }
Example #2
0
        public void InsertPubRuleSet(tprpubrst obj, List <tprprsdtl> list)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    //insert
                    DoInsert <tprpubrst>(obj);

                    for (int i = 0; i < list.Count; i++)
                    {
                        string rlcd = UtilDatetime.FormatTime4(DateTime.Now);
                        if (list[i].vtyp == "Sum")
                        {
                            list[i].rlcd = rlcd;
                        }
                        DoInsert <tprprsdtl>(list[i]);

                        if (list[i].vtyp == "Sum")
                        {
                            string[] arr = list[i].valu.Split(',');
                            for (int j = 0; j < arr.Length; j++)
                            {
                                tprrstsit sit = new tprrstsit();
                                sit.itcd = arr[j].Substring(1, arr[j].Length - 2);
                                sit.lmtm = list[i].lmtm;
                                sit.lmur = list[i].lmur;
                                sit.rlcd = rlcd;

                                DoInsert <tprrstsit>(sit);
                            }
                        }
                    }
                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
Example #3
0
        public void UpdatePubRuleSet(tprpubrst obj, List <tprprsdtl> list)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    //delete first
                    List <ColumnInfo> parameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "rscd", ColumnValue = obj.rscd
                        }
                    };

                    List <tprprsdtl> lstDtl = GetSelectedRecords <tprprsdtl>(parameters);
                    for (int i = 0; i < lstDtl.Count; i++)
                    {
                        if (lstDtl[i].vtyp == "Sum")
                        {
                            //delete rel item
                            List <ColumnInfo> relparams = new List <ColumnInfo>()
                            {
                                new ColumnInfo()
                                {
                                    ColumnName = "rlcd", ColumnValue = lstDtl[i].rlcd
                                }
                            };
                            DoMultiDelete <tprrstsit>(relparams);
                        }

                        DoDelete <tprprsdtl>(lstDtl[i]);
                    }

                    //update
                    dal.DoUpdate <tprpubrst>(obj);

                    for (int i = 0; i < list.Count; i++)
                    {
                        string rlcd = UtilDatetime.FormatTime4(DateTime.Now);
                        if (list[i].vtyp == "Sum")
                        {
                            list[i].rlcd = rlcd;
                        }

                        dal.DoInsert <tprprsdtl>(list[i]);

                        if (list[i].vtyp == "Sum")
                        {
                            string[] arr = list[i].valu.Split(',');
                            for (int j = 0; j < arr.Length; j++)
                            {
                                tprrstsit sit = new tprrstsit();
                                sit.itcd = arr[j].Substring(1, arr[j].Length - 2);
                                sit.lmtm = list[i].lmtm;
                                sit.lmur = list[i].lmur;
                                sit.rlcd = rlcd;

                                DoInsert <tprrstsit>(sit);
                            }
                        }
                    }
                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }