コード例 #1
0
        /// <summary>
        /// Generates Fm from website informations
        /// </summary>
        /// <param name="ric"></param>
        private Dictionary <string, string> GenerateFm(string ric)
        {
            try
            {
                FmInfo res   = GetInfos(ric);
                var    fm    = new Fm();
                var    infos = new Dictionary <string, string>
                {
                    { "ric", res.Ric },
                    { "name", res.EnglishName },
                    { "displayname", GetGatsDisplayName(res.Ric, res.Type) },
                    { "chinesename", res.ChineseName },
                    { "units", String.Format("{0:n0}", Convert.ToInt64(res.Shares.Replace("元", "").Replace(",", "")) / 100) },
                    { "maturedate", res.MatureDate.ToString("ddMMMyy").ToUpper() },
                    { "effectivedate", res.EffectiveDate.ToString("ddMMMyy").ToUpper() },
                    { "effectivedateidn", res.EffectiveDate.ToString("dd/MM/yyyy") },
                    { "isin", res.Isin },
                    { "abbrev", res.EnglishName.ToUpper() },
                    { "strike", res.Strikes.Replace("元", "") },
                    { "type", res.Type }
                };
                fm.AddProp(infos);
                string filename = String.Format("{0}{1}_{2}.txt", configObj.WorkingDir, res.Ric, DateTime.Now.ToString("ddMM"));
                fm.GenerateAndSave("TwTemplate", filename);
                //TaskResultList.Add(new TaskResultEntry("result file" + res.Ric + " FM", "", filename));
                AddResult("result file", filename, "");
                //add "=== End of Proforma ===" in the file end
                AddWordInTheEnd(filename);

                //BCU.txt
                string fileNameBCU = Path.Combine(configObj.WorkingDir, "BCU.txt");
                GeneratorBCUFile(res, fileNameBCU);
                return(infos);
            }
            catch (Exception ex)
            {
                Logger.Log("Fm generation failed for this ric, error: " + ex.Message, Logger.LogType.Warning);
                return(null);
            }
        }