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; }
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)); } }
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)); } }
public static EDI_country Get_EDI_country(string name) { EDIcountryMaster.Init_from_DB(); if (string.IsNullOrEmpty(name)) { return(null); } if (EDIcountryMaster.name_dic.ContainsKey(name)) { return(EDIcountryMaster.name_dic[name]); } if (EDIcountryMaster.iso2_dic.ContainsKey(name)) { return(EDIcountryMaster.iso2_dic[name]); } if (EDIcountryMaster.iso3_dic.ContainsKey(name)) { return(EDIcountryMaster.iso3_dic[name]); } return(null); }