예제 #1
0
        protected override void Start()
        {
            try
            {
                //Login1();
                //Login2();
                int i       = 1;
                var propsDw = new List <Dictionary <string, string> >();
                foreach (Dictionary <string, string> infos in GetPages().Select(page => CleanInfos(GetInfos(page))).Where(infos => infos["type"] == "Derivative warrant"))
                {
                    infos.Add("counter", i.ToString());
                    propsDw.Add(infos);
                    i++;
                }
                if (i > 1)
                {
                    //GetFSharpTitleValue(propsDw);


                    var ndaDw1 = new Fm(Format.Horizontal, FileMode.WriteOnly);
                    ndaDw1.LoadFromTemplate(TemplateFm.ThFm, propsDw);
                    ndaDw1.Save(String.Format("{0}Thailand_DW_ADD_{1}.xls", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Fm bulk file", ndaDw1.Path, "fm");

                    var ndaDw2 = new NdaQa(FileMode.WriteOnly);
                    ndaDw2.LoadFromTemplate(Template.QaAdd, propsDw);
                    ndaDw2.Save(String.Format("{0}NDA_QA_ADD_{1}.csv", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Nda bulk file", ndaDw2.Path, "nda");

                    var ndaDw3 = new Idn(FileMode.WriteOnly);
                    ndaDw3.LoadFromTemplate(TemplateIdn.DomChain, propsDw);
                    ndaDw3.Save(String.Format("{0}IDN_Domchain_{1}.txt", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Idn bulk file", ndaDw3.Path, "idn");

                    var ndaDw4 = new Idn(FileMode.WriteOnly);
                    ndaDw4.LoadFromTemplate(TemplateIdn.ForIdn, propsDw);
                    ndaDw4.Save(String.Format("{0}IDN_ADD_{1}.txt", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Idn bulk file", ndaDw4.Path, "idn");

                    var ndaDw5 = new NdaIa(FileMode.WriteOnly);
                    ndaDw5.LoadFromTemplate(Template.IaAdd, propsDw);
                    ndaDw5.Save(String.Format("{0}NDA_IA_ADD_{1}.csv", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Nda bulk file", ndaDw5.Path, "nda");

                    var ndaDw6 = new Tc(FileMode.WriteOnly);
                    ndaDw6.LoadFromTemplate(TemplateTc.WrtAdd, propsDw);
                    ndaDw6.Save(String.Format("{0}WRT_ADD_{1}_thailand.csv", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMMMyyyy")));
                    AddResult("Dw t&c bulk file", ndaDw6.Path, "t&c");
                }
                else
                {
                    LogMessage("No Dw announcement today");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #2
0
        protected override void Start()
        {
            try
            {
                int j       = 0;
                var propsCw = new List <Dictionary <string, string> >();
                foreach (Dictionary <string, string> infos in GetPages()
                         .Select(page => CleanInfos(GetInfos(page)))
                         .Where(infos => infos["type"] == "Warrant"))
                {
                    infos.Add("counter", j.ToString());
                    propsCw.Add(infos);
                    j++;
                }
                if (j > 0)
                {
                    var ndaIaCw = new NdaIa(FileMode.WriteOnly);
                    ndaIaCw.LoadFromTemplate(Template.IaAddCw, propsCw);
                    ndaIaCw.Save(String.Format("{0}Nda_Ia_Cw_{1}.csv", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Nda bulk file", ndaIaCw.Path, "nda");

                    var ndaQaCw = new NdaQa(FileMode.WriteOnly);
                    ndaQaCw.LoadFromTemplate(Template.QaAddCw, propsCw);
                    ndaQaCw.Save(String.Format("{0}Nda_Qa_Cw_{1}.csv", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Nda bulk file", ndaQaCw.Path, "nda");

                    var idnNvdrCw = new Idn(FileMode.WriteOnly);
                    idnNvdrCw.LoadFromTemplate(TemplateIdn.CwNvdr, propsCw);
                    idnNvdrCw.Save(String.Format("{0}IDN_Cw_Nvdr_{1}.txt", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Idn bulk file", idnNvdrCw.Path, "idn");

                    var idnMain = new Idn(FileMode.WriteOnly);
                    idnMain.LoadFromTemplate(TemplateIdn.CwMain, propsCw);
                    idnMain.Save(String.Format("{0}IDN_Cw_Main_{1}.txt", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Idn bulk file", idnMain.Path, "idn");

                    #region [error in F# dll in this "TemplateFm.ThFmCw"]
                    //var fmCw = new Fm(Format.Horizontal, FileMode.WriteOnly);
                    //fmCw.LoadFromTemplate(TemplateFm.ThFmCw, propsCw);
                    //fmCw.Save(String.Format("{0}Thailand_Fm_Cw_{1}.xls", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    //AddResult("Cw Fm bulk file", fmCw.Path, "fm");
                    #endregion

                    string path = String.Format("{0}Thailand_Fm_Cw_{1}.xls", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM"));
                    generateXls(propsCw, path);
                    AddResult("Cw Fm bulk file", path, "fm");

                    var tcCw = new Tc(FileMode.WriteOnly);
                    tcCw.LoadFromTemplate(TemplateTc.WrtAddCw, propsCw);
                    tcCw.Save(String.Format("{0}Wrt_Add_Cw_{1}.csv", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw t&c bulk file", tcCw.Path, "t&c");
                }
                else
                {
                    LogMessage("No Cw announcement today");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Task failed, error: " + ex.Message, ex);
            }
        }