private void GetRecords()
        {
            //List<DseFileInfo> xeRecord = new List<DseFileInfo>();
            dseDic = new Dictionary <string, DseFileInfo>();

            string currentDate = string.Empty;

            string[] fileStartArr = { "0184", "0673", "3073", "EM01" };


            foreach (string fileStart in fileStartArr)
            {
                currentDate = GetCurrrentFileDate(fileStart);

                string fileName = string.Format("{0}{1}.M", fileStart, currentDate);

                string mfilePath = Path.Combine(mFileFolder, fileName);

                if (!File.Exists(mfilePath))
                {
                    continue;
                }

                using (StreamReader sr = new StreamReader(mfilePath))
                {
                    string tmp = null;
                    while ((tmp = sr.ReadLine()) != null)
                    {
                        if (!tmp.StartsWith("XE"))
                        {
                            continue;
                        }
                        string ric = tmp.Substring(0, tmp.IndexOf(' ')).Replace("XE", "");
                        if (!(ric.EndsWith("KS") || ric.EndsWith("KQ") || ric.EndsWith("KN")))
                        {
                            continue;
                        }

                        DseFileInfo info = ParseDseRecord(tmp);

                        if (info != null && !dseDic.ContainsKey(info.Ticker))
                        {
                            dseDic.Add(info.Ticker, info);
                        }

                        string msg = string.Format("Get 1 record from file: {0}. RIC:{1}", fileName, ric);
                        LogMessage(msg);
                    }
                }
            }
        }
        private DseFileInfo ParseDseRecord(string record)
        {
            DseFileInfo parsedRecord = new DseFileInfo();

            PropertyInfo[] properties = parsedRecord.GetType().GetProperties();

            foreach (PropertyInfo p in properties)
            {
                if (ruleDic.ContainsKey(p.Name))
                {
                    DseFileRule dseRule = ruleDic[p.Name] as DseFileRule;
                    string      value   = dseRule.ParseField(record);
                    SetPropertyValue(parsedRecord.GetType(), p.Name, value, parsedRecord);
                }
            }

            return(parsedRecord);
        }
        private void CompareIpoNda(KoreaEquityInfo ipo)
        {
            if (dseDic == null)
            {
                return;
            }

            if (dseDic.ContainsKey(ipo.Ticker))
            {
                DseFileInfo dseInfo = dseDic[ipo.Ticker];

                string[] securityNames = dseInfo.SecurityDescription.Split(' ');

                string type = string.Empty;

                if (securityNames.Length > 1)
                {
                    type = securityNames[securityNames.Length - 1];
                    dseInfo.SecurityDescription = dseInfo.SecurityDescription.Replace(type, "").Trim();
                }

                if ((dseInfo.ISIN == ipo.ISIN) && (dseInfo.SecurityDescription == ipo.IDNDisplayName))
                {
                    return;
                }
                KoreaCheckIpoData changeData = new KoreaCheckIpoData
                {
                    ProductionType        = ReutersProductionType.NDA,
                    TickerFm              = ipo.Ticker,
                    TickerProduct         = dseInfo.Ticker,
                    IsTickerSame          = true,
                    IsinFm                = ipo.ISIN,
                    IsinProduct           = dseInfo.ISIN,
                    IdnDisplayNameFm      = ipo.IDNDisplayName,
                    IdnDisplayNameProduct = dseInfo.SecurityDescription
                };

                if (dseInfo.SecurityDescription != ipo.IDNDisplayName)
                {
                    //Mark change
                    changeData.IsIdnDisplayNameSame = false;
                }
                if (dseInfo.ISIN != ipo.ISIN)
                {
                    changeData.IsIsinSame = false;
                }

                changedIpo.Add(changeData);
            }
            else
            {
                // Mark Ticker missed.
                KoreaCheckIpoData missData = new KoreaCheckIpoData
                {
                    ProductionType        = ReutersProductionType.NDA,
                    TickerFm              = ipo.Ticker,
                    TickerProduct         = string.Empty,
                    IsinFm                = ipo.ISIN,
                    IsinProduct           = string.Empty,
                    IdnDisplayNameFm      = ipo.IDNDisplayName,
                    IdnDisplayNameProduct = string.Empty,
                    IsTickerSame          = false,
                    IsIdnDisplayNameSame  = false,
                    IsIsinSame            = false
                };

                missedIpo.Add(missData);
            }
        }