Beispiel #1
0
        public static void Init_from_DB()
        {
            if ((DateTime.Now - RateMaster_edi.lastUpdateTime).TotalHours < Utility.RefreshInterval)
            {
                return;
            }

            RateMaster_edi.Reset();
            DB_select selt = new DB_select(StatutoryRate_edi.Get_cmdTP());

            DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB());

            while (reader.Read())
            {
                StatutoryRate_edi rt = new StatutoryRate_edi();
                rt.Init_from_reader(reader);

                string key = rt.coi.Value;
                if (key == null)
                {
                    key = "";
                }

                if (!RateMaster_edi.coi_dic.ContainsKey(key))
                {
                    List <StatutoryRate_edi> list = new List <StatutoryRate_edi>();
                    RateMaster_edi.coi_dic[key] = list;
                }
                RateMaster_edi.coi_dic[key].Add(rt);
            }
            reader.Close();

            RateMaster_edi.lastUpdateTime = DateTime.Now;
        }
Beispiel #2
0
        internal HssUtility.SQLserver.DB_update Get_DBupdate()
        {
            if (!this.CheckValueChanges())
            {
                return(null);
            }

            HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(StatutoryRate_edi.Get_cmdTP());
            if (this.coi.ValueChanged)
            {
                upd.AddValue("coi", this.coi);
            }
            if (this.cor.ValueChanged)
            {
                upd.AddValue("cor", this.cor);
            }
            if (this.statry_rt.ValueChanged)
            {
                upd.AddValue("statry_rt", this.statry_rt);
            }
            if (this.int_rt.ValueChanged)
            {
                upd.AddValue("int_rt", this.int_rt);
            }
            if (this.effect_dt.ValueChanged)
            {
                upd.AddValue("effect_dt", this.effect_dt);
            }
            if (this.created_dt.ValueChanged)
            {
                upd.AddValue("created_dt", this.created_dt);
            }
            if (this.modified_dt.ValueChanged)
            {
                upd.AddValue("modified_dt", this.modified_dt);
            }
            if (this.migratedId.ValueChanged)
            {
                upd.AddValue("migratedId", this.migratedId);
            }
            if (this.sec_type.ValueChanged)
            {
                upd.AddValue("sec_type", this.sec_type);
            }
            if (this.bo_typ.ValueChanged)
            {
                upd.AddValue("bo_typ", this.bo_typ);
            }

            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("id", HssUtility.General.RelationalOperator.Equals, this.pk_ID);
            upd.SetCondition(rela);

            return(upd);
        }
Beispiel #3
0
        /// <summary>
        /// Initialize object from DB
        /// </summary>
        public bool Init_from_DB()
        {
            if (this.id < 0)
            {
                return(false);
            }

            HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(StatutoryRate_edi.Get_cmdTP());
            db_sel.tableName = "edi_strtapprv";
            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("id", HssUtility.General.RelationalOperator.Equals, this.id);
            db_sel.SetCondition(rela);

            bool res_flag = false;

            HssUtility.SQLserver.DB_reader reader = new HssUtility.SQLserver.DB_reader(db_sel, Utility.Get_DRWIN_hDB());
            if (reader.Read())
            {
                this.Init_from_reader(reader);
                res_flag = true;
            }
            reader.Close();
            return(res_flag);
        }
Beispiel #4
0
        internal HssUtility.SQLserver.DB_insert Get_DBinsert()
        {
            HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(StatutoryRate_edi.Get_cmdTP());

            dbIns.AddValue("coi", this.coi);                 /*Optional 2*/
            dbIns.AddValue("cor", this.cor);                 /*Optional 3*/
            dbIns.AddValue("statry_rt", this.statry_rt);     /*Optional 4*/
            dbIns.AddValue("int_rt", this.int_rt);           /*Optional 5*/
            dbIns.AddValue("effect_dt", this.effect_dt);     /*Optional 6*/
            dbIns.AddValue("created_dt", this.created_dt);   /*Optional 7*/
            dbIns.AddValue("modified_dt", this.modified_dt); /*Optional 8*/
            dbIns.AddValue("migratedId", this.migratedId);   /*Optional 9*/
            dbIns.AddValue("sec_type", this.sec_type);       /*Optional 10*/
            dbIns.AddValue("bo_typ", this.bo_typ);           /*Optional 11*/

            return(dbIns);
        }