public static List <Task_Detail> GetTaskDetail_list(int taskID, string sourceID, string taskName) { List <Task_Detail> list = new List <Task_Detail>(); DB_select db_sel = new DB_select(Task_Detail.Get_cmdTP()); SQL_relation rela0 = new SQL_relation("TaskID", RelationalOperator.Equals, taskID); SQL_relation rela1 = new SQL_relation("sourceID", RelationalOperator.Equals, sourceID); SQL_condition cond = new SQL_condition(rela0, ConditionalOperator.And, rela1); if (taskName != null) { SQL_relation rela2 = new SQL_relation("TaskName", RelationalOperator.Equals, taskName); cond = new SQL_condition(cond, ConditionalOperator.And, rela2); } db_sel.SetCondition(cond); DB_reader reader = new DB_reader(db_sel, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Task_Detail dp = new Task_Detail(); dp.Init_from_reader(reader); list.Add(dp); } reader.Close(); return(list); }
public static void Init_from_DB() { if ((DateTime.Now - ProcedureTypeMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } ProcedureTypeMaster.Reset(); DB_select selt = new DB_select(Country_ProcedureTypes.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Country_ProcedureTypes cpt = new Country_ProcedureTypes(); cpt.Init_from_reader(reader); if (!ProcedureTypeMaster.CPT_dic.ContainsKey(cpt.Country)) { List <Country_ProcedureTypes> list = new List <Country_ProcedureTypes>(); ProcedureTypeMaster.CPT_dic[cpt.Country] = list; } ProcedureTypeMaster.CPT_dic[cpt.Country].Add(cpt); } reader.Close(); ProcedureTypeMaster.lastUpdateTime = DateTime.Now; }
private HashSet <int> Create_dvdIndex_hs() { this.statusInfo.status = "Create dvdIndex_hs from DTC_Position"; HashSet <int> dvdIndex_hs = new HashSet <int>(); DB_select selt = new DB_select(BD_DTC_Position.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { BD_DTC_Position bdp = new BD_DTC_Position(); bdp.Init_from_reader(reader); dvdIndex_hs.Add(bdp.DividendIndex); DTC_Participants dp = DTC_Participants_master.Get_DTC_Participants_DTCnum(bdp.DTC_Number); bdp.dtcParti = dp; this.dtcPos_list.Add(bdp); ++this.statusInfo.recordNum; } reader.Close(); return(dvdIndex_hs); }
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; }
public static void Init_from_DB() { if ((DateTime.Now - DTC_model_master.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } DTC_model_master.Reset(); DB_select selt = new DB_select(DTCPositionModelNumber_Mapping.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { DTCPositionModelNumber_Mapping dm = new DTCPositionModelNumber_Mapping(); dm.Init_from_reader(reader); DTC_model_master.mapping_dic[dm.ModelNumber.Value] = dm; if (!DTC_model_master.country_dic.ContainsKey(dm.Country.Value)) { List <DTCPositionModelNumber_Mapping> list = new List <DTCPositionModelNumber_Mapping>(); DTC_model_master.country_dic[dm.Country.Value] = list; } DTC_model_master.country_dic[dm.Country.Value].Add(dm); } reader.Close(); DTC_model_master.lastUpdateTime = DateTime.Now; }
public static void Init_from_DB() { if (CountryMaster.otherShort.Count < 1) { CountryMaster.otherShort["Russia"] = "RU"; //more may needed in the future } if ((DateTime.Now - CountryMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } CountryMaster.Reset(); DB_select selt = new DB_select(Country.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Country cty = new Country(); cty.Init_from_reader(reader); CountryMaster.name_dic[cty.name] = cty; CountryMaster.short_dic[cty.cntry_cd.Value] = cty; } reader.Close(); CountryMaster.lastUpdateTime = DateTime.Now; }
/// <summary> /// Get Custodian dictionary, [Custodian_Number] as key /// </summary> public Dictionary <int, Custodian> Get_custodian_dic() { HashSet <int> num_hs = new HashSet <int>(); foreach (DividendCustodian dc in this.Get_dvdCust_dic(null).Values) { num_hs.Add(dc.Custodian_Number.Value); } Dictionary <int, Custodian> dic = new Dictionary <int, Custodian>(); DB_select selt = new DB_select(Custodian.Get_cmdTP()); SQL_relation rela = new SQL_relation("Custodian_Number", true, num_hs); selt.SetCondition(rela); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Custodian cust = new Custodian(); cust.Init_from_reader(reader); dic[cust.Custodian_Number] = cust; } reader.Close(); return(dic); }
public static List <DividendXBRL> GetList_refNo(string refNo) { List <DividendXBRL> dxList = new List <DividendXBRL>(); if (string.IsNullOrEmpty(refNo)) { return(dxList); } DB_select selt = new DB_select(DividendXBRL.Get_cmdTP()); SQL_relation rela = new SQL_relation("XBRL_ReferenceNumber", RelationalOperator.Equals, refNo); selt.SetCondition(rela); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { DividendXBRL dx = new DividendXBRL(); dx.Init_from_reader(reader); dxList.Add(dx); } reader.Close(); return(dxList); }
public static void Init_from_DB() { if ((DateTime.Now - Task21_secMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } Task21_secMaster.Reset(); DB_select selt = new DB_select(Task21_security.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Task21_security cty = new Task21_security(); cty.Init_from_reader(reader); Task21_secMaster.ID_dic[cty.ID] = cty; if (!Task21_secMaster.secID_dic.ContainsKey(cty.SecurityID.Value)) { List <Task21_security> list = new List <Task21_security>(); Task21_secMaster.secID_dic[cty.SecurityID.Value] = list; } Task21_secMaster.secID_dic[cty.SecurityID.Value].Add(cty); } reader.Close(); Task21_secMaster.lastUpdateTime = DateTime.Now; }
/// <summary> /// Get DividendCustodian dictionary, [CustodianID] as key /// </summary> public Dictionary <int, DividendCustodian> Get_dvdCust_dic(string custodianType) { Dictionary <int, DividendCustodian> dic = new Dictionary <int, DividendCustodian>(); DB_select selt = new DB_select(DividendCustodian.Get_cmdTP()); SQL_relation rela0 = new SQL_relation("DividendIndex", RelationalOperator.Equals, this.DividendIndex); if (string.IsNullOrEmpty(custodianType)) { selt.SetCondition(rela0); } else { SQL_relation rela1 = new SQL_relation("Custodian_Type", RelationalOperator.Equals, custodianType); SQL_condition cond = new SQL_condition(rela0, ConditionalOperator.And, rela1); selt.SetCondition(cond); } DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { DividendCustodian dc = new DividendCustodian(); dc.Init_from_reader(reader); dic[dc.CustodianID] = dc; } reader.Close(); return(dic); }
public static void Init_from_DB() { if ((DateTime.Now - EDItime_master.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } EDItime_master.Reset(); DB_select selt = new DB_select(EDI_times.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { EDI_times et = new EDI_times(); et.Init_from_reader(reader); if (!EDItime_master.ccd_dic.ContainsKey(et.cntry_cd.Value)) { List <EDI_times> et_list = new List <EDI_times>(); EDItime_master.ccd_dic[et.cntry_cd.Value] = et_list; } EDItime_master.ccd_dic[et.cntry_cd.Value].Add(et); } reader.Close(); EDItime_master.lastUpdateTime = DateTime.Now; }
private Dictionary <int, BD_Dividend> CreateDvdDic(HashSet <int> dvdIndex_hs) { this.statusInfo.status = "Create Dividend Dictionary"; Dictionary <int, BD_Dividend> dic = new Dictionary <int, BD_Dividend>(); if (dvdIndex_hs == null) { return(dic); } DB_select selt = new DB_select(BD_Dividend.Get_cmdTP()); SQL_relation rela = new SQL_relation("DividendIndex", true, dvdIndex_hs); selt.SetCondition(rela); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { BD_Dividend dvd = new BD_Dividend(); dvd.Init_from_reader(reader); dic[dvd.DividendIndex] = dvd; ++this.statusInfo.recordNum; } reader.Close(); return(dic); }
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 void Init_from_DB() { if ((DateTime.Now - DTCpositionHeader_master.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } DTCpositionHeader_master.Reset(); DB_select selt = new DB_select(DTC_Position_Headers.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { DTC_Position_Headers dph = new DTC_Position_Headers(); dph.Init_from_reader(reader); if (!DTCpositionHeader_master.modelNum_dic.ContainsKey(dph.ModelNumber.Value)) { List <DTC_Position_Headers> list = new List <DTC_Position_Headers>(); DTCpositionHeader_master.modelNum_dic[dph.ModelNumber.Value] = list; } DTCpositionHeader_master.modelNum_dic[dph.ModelNumber.Value].Add(dph); } reader.Close(); DTCpositionHeader_master.lastUpdateTime = DateTime.Now; }
public List <Dividend_Detail_simpleAP> Get_dvdDetailAP_list(string reclaimFeeType) { List <Dividend_Detail_simpleAP> list = new List <Dividend_Detail_simpleAP>(); DB_select selt = new DB_select(Dividend_Detail_simpleAP.Get_cmdTP()); SQL_relation rela0 = new SQL_relation("DividendIndex", RelationalOperator.Equals, this.DividendIndex); if (string.IsNullOrEmpty(reclaimFeeType)) { selt.SetCondition(rela0); } else { SQL_relation rela1 = new SQL_relation("ReclaimFeesType", RelationalOperator.Equals, reclaimFeeType); SQL_condition cond = new SQL_condition(rela0, ConditionalOperator.And, rela1); selt.SetCondition(cond); } DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Dividend_Detail_simpleAP dd = new Dividend_Detail_simpleAP(); dd.Init_from_reader(reader); list.Add(dd); } reader.Close(); return(list); }
public static List <Schedule_Of_Fees_DSC> GetList_from_CD(string country, string depositary) { List <Schedule_Of_Fees_DSC> list = new List <Schedule_Of_Fees_DSC>(); if (string.IsNullOrEmpty(country) || string.IsNullOrEmpty(depositary)) { return(list); } DB_select selt = new DB_select(Schedule_Of_Fees_DSC.Get_cmdTP()); SQL_relation rela1 = new SQL_relation("Country", RelationalOperator.Equals, country); SQL_relation rela2 = new SQL_relation("Depositary", RelationalOperator.Equals, depositary); SQL_condition cond = new SQL_condition(new SQL_condition(rela1), ConditionalOperator.And, new SQL_condition(rela2)); selt.SetCondition(cond); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Schedule_Of_Fees_DSC sof = new Schedule_Of_Fees_DSC(); sof.Init_from_reader(reader); list.Add(sof); } reader.Close(); list.Sort((a, b) => DateTime.Compare(b.EffectiveDate.Value, a.EffectiveDate.Value)); return(list); }
private static void Init_owner_dic() { DB_select selt = new DB_select(ADR_TaskOwner.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { ADR_TaskOwner ato = new ADR_TaskOwner(); ato.Init_from_reader(reader); string ownerSID = ato.OwnerSID.Value; TaskMemberMaster.owner_dic[ownerSID] = ato; if (!TaskMemberMaster.groupMember_dic.ContainsKey(ownerSID)) { continue; } int groupID = TaskMemberMaster.groupMember_dic[ownerSID].GroupID.Value; if (!TaskMemberMaster.ownerList_dic.ContainsKey(groupID)) { Dictionary <string, ADR_TaskOwner> dic = new Dictionary <string, ADR_TaskOwner>(StringComparer.OrdinalIgnoreCase); TaskMemberMaster.ownerList_dic[groupID] = dic; } TaskMemberMaster.ownerList_dic[groupID][ato.OwnerSID.Value] = ato; } reader.Close(); }
public static List <Dividend> Get_DividendList_CUSIP(string CUSIP, DividendTable_option table = DividendTable_option.Dividend_Control_Approved) { List <Dividend> dvdList = new List <Dividend>(); if (string.IsNullOrEmpty(CUSIP)) { return(dvdList); } DB_select selt = new DB_select(Dividend.Get_cmdTP()); selt.tableName = table.ToString(); SQL_relation rela = new SQL_relation("CUSIP", RelationalOperator.Equals, CUSIP); selt.SetCondition(rela); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Dividend dvd = new Dividend(); dvd.Init_from_reader(reader); dvdList.Add(dvd); } reader.Close(); return(dvdList); }
public static List <SPR_file> Get_SRP_fileList(HssStatus status, bool all_flag = false) { List <SPR_file> list = new List <SPR_file>(); DB_select selt = new DB_select(SPR_file.Get_cmdTP()); selt.IgnoreColumn("FileBinary"); if (!all_flag) { SQL_relation rela = new SQL_relation("Status", RelationalOperator.Equals, (int)status); selt.SetCondition(rela); } DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { SPR_file sf = new SPR_file(); sf.Init_from_reader(reader); list.Add(sf); } reader.Close(); return(list); }
public static Hss_DailyJobs GetJob_class_id(string jobClass, int jobID) { if (string.IsNullOrEmpty(jobClass)) { return(null); } DB_select selt = new DB_select(Hss_DailyJobs.Get_cmdTP()); SQL_relation rela0 = new SQL_relation("Job_Class", RelationalOperator.Equals, jobClass); SQL_relation rela1 = new SQL_relation("Job_ID", RelationalOperator.Equals, jobID); selt.SetCondition(new SQL_condition(rela0, ConditionalOperator.And, rela1)); Hss_DailyJobs hdj = null; DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); if (reader.Read()) { hdj = new Hss_DailyJobs(); hdj.Init_from_reader(reader); } reader.Close(); return(hdj); }
private HashSet <int> Get_currFX_ID_set(string taskName) { HashSet <int> hs = new HashSet <int>(); CmdTemplate tp = new CmdTemplate(); tp.schema = "Task"; tp.tableName = "Task_Detail"; tp.AddColumn("SourceID"); DB_select selt = new DB_select(tp); SQL_relation rel0 = new SQL_relation("TaskID", RelationalOperator.Equals, Task20_master.TaskID_20); SQL_relation rel1 = new SQL_relation("TaskName", RelationalOperator.Equals, taskName); SQL_condition cond0 = new SQL_condition(rel0), cond1 = new SQL_condition(rel1); SQL_condition cond = new SQL_condition(cond0, ConditionalOperator.And, cond1); selt.SetCondition(cond); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { int tempInt = -1; string tempStr = reader.GetString("SourceID"); if (int.TryParse(tempStr, out tempInt)) { hs.Add(tempInt); } } reader.Close(); return(hs); }
public void SetTable(string tableName, string schema, hssDB hDB) { if (hDB == null || !hDB.Connected) { MessageBox.Show("AutoCreatClass error 0: No DB connection"); return; } this.col_list.Clear(); this.tableName = tableName; if (string.IsNullOrEmpty(this.className)) { this.className = tableName; } this.schema = schema; DB_select selt = new DB_select(ColumnSchema.Get_cmdTP()); SQL_relation rela1 = new SQL_relation("TABLE_NAME", RelationalOperator.Equals, tableName); SQL_relation rela2 = new SQL_relation("TABLE_SCHEMA", RelationalOperator.Equals, schema); SQL_condition cond = new SQL_condition(new SQL_condition(rela1), ConditionalOperator.And, new SQL_condition(rela2)); selt.SetCondition(cond); DB_reader reader = new DB_reader(selt, hDB); while (reader.Read()) { ColumnSchema cs = new ColumnSchema(); cs.Init_from_reader(reader); this.col_list.Add(cs); } reader.Close(); this.col_list.Sort((a, b) => (a.ORDINAL_POSITION - b.ORDINAL_POSITION)); }
public static Dictionary <int, DateTime> Get_DateTime_values(List <int> detailID_list, string colName) { Dictionary <int, DateTime> dic = new Dictionary <int, DateTime>(); if (detailID_list == null || detailID_list.Count < 1) { return(dic); } if (string.IsNullOrEmpty(colName)) { return(dic); } List <List <int> > splited_list = new List <List <int> >();//split detailID_list into small lists List <int> tempList = new List <int>(); foreach (int ID in detailID_list) { tempList.Add(ID); if (tempList.Count >= 100) { splited_list.Add(tempList); tempList = new List <int>(); } } if (tempList.Count > 0) { splited_list.Add(tempList); } CmdTemplate cmdTp = new CmdTemplate();//create template for DB cmdTp.tableName = DividendDetail_master.Detail_tableName; cmdTp.AddColumn(DividendDetail_master.Detail_PK_colName); cmdTp.AddColumn(colName); DB_select selt = new DB_select(cmdTp); foreach (List <int> list in splited_list) { SQL_relation rela = new SQL_relation(DividendDetail_master.Detail_PK_colName, true, list); selt.SetCondition(rela); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { int detailID = reader.GetInt(DividendDetail_master.Detail_PK_colName); DateTime dt = reader.GetDateTime(colName); dic[detailID] = dt; } reader.Close(); } return(dic); }
private static void Init_groupMember_dic() { DB_select selt = new DB_select(ADR_Group_Member.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { ADR_Group_Member agm = new ADR_Group_Member(); agm.Init_from_reader(reader); TaskMemberMaster.groupMember_dic[agm.OwnerSID.Value] = agm; } reader.Close(); }
/*---------------------------------------------------------------------------------------------------------*/ private static void Init_group_dic() { DB_select selt = new DB_select(ADR_Group.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { ADR_Group ag = new ADR_Group(); ag.Init_from_reader(reader); TaskMemberMaster.group_dic[ag.GroupID] = ag; } reader.Close(); }
public static void Init_from_DB() { if ((DateTime.Now - DepositaryMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } DepositaryMaster.Reset(); DB_select selt = new DB_select(Depositary.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Depositary depo = new Depositary(); depo.Init_from_reader(reader); DepositaryMaster.depoID_dic[depo.DepositaryID.Value] = depo; DepositaryMaster.shortName_dic[depo.DepositaryShortName.Value] = depo; if (DepositaryMaster.depoName_dic.ContainsKey(depo.DepositaryName.Value)) //handle "unsponsered" { Depositary existing_depo = DepositaryMaster.depoName_dic[depo.DepositaryName.Value]; if (depo.DepositaryIndex.Value < 0) { continue; } if (existing_depo.DepositaryIndex.Value < 0) { DepositaryMaster.depoName_dic[depo.DepositaryName.Value] = depo; } else if (depo.DepositaryIndex.Value < existing_depo.DepositaryIndex.Value) { DepositaryMaster.depoName_dic[depo.DepositaryName.Value] = depo; } else { continue; } } else { DepositaryMaster.depoName_dic[depo.DepositaryName.Value] = depo; } } reader.Close(); DepositaryMaster.lastUpdateTime = DateTime.Now; }
public static List <SavedFiles_CSV> Get_RSH_fileList() { List <SavedFiles_CSV> list = new List <SavedFiles_CSV>(); DB_reader reader = SavedFiles_master.Get_DB_reader(); while (reader.Read()) { SavedFiles_CSV sf = new SavedFiles_CSV(); sf.Init_from_reader(reader); list.Add(sf); } reader.Close(); return(list); }
/***********************************************Static Methods******************************************************************/ public static List <XBRL_SavedFile> Get_XBRL_fileList(HssStatus status) { List <XBRL_SavedFile> list = new List <XBRL_SavedFile>(); DB_reader reader = XBRL_SavedFile_master.Get_DB_reader(status, null); while (reader.Read()) { XBRL_SavedFile sf = new XBRL_SavedFile(); sf.Init_from_reader(reader); list.Add(sf); } reader.Close(); return(list); }
public static List <Hss_DailyJobs> GetAllJobs() { List <Hss_DailyJobs> list = new List <Hss_DailyJobs>(); DB_select selt = new DB_select(Hss_DailyJobs.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Hss_DailyJobs hdj = new Hss_DailyJobs(); hdj.Init_from_reader(reader); list.Add(hdj); } reader.Close(); return(list); }
public static void Init_from_DB() { if ((DateTime.Now - SecurityMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } CountryMaster.Reset(); DB_select selt = new DB_select(Security.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Security sec = new Security(); sec.Init_from_reader(reader); if (sec.CUSIP.IsValueEmpty) { continue; } string cusip = sec.CUSIP.Value; List <Security> list = null; if (SecurityMaster.secList_dic.ContainsKey(cusip)) { list = SecurityMaster.secList_dic[cusip]; } else { list = new List <Security>(); SecurityMaster.secList_dic[cusip] = list; } list.Add(sec); } reader.Close(); foreach (List <Security> list in SecurityMaster.secList_dic.Values) { list.Sort((a, b) => DateTime.Compare(b.EffectiveDate.Value, a.EffectiveDate.Value)); } SecurityMaster.lastUpdateTime = DateTime.Now; }