Exemplo n.º 1
0
        private void InitializeDse()
        {
            string dseFileRulePath = @".\Config\Asia\DseFileRules.xml";

            List <DseFileRule> dseRules = ConfigUtil.ReadConfig(dseFileRulePath, typeof(List <DseFileRule>)) as List <DseFileRule>;

            Dictionary <string, DseFileRule> ruleDic = new Dictionary <string, DseFileRule>();

            ruleDic = dseRules.ToDictionary(e => e.PropertyName, StringComparer.Ordinal);

            // File - TransferRule - List<DseFileInfo>
            // string - TransferRule - DseFileInfo

            DseFileInfo transferedRecord = new DseFileInfo();

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

            string record = "XE1247.HK             MIKO INTL ORD                                                              HKGHKD1Miko International Holdings Ltd                                                     114062620Miko Intl       CHN                                                                                1247                124686854                     1247.HK                        4945                         ORD Y1247                     Miko International Holdings Ord Shs                                                                                                                      Stock Exch Hong KongXHKG          N   -9999999999999999900   -9999999999999999900   -9999999999999999900   -9999999999999999900   -9999999999999999999   -9999999999999999999   -999999999                        200000ORD                                                                                                    -999999999999999999900000000-999999999999999999900000000                  KY0x00100b0009d654780x00100b0009d39f71Y20140115                                       CYM T+2            ";

            foreach (PropertyInfo p in properties)
            {
                if (ruleDic.ContainsKey(p.Name))
                {
                    DseFileRule dseRule = ruleDic[p.Name] as DseFileRule;
                    string      value   = dseRule.ParseField(record);
                    SetPropertyValue(transferedRecord.GetType(), p.Name, value, transferedRecord);
                }
            }
        }
Exemplo n.º 2
0
        private DseFileInfo ParseDseRecord(string record)
        {
            DseFileInfo parsedRecord = new DseFileInfo();

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

            //string record = "XE1247.HK             MIKO INTL ORD                                                              HKGHKD1Miko International Holdings Ltd                                                     114062620Miko Intl       CHN                                                                                1247                124686854                     1247.HK                        4945                         ORD Y1247                     Miko International Holdings Ord Shs                                                                                                                      Stock Exch Hong KongXHKG          N   -9999999999999999900   -9999999999999999900   -9999999999999999900   -9999999999999999900   -9999999999999999999   -9999999999999999999   -999999999                        200000ORD                                                                                                    -999999999999999999900000000-999999999999999999900000000                  KY0x00100b0009d654780x00100b0009d39f71Y20140115                                       CYM T+2            ";

            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);
        }