Ejemplo n.º 1
0
        internal HssUtility.SQLserver.DB_update Get_DBupdate()
        {
            if (!this.CheckValueChanges())
            {
                return(null);
            }

            HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(EDI_country.Get_cmdTP());
            if (this.name.ValueChanged)
            {
                upd.AddValue("name", this.name);
            }
            if (this.currency_id.ValueChanged)
            {
                upd.AddValue("currency_id", this.currency_id);
            }
            if (this.iso2_cd.ValueChanged)
            {
                upd.AddValue("iso2_cd", this.iso2_cd);
            }
            if (this.iso3_cd.ValueChanged)
            {
                upd.AddValue("iso3_cd", this.iso3_cd);
            }

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

            return(upd);
        }
Ejemplo n.º 2
0
        public static void Init_from_DB()
        {
            if ((DateTime.Now - EDIcountryMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval)
            {
                return;
            }

            EDIcountryMaster.Reset();
            DB_select selt = new DB_select(EDI_country.Get_cmdTP());

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

            while (reader.Read())
            {
                EDI_country cty = new EDI_country();
                cty.Init_from_reader(reader);

                EDIcountryMaster.name_dic[cty.name.Value]    = cty;
                EDIcountryMaster.iso2_dic[cty.iso2_cd.Value] = cty;
                EDIcountryMaster.iso3_dic[cty.iso3_cd.Value] = cty;
            }
            reader.Close();

            EDIcountryMaster.lastUpdateTime = DateTime.Now;
        }
Ejemplo n.º 3
0
        public static StatutoryRate_edi GetRate_from_country(string countryName, DateTime curr_dt)
        {
            EDI_country cty = EDIcountryMaster.Get_EDI_country(countryName);

            if (cty == null)
            {
                return(null);
            }
            else
            {
                return(RateMaster_edi.GetRate_from_coi(cty.cntry_cd, curr_dt));
            }
        }
Ejemplo n.º 4
0
        public static EDI_times GetRate_from_country(string countryName, DateTime curr_dt)
        {
            EDI_country cty = EDIcountryMaster.Get_EDI_country(countryName);

            if (cty == null)
            {
                return(null);
            }
            else
            {
                return(EDItime_master.GetTimes_from_ccd(cty.cntry_cd, curr_dt));
            }
        }
Ejemplo n.º 5
0
        public EDI_country GetCopy()
        {
            EDI_country newEntity = new EDI_country();

            if (!this.name.IsNull_flag)
            {
                newEntity.name.Value = this.name.Value;
            }
            if (!this.currency_id.IsNull_flag)
            {
                newEntity.currency_id.Value = this.currency_id.Value;
            }
            if (!this.iso2_cd.IsNull_flag)
            {
                newEntity.iso2_cd.Value = this.iso2_cd.Value;
            }
            if (!this.iso3_cd.IsNull_flag)
            {
                newEntity.iso3_cd.Value = this.iso3_cd.Value;
            }
            return(newEntity);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialize object from DB
        /// </summary>
        public bool Init_from_DB()
        {
            if (string.IsNullOrEmpty(this.cntry_cd))
            {
                return(false);
            }

            HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(EDI_country.Get_cmdTP());
            db_sel.tableName = "edi_cntrytable";
            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("cntry_cd", HssUtility.General.RelationalOperator.Equals, this.cntry_cd);
            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);
        }
Ejemplo n.º 7
0
        internal HssUtility.SQLserver.DB_insert Get_DBinsert()
        {
            HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(EDI_country.Get_cmdTP());

            dbIns.AddValue("name", this.name);               /*Optional 2*/
            dbIns.AddValue("currency_id", this.currency_id); /*Optional 3*/
            dbIns.AddValue("iso2_cd", this.iso2_cd);         /*Optional 4*/
            dbIns.AddValue("iso3_cd", this.iso3_cd);         /*Optional 5*/

            return(dbIns);
        }