Exemple #1
0
 /// <summary>
 /// Generate NDA QA file.
 /// </summary>
 private void GenerateNDAQAFile()
 {
     try
     {
         string        fileName   = "KR" + DateTime.Today.ToString("yyyyMMdd", new CultureInfo("en-US")) + "QADrop.csv";
         string        filePath   = Path.Combine(configObj.NDA, fileName);
         List <string> ndaQaTitle = new List <string>()
         {
             "RIC", "ASSET COMMON NAME", "EXPIRY DATE"
         };
         List <List <string> > data = new List <List <string> >();
         foreach (CompanyWarrantDropTemplate item in waDrop)
         {
             string        expiryDate = DateTime.Parse(item.EffectiveDate).ToString("dd-MMM-yyyy", new CultureInfo("en-US"));
             List <string> record     = new List <string>();
             record.Add(item.RIC);
             record.Add(item.QACommonName);
             record.Add(expiryDate);
             data.Add(record);
             List <string> recordF = new List <string>();
             string        ricF    = item.RIC.Split('.')[0] + "F." + item.RIC.Split('.')[1];
             recordF.Add(ricF);
             recordF.Add(item.QACommonName);
             recordF.Add(expiryDate);
             data.Add(recordF);
         }
         FileUtil.WriteOutputFile(filePath, data, ndaQaTitle, WriteMode.Overwrite);
         TaskResultList.Add(new TaskResultEntry(fileName, "NDA QA FILE", filePath, FileProcessType.NDA));
         Logger.Log("Generate NDA QA file successfully. Filepath is " + filePath);
     }
     catch (Exception ex)
     {
         Logger.Log("Error found in generating NDA QA file.\r\n " + ex.Message, Logger.LogType.Error);
     }
 }
Exemple #2
0
        private void GenerateTxtFile()
        {
            string fileName;

            if (string.IsNullOrEmpty(emailDate))
            {
                fileName = dateTime.Year + dateTime.Month + dateTime.Day + "Force_drop-TW.txt";
            }
            else
            {
                DateTime date = Convert.ToDateTime(emailDate);
                fileName = date.Year.ToString() + date.Month + date.Day + "Force_drop-TW.txt";
            }
            string forcedropTwTxtFilePath = Path.Combine(FilePath, fileName);
            string content = "RIC\tREGION_CODE\tXQS_HEADEND\r\n";

            foreach (ForcedropTW tw in listForcedropTW)
            {
                content += string.Format("{0}\t", tw.RIC);
                content += string.Format("{0}\t", tw.REGION_CODE);
                content += string.Format("{0}", tw.XQS_HEADEND);
                content += "\r\n";
            }
            try
            {
                File.WriteAllText(forcedropTwTxtFilePath, content);
                TaskResultList.Add(new TaskResultEntry("TWWarranrDrop", "txtFile", forcedropTwTxtFilePath));
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("Error happens when generating ForcedropTW txt file. Ex: {0} .", ex.Message));
            }
        }
        //17 lines each page
        private void GenerateEnglishVersionXmlFile(List <BrokerInfo> brokerList, string xmlFilePath)
        {
            int lineNumEachPage = 22;
            int lastAddedRicNum = 0;
            ProductionXmlFileTemplate template = new ProductionXmlFileTemplate();

            for (int i = 0; i < lineNumEachPage * 34; i++)
            {
                if (i % lineNumEachPage == 0)
                {
                    Core.Ric ric = new Core.Ric();
                    ric.Name = string.Format("HKBK{0}", ((i / lineNumEachPage) + 2).ToString("D2"));
                    template.rics.rics.Add(ric);
                }
                Fid fid = new Fid();
                fid.Id = 317 + i % lineNumEachPage;
                if (i < brokerList.Count)
                {
                    fid.Value = getFidValueForEnglishVersionFile(brokerList[i]);
                }
                else
                {
                    fid.Value = "\"\"";
                }
                lastAddedRicNum = template.rics.rics.Count - 1;
                template.rics.rics[lastAddedRicNum].fids.Add(fid);
            }

            ConfigUtil.WriteXml(xmlFilePath, template);
            TaskResultList.Add(new TaskResultEntry("English Version XML Format File", "", xmlFilePath));
        }
Exemple #4
0
        private void GenerateFiles(List <ETFinsertTaskTemplate> res)
        {
            DateTime      lastTradingDay = MiscUtil.GetLastTradingDay(DateTime.Now, _holidayList, 1);
            StringBuilder sb             = new StringBuilder();
            string        fileContents   = "";

            sb.Append("TQSK.DAT;21-MAR-2012 15:00:00;TPS;\r\n");
            sb.Append("GEN_VAL6;GV6_TEXT;\r\n");
            foreach (var term in res)
            {
                sb.AppendFormat("{0}.TW;{1};144700;\r\n", term.Code, term.EstimatedValue);
            }
            sb.Append("\r\n\r\n\r\n\r\n\r\n");
            fileContents += sb.ToString();
            sb.Remove(0, sb.Length);
            //file one

            sb.Append("TAM.DAT;21-MAR-2012 15:00:00;TPS;\r\n");
            sb.Append("GEN_VAL7;\r\n");
            foreach (var term in from term in res
                     let @where = string.Format("where Code='{0}' and GrabTime='{1}' and EstimatedValue='{2}'", term.Code, lastTradingDay.ToString("yyyy/MM/dd", new CultureInfo("en-US")), term.EstimatedValue)
                                  let table = ManagerBase.Select(TableName, new[] { "*" }, @where)
                                              where table.Rows.Count == 0
                                              select term)
            {
                sb.AppendFormat("{0}.TW;{1};\r\n", term.Code, term.ReferenceValue);
            }
            sb.Append("\r\n\r\n\r\n\r\n\r\n");
            fileContents += sb.ToString();
            string file2 = sb.ToString();

            sb.Remove(0, sb.Length);
            //file two

            sb.Append("TAM.DAT;21-MAR-2012 15:00:00;TPS;\r\n");
            sb.Append("SPARE_DATE5;\r\n");
            foreach (var term in res)
            {
                sb.AppendFormat("{0}.TW;{1};\r\n", term.Code, DateTime.Now.ToString("dd/MM/yyyy"));
            }
            sb.Append("\r\n\r\n\r\n\r\n\r\n");
            fileContents += sb.ToString();
            sb.Remove(0, sb.Length);
            //file three

            sb.Append("TAM.DAT;21-MAR-2012 15:00:00;TPS;\r\n");
            sb.Append("SPARE_DATE5;\r\n");

            sb.AppendFormat("006201.TWO;{0};\r\n", lastTradingDay.ToString("dd/MM/yyyy"));
            sb.AppendFormat("006202.TWO;{0};\r\n", lastTradingDay.ToString("dd/MM/yyyy"));
            sb.Append("\r\n\r\n\r\n\r\n\r\n");
            fileContents += sb.ToString();
            sb.Remove(0, sb.Length);
            //file four

            string path = string.Format("{0}\\TQSK RICs.txt", _configObj.ResultFileDir);

            File.WriteAllText(path, fileContents, Encoding.UTF8);
            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(path), path, path, CreateMailOne(file2)));
        }
Exemple #5
0
        private void GenerateIA()
        {
            string foldername           = DateTime.Today.ToString("yyyy-MM-dd", new CultureInfo("en-US"));
            string dir                  = CreateFolder(foldername);
            string filePath             = Path.Combine(dir, "KR_ELW_DROP_jj" + DateTime.Now.ToString("ddMMMyyyy", new CultureInfo("en-US")) + "IAChg.csv");
            List <List <string> > res   = new List <List <string> >();
            List <string>         title = new List <string>()
            {
                "ISIN", "ASSET COMMON NAME"
            };

            foreach (var item in dropList)
            {
                List <string> oneRes = new List <string>();
                oneRes.Add(item.ISIN);
                if (tableOfPilc.Contains(item.RIC))
                {
                    oneRes.Add((tableOfPilc[item.RIC] as PilcTemplate).IACommonName);
                }
                else
                {
                    string msg = string.Format("TAG and PILC file doesn't contains record for RIC:{0}.", item.RIC);
                    Logger.Log(msg, Logger.LogType.Error);
                    oneRes.Add("***");
                }
                res.Add(oneRes);
            }
            FileUtil.WriteOutputFile(filePath, res, title, WriteMode.Append);
            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(filePath), "DROP NDA IA File", filePath, FileProcessType.NDA));
        }
Exemple #6
0
        private void GenerateFile(string lineToFile)
        {
            try
            {
                string outputFolder = Path.Combine(ConfigObj.OutputPath, DateTime.Today.ToString("yyyy-MM-dd"));
                if (!Directory.Exists(outputFolder))
                {
                    Directory.CreateDirectory(outputFolder);
                }

                string template = InitializeMacTemplate();
                string dataLine = "[DataStreamRicCreationInfoLine]";
                template = template.Replace(dataLine, lineToFile);
                string fileName = string.Format("Mexico_{0}.MAC", ConfigObj.Date);
                string filePath = Path.Combine(outputFolder, fileName);
                File.WriteAllText(filePath, template, Encoding.ASCII);
                TaskResultList.Add(new TaskResultEntry("Output Folder", "Output Folder", outputFolder));
                TaskResultList.Add(new TaskResultEntry("MAC File", "MAC File", filePath));

                string msg = string.Format("Generate normal RIC creation output file...OK!");
                Logger.Log(msg);
            }
            catch (Exception ex)
            {
                string msg = string.Format("At GenerateFile(). Error found in generating MAC file. Error message:{0}.", ex.Message);
                Logger.Log(msg, Logger.LogType.Error);
            }
        }
 public void GenerateISINFile(List <RicISINInfo> ricInfoList)
 {
     using (ExcelApp app = new ExcelApp(false, false))
     {
         string targetFilePath = NewTargetFilePath(Path.Combine(Path.GetDirectoryName(configObj.SourceFilePath), configObj.TargetIsinFileName));
         if (File.Exists(targetFilePath))
         {
             File.Delete(targetFilePath);
         }
         var workbook  = ExcelUtil.CreateOrOpenExcelFile(app, targetFilePath);
         var worksheet = (Worksheet)workbook.Worksheets[1];
         using (ExcelLineWriter writer = new ExcelLineWriter(worksheet, 1, 1, ExcelLineWriter.Direction.Right))
         {
             writer.WriteLine("Ric");
             writer.WriteLine("Official Code");
             writer.WriteLine("ISIN");
             writer.WriteLine("Name");
             writer.WriteLine("Type");
             writer.PlaceNext(writer.Row + 1, 1);
             foreach (RicISINInfo ricISINInfo in ricInfoList)
             {
                 writer.WriteLine(ricISINInfo.ric);
                 ExcelUtil.GetRange(writer.Row, writer.Col, worksheet).NumberFormat = "@";
                 writer.WriteLine(ricISINInfo.OfficialCode);
                 writer.WriteLine(ricISINInfo.ISIN);
                 writer.WriteLine(ricISINInfo.Name);
                 writer.WriteLine(ricISINInfo.type);
                 writer.PlaceNext(writer.Row + 1, 1);
             }
         }
         workbook.Save();
         TaskResultList.Add(new TaskResultEntry("Newly Generated ISIN File", "The file contains all the newly generated ISIN.", targetFilePath));
     }
 }
Exemple #8
0
        private void generateEmaCsv(List <FurtherIssueModel> fList)
        {
            string emaFileDir = getEmaFileDir(fList);
            //need to confirm
            string csvFileName = string.Format("{0}\\WRT_QUA_{1}_Korea.csv", emaFileDir, DateTime.Today.ToString("ddMMMyyyy", new CultureInfo("en-US")));
            List <List <string> > csvResList = new List <List <string> >();
            List <string>         head       = new List <string>();
            int line = 0;

            head.Add("Logical_Key");
            head.Add("Secondary_ID");
            head.Add("Secondary_ID_Type");
            head.Add("EH_Issue_Quantity");
            head.Add("Issue_Quantity");
            csvResList.Add(head);
            if (File.Exists(csvFileName))
            {
                line = ReadLogic(csvFileName);
            }
            csvResList.AddRange(fList.Select((t, i) => new List <string>
            {
                (i + 1 + line).ToString(), t.Old_Isin, "ISIN", "N", t.New_Quanity
            }));
            if (File.Exists(csvFileName))
            {
                csvResList.RemoveAt(0);//remove head
                OperateExcel.WriteToCSV(csvFileName, csvResList, FileMode.Append);
            }
            else
            {
                OperateExcel.WriteToCSV(csvFileName, csvResList, FileMode.Create);
            }
            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(csvFileName), "", csvFileName, FileProcessType.Other));
        }
Exemple #9
0
        protected override void Start()
        {
            try
            {
                List <List <string> > records = GrabTodayData();
                announcementList = FilterTodayAnnounce(records);

                if (announcementList.Count == 0)
                {
                    string msg = "No Equity Pre-IPO Announcement today.";
                    Logger.Log(msg);
                    return;
                }

                UpdateAnnouncementFromISINWebpage();
                FormatAnnouncement();

                AddDataToDb();
                GenerateFM();

                GenerateGEDAFile();
                GenerateNDAFile();
            }
            catch (Exception ex)
            {
                string msg = "Error found in Start." + ex.Message;
                Logger.Log(msg, Logger.LogType.Error);
            }
            finally
            {
                TaskResultList.Add(new TaskResultEntry("Log", "LOG FILE", Logger.FilePath));
            }
        }
        private void generateFile(List <ChinaIndex> indexList, string fileName)
        {
            if (indexList.Count == 0)
            {
                Logger.Log("No item in the index list.");
                return;
            }

            using (ExcelApp app = new ExcelApp(false, false))
            {
                var workbook = ExcelUtil.CreateOrOpenExcelFile(app, string.Format("{0}\\{1}", configObj.TargetFileDir, fileName));
                int sheetNum = (indexList.Count + configObj.ChainNumPerSheet - 1) / configObj.ChainNumPerSheet;
                int startPos = 0;
                if (sheetNum > workbook.Worksheets.Count)
                {
                    workbook.Worksheets.Add(Missing.Value, Missing.Value, sheetNum - workbook.Worksheets.Count, Missing.Value);
                }
                for (int i = 0; i < sheetNum; i++)
                {
                    var worksheet = workbook.Worksheets[i + 1] as Worksheet;

                    startPos = i * configObj.ChainNumPerSheet;
                    int endPos = indexList.Count < (startPos + configObj.ChainNumPerSheet) ? indexList.Count : (startPos + configObj.ChainNumPerSheet);
                    WriterWorksheet(worksheet, indexList, startPos, endPos);
                }
                TaskResultList.Add(new TaskResultEntry(fileName, "", workbook.FullName));
                workbook.Save();
                workbook.Close(true, workbook.FullName, true);
            }
        }
Exemple #11
0
        protected override void Initialize()
        {
            configObj = Config as KOREA_AddDropChangeConfig;
            //configObj.FM = @"D:\test\PageUpdate\FM";
            //configObj.TemplatePath = @"D:\test\PageUpdate\Out\RIC_Convs_Template_V3.xls";
            //if (string.IsNullOrEmpty(configObj.FM))
            //{
            //    string msg = "'FM' in configuration can't be blank!";
            //    MessageBox.Show(msg, "Error");
            //    Logger.Log(msg, Logger.LogType.Error);
            //    throw new Exception(msg);
            //}
            if (string.IsNullOrEmpty(configObj.TemplatePath))
            {
                string msg = "'TemplatePath' in configuration can't be blank!";
                MessageBox.Show(msg, "Error");
                Logger.Log(msg, Logger.LogType.Error);
                throw new Exception(msg);
            }
            if (!File.Exists(configObj.TemplatePath))
            {
                string msg = string.Format("Can't find file {0}. Please check the path.", configObj.TemplatePath);
                MessageBox.Show(msg, "Error");
                Logger.Log(msg, Logger.LogType.Error);
                throw new Exception(msg);
            }
            Logger.Log("Initialize OK!");

            TaskResultList.Add(new TaskResultEntry("Log", "Log", Logger.FilePath));
        }
Exemple #12
0
        protected override void Initialize()
        {
            ConfigObj = Config as DataStreamRicCreationWithFileDownloadConfig;
            TaskResultList.Add(new TaskResultEntry("LOG File", "LOG File", Logger.FilePath));

            usrName  = ConfigObj.Username;
            passWord = ConfigObj.Password;

            usrName  = usrName.Replace("@", "%40");
            passWord = passWord.Replace("@", "%40");


            accountName = ConfigObj.AccountName.Trim();
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(ConfigObj.AccountName.Trim());

            if (emailAccount != null)
            {
                accountName    = emailAccount.AccountName;
                email_password = emailAccount.Password;
                domain         = emailAccount.Domain;
            }

            listMailTo        = ConfigObj.MailTo;
            listMailSignature = ConfigObj.MailSignature;

            service = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(accountName, email_password, domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));


            InitializeDownloadUrlDirectory();
            InitializeFileDirectory();

            string msg = "Initialize...OK!";

            Logger.Log(msg);
        }
Exemple #13
0
        /// <summary>
        /// GenerateFile
        /// </summary>
        /// <param name="list">DateType</param>
        /// <param name="fileName">fileName</param>
        private void GenerateFile(List <string> list, string fileName)
        {
            string filePath = Path.Combine(txtFilePath, fileName);

            if (list.Count > 0)
            {
                string content = string.Empty;
                foreach (var str in list)
                {
                    content += string.Format(",{0}", str);
                }
                content = content.Remove(0, 1);
                try
                {
                    File.WriteAllText(filePath, content);
                    TaskResultList.Add(new TaskResultEntry("TWQCFutureNewRIC", "RicTxtFile", filePath));
                }
                catch (Exception ex)
                {
                    Logger.Log(string.Format("Error happens when generating file. Ex: {0} .", ex.Message));
                }
            }
            else
            {
                File.Delete(filePath);
            }
        }
Exemple #14
0
 /// <summary>
 /// Generate NDA IA file.
 /// </summary>
 private void GenerateNDAIAFile()
 {
     try
     {
         string        fileName   = "KR" + DateTime.Today.ToString("yyyyMMdd", new CultureInfo("en-US")) + "IADrop.csv";
         string        filePath   = Path.Combine(configObj.NDA, fileName);
         List <string> ndaQaTitle = new List <string>()
         {
             "ISIN", "ASSET COMMON NAME"
         };
         List <List <string> > data = new List <List <string> >();
         foreach (CompanyWarrantDropTemplate item in waDrop)
         {
             List <string> record = new List <string>();
             record.Add(item.ISIN);
             record.Add(item.ForIACommonName);
             data.Add(record);
         }
         FileUtil.WriteOutputFile(filePath, data, ndaQaTitle, WriteMode.Overwrite);
         TaskResultList.Add(new TaskResultEntry(fileName, "NDA IA FILE", filePath, FileProcessType.NDA));
         Logger.Log("Generate NDA IA file successfully. Filepath is " + filePath);
     }
     catch (Exception ex)
     {
         Logger.Log("Error found in generating NDA IA file.\r\n " + ex.Message, Logger.LogType.Error);
     }
 }
Exemple #15
0
        private void UpdateAddDropFile(string templateFilePath, List <AddDropChangeInfo> addDropEventList)
        {
            using (ExcelApp app = new ExcelApp(false, false))
            {
                var workbook  = ExcelUtil.CreateOrOpenExcelFile(app, templateFilePath);
                var worksheet = ExcelUtil.GetWorksheet("INPUT SHEET", workbook);
                if (worksheet == null)
                {
                    Logger.LogErrorAndRaiseException(string.Format("There's no worksheet: {0}", worksheet.Name));
                }
                ((Range)worksheet.Columns["D"]).NumberFormat = "@";
                using (ExcelLineWriter writer = new ExcelLineWriter(worksheet, 3, 1, ExcelLineWriter.Direction.Right))
                {
                    foreach (AddDropChangeInfo changeInfo in addDropEventList)
                    {
                        writer.WriteLine(changeInfo.EventAction);
                        writer.WriteLine(changeInfo.RicSeqId);
                        writer.WriteLine(changeInfo.ChangeType);
                        writer.WriteLine(changeInfo.Date.ToString("ddMMMyy"));
                        writer.WriteLine(changeInfo.DescriptionWas);
                        writer.WriteLine(changeInfo.DescriptionNow);
                        writer.WriteLine(changeInfo.RicWas);
                        writer.WriteLine(changeInfo.RicNow);
                        writer.WriteLine(changeInfo.ISINWas);
                        writer.WriteLine(changeInfo.ISINNow);
                        writer.WriteLine(changeInfo.SecondID);
                        writer.WriteLine(changeInfo.SecondWas);
                        writer.WriteLine(changeInfo.SecondNow);
                        writer.WriteLine(changeInfo.ThomsonWas);
                        writer.WriteLine(changeInfo.ThomsonNow);
                        writer.WriteLine("");
                        writer.WriteLine(changeInfo.Exchange);
                        writer.WriteLine(changeInfo.Asset);
                        writer.PlaceNext(writer.Row + 1, 1);
                    }
                }

                //Run Macros
                app.ExcelAppInstance.GetType().InvokeMember("Run",
                                                            BindingFlags.Default | BindingFlags.InvokeMethod,
                                                            null,
                                                            app.ExcelAppInstance,
                                                            new object[] { "FormatData" });

                string targetFilePath = Path.GetDirectoryName(templateFilePath);
                targetFilePath = Path.Combine(targetFilePath, DateTime.Today.ToString("yyyy-MM-dd"));
                if (!Directory.Exists(targetFilePath))
                {
                    Directory.CreateDirectory(targetFilePath);
                }
                targetFilePath += "\\Result_Add_Drop_Upload_File.xls";
                workbook.SaveCopyAs(targetFilePath);
                TaskResultList.Add(new TaskResultEntry("Result File", "", targetFilePath));
                //workbook.Save();
                workbook.Close(false, templateFilePath, false);
            }
        }
Exemple #16
0
        protected override void Start()
        {
            string path = testConfig.path;

            Logger.Log("test log");

            FileProcessType type = (FileProcessType)(Enum.Parse(typeof(FileProcessType), testConfig.type));

            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(testConfig.path), "", testConfig.path, type));
        }
Exemple #17
0
        /// <summary>
        /// Set the GEDA files result list.
        /// </summary>
        /// <param name="result">results</param>
        private void SetTaskResultList(Hashtable result)
        {
            ArrayList keysArr = new ArrayList(result.Keys);

            keysArr.Sort();
            foreach (string keyRusult in keysArr)
            {
                TaskResultList.Add(new TaskResultEntry(keyRusult, "GEDA DROP FILE", result[keyRusult].ToString(), FileProcessType.GEDA_BULK_RIC_DELETE));
            }
        }
Exemple #18
0
        protected override void Initialize()
        {
            configObj = Config as KoreaDropGedaConfig;
            if (string.IsNullOrEmpty(configObj.BulkFile))
            {
                configObj.BulkFile = GetOutputFilePath();
            }

            TaskResultList.Add(new TaskResultEntry("Log", "Log", Logger.FilePath));
        }
Exemple #19
0
        protected override void Initialize()
        {
            ConfigObj = Config as DataStreamRicCreationWithDseConfig;
            TaskResultList.Add(new TaskResultEntry("LOG File", "LOG File", Logger.FilePath));

            InitializeFileDirectory();

            string msg = "Initialize...OK!";

            Logger.Log(msg);
        }
Exemple #20
0
        protected override void Initialize()
        {
            configObj = Config as KoreaChangeGedaNdaConfig;
            if (string.IsNullOrEmpty(configObj.BulkFile))
            {
                configObj.BulkFile = GetOutputFilePath();
            }

            outputFolder = Path.Combine(configObj.BulkFile, DateTime.Today.ToString("yyyy-MM-dd"));

            TaskResultList.Add(new TaskResultEntry("Log", "Log", Logger.FilePath));
        }
Exemple #21
0
        private void InitializeFileDirectory()
        {
            // mFileFolder = Path.Combine(ConfigObj.OutputPath, DateTime.Today.ToString("yyyy-MM-dd"));
            mFileFolder = ConfigObj.OutputPath;
            mFileFolder = mFileFolder + "\\";

            if (!Directory.Exists(mFileFolder))
            {
                Directory.CreateDirectory(mFileFolder);
            }

            TaskResultList.Add(new TaskResultEntry("FILES", "FILES", mFileFolder));
        }
Exemple #22
0
 private void GenerateFile()
 {
     TaskResultList.Add(new TaskResultEntry("GEDA Folder", "GEDA Folder", configObj.GEDA));
     foreach (KoreaKtbFutureInfo item in futures)
     {
         string fileName = item.Chain.Replace("KOSBND_OTC_", "") + ".txt";
         string filePath = Path.Combine(configObj.GEDA, fileName);
         string content  = item.Chain + "\r\n";
         content += string.Join("\r\n", item.CodeList.ToArray());
         FileUtil.WriteOutputFile(filePath, content);
         TaskResultList.Add(new TaskResultEntry(fileName, fileName, filePath, FileProcessType.GEDA_BULK_CHAIN_RIC_CREATION));
     }
 }
Exemple #23
0
        private void GenerateQA()
        {
            string foldername           = DateTime.Today.ToString("yyyy-MM-dd", new CultureInfo("en-US"));
            string dir                  = CreateFolder(foldername);
            string filePath             = Path.Combine(dir, "KR_ELW_DROP_jj" + DateTime.Now.ToString("ddMMMyyyy", new CultureInfo("en-US")) + "QAChg.csv");
            List <List <string> > res   = new List <List <string> >();
            List <string>         title = new List <string>()
            {
                "RIC", "ASSET COMMON NAME", "EXPIRY DATE"
            };

            foreach (var item in dropList)
            {
                List <string> oneRes = new List <string>();
                oneRes.Add(item.RIC);
                if (tableOfPilc.Contains(item.RIC))
                {
                    oneRes.Add((tableOfPilc[item.RIC] as PilcTemplate).QACommonName);
                    updatedTagPilc = false;
                }
                else
                {
                    string msg = string.Format("TAG and PILC file doesn't contains record for RIC:{0}.", item.RIC);
                    Logger.Log(msg, Logger.LogType.Error);
                    oneRes.Add("***");
                }
                oneRes.Add(DateTime.Now.ToString("dd-MMM-yyyy", new CultureInfo("en-US")));
                res.Add(oneRes);

                oneRes = new List <string>();
                oneRes.Add(item.RIC.Replace(".KS", "F.KS"));
                if (tableOfPilc.Contains(item.RIC))
                {
                    oneRes.Add((tableOfPilc[item.RIC] as PilcTemplate).QACommonName);
                }
                else
                {
                    oneRes.Add("***");
                }
                oneRes.Add(DateTime.Now.ToString("dd-MMM-yyyy", new CultureInfo("en-US")));
                res.Add(oneRes);
            }

            if (!updatedTagPilc)
            {
                MessageBox.Show("Please update the TAG and PILC file and run this task again.");
            }

            FileUtil.WriteOutputFile(filePath, res, title, WriteMode.Append);
            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(filePath), "DROP NDA QA File", filePath, FileProcessType.NDA));
        }
Exemple #24
0
 protected override void Start()
 {
     GrabDataFromKindWebpage();
     if (waDrop.Count > 0)
     {
         FormatData();
         GenerateFiles();
         //InsertGedaInfoToDb();
     }
     else
     {
         Logger.Log("There is no Company Warrant DROP data grabbed");
     }
     TaskResultList.Add(new TaskResultEntry("LOG file", "LOG file", Logger.FilePath));
 }
        private void StartJob()
        {
            string          date      = DateTime.Today.ToString("yyyy-MM-dd");
            KoreaRicNumInfo todayInfo = KoreaRicNumManager.GetByDate(date);

            if (todayInfo != null)
            {
                string msg = string.Format("Please notice the task has been done today. Add number: {0}. Drop number: {1}.", todayInfo.WarrantAddRicNum, todayInfo.WarrantDropRicNum);
                Logger.Log(msg, Logger.LogType.Warning);
            }


            int addNum  = StartELWFM1AndFileBulkGenerateJob();
            int dropNum = StartELWDropJob();

            if ((addNum + dropNum) == 0)
            {
                string msg = "No ADD or DROP data grabbed today.";
                Logger.Log(msg);
                return;
            }

            string emaFolder = CreateFM1FileEmaDir();

            TaskResultList.Insert(0, new TaskResultEntry("EMA Folder", "EMA Folder", emaFolder));
            TaskResultList.Insert(0, new TaskResultEntry("BulkFile Folder", "BulkFile Folder", configObj.BulkFile));
            TaskResultList.Insert(0, new TaskResultEntry("FM Folder", "FM Folder", configObj.FM));
            TaskResultList.Insert(0, new TaskResultEntry("LOG", "LOG", Logger.FilePath));


            KoreaRicNumInfo    warrantRicNumInfo = new KoreaRicNumInfo(date, addNum, dropNum);
            KoreaRicNumManager ricManager        = new KoreaRicNumManager();

            if (todayInfo == null)
            {
                ricManager.Insert(warrantRicNumInfo);
            }

            else
            {
                ricManager.ModifyByDate(date, addNum, dropNum);
            }

            string filename = "Korea FM for " + DateTime.Today.ToString("dd-MMM-yyyy", new CultureInfo("en-US")).Replace("-", " ") + " (Morning).xls";
            string ipath    = Path.Combine(configObj.FM, filename);

            AddResult(Path.GetFileNameWithoutExtension(ipath), ipath, "FM File");
        }
Exemple #26
0
        private void GenerateFileFive()
        {
            StringBuilder sb           = new StringBuilder();
            string        fileContents = "";

            sb.Append("TQSK.DAT;21-MAR-2012 15:00:00;TPS;\r\n");
            sb.Append("HIGH_1;LOW_1;\r\n");
            sb.AppendFormat(".TWOIRR;{0};{0};\r\n", _configObj.ValueInFileFive);
            fileContents += sb.ToString();
            sb.Remove(0, sb.Length);
            //file five
            string path = string.Format("{0}\\TWOIRR.txt", _configObj.ResultFileDir);

            File.WriteAllText(path, fileContents, Encoding.UTF8);
            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(path), path, path, CreateMailTwo()));
        }
Exemple #27
0
        private void GenerateFile(List <IssueAssetAddTemplate> listIAATemplate)
        {
            if (listIAATemplate == null || listIAATemplate.Count == 0)
            {
                string msg = string.Format("listIAATemplate is null or empty!");
                Logger.Log(msg, Logger.LogType.Warning);
                return;
            }

            ExcelApp excelApp = new ExcelApp(false, false);

            if (excelApp.ExcelAppInstance == null)
            {
                string msg = "Excel could not be started. Check that your office installation and project reference are correct !!!";
                Logger.Log(msg, Logger.LogType.Error);
                return;
            }

            try
            {
                Workbook  wBook  = ExcelUtil.CreateOrOpenExcelFile(excelApp, issueAssAddPath);
                Worksheet wSheet = wBook.Worksheets[1] as Worksheet;

                if (wSheet == null)
                {
                    string msg = "Excel Worksheet could not be started. Check that your office installation and project reference are correct !!!";
                    Logger.Log(msg, Logger.LogType.Error);
                    return;
                }

                FillExcelTitle(wSheet);
                FillExcelBody(wSheet, listIAATemplate);
                excelApp.ExcelAppInstance.AlertBeforeOverwriting = false;
                wBook.Save();
                TaskResultList.Add(new TaskResultEntry("HKWarrantsReIssueHistory", "InitialIssue", issueAssAddPath));
            }
            catch (Exception ex)
            {
                string msg = "Error found in NDA T&C file :" + ex.ToString();
                Logger.Log(msg, Logger.LogType.Error);
            }
            finally
            {
                excelApp.Dispose();
            }
        }
Exemple #28
0
        private void GenerateFile(List <HolidayInfo> holiday)
        {
            string title = "HolidayDate\tMarketId\tMarketName\tComment";

            string[] data = new string[holiday.Count];
            for (int i = 0; i < holiday.Count; i++)
            {
                HolidayInfo item    = holiday[i];
                string      content = string.Format("{0}\t{1}\t{2}\t{3}", item.HolidayDate, item.MarketId, (MarketIdEnum)item.MarketId, item.Comment);
                data[i] = content;
            }

            string filePath = string.Format("{0}\\{1}_HOLIDAY.txt", GetOutputFilePath(), configObj.MarketId);

            FileUtil.WriteOutputFile(filePath, data, title, WriteMode.Overwrite);
            TaskResultList.Add(new TaskResultEntry("HOLIDAY File", "HOLIDAY File", filePath));
        }
Exemple #29
0
        private List <string> GenerateFile(List <string> list)
        {
            List <string> listAttachement = new List <string>();

            if (list == null || list.Count == 0)
            {
                string msg = string.Format("no ric in the pdf files!");
                Logger.Log(msg, Logger.LogType.Error);

                return(null);
            }

            string        path = Path.Combine(resultFilePath, string.Format("RIC_{0}.txt", DateTime.Now.ToUniversalTime().AddHours(+8).ToString("yyyy-MM-dd")));
            StringBuilder sb   = new StringBuilder();

            sb.Append("RIC\t\r\n");

            foreach (var item in list)
            {
                sb.AppendFormat("{0}\t\r\n", item);
            }

            try
            {
                if (!Directory.Exists(resultFilePath))
                {
                    Directory.CreateDirectory(resultFilePath);
                }

                File.WriteAllText(path, sb.ToString());
                TaskResultList.Add(new TaskResultEntry("China Ipo Qc", "ric list", path));
                listAttachement.Add(path);

                return(listAttachement);
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("Error happens when generating file. Ex: {0} .", ex.Message));

                return(null);
            }
        }
Exemple #30
0
        private void GenerateDropGeda()
        {
            string foldername           = DateTime.Today.ToString("yyyy-MM-dd", new CultureInfo("en-US"));
            string dir                  = CreateFolder(foldername);
            string filePath             = Path.Combine(dir, "KR_ELW_" + DateTime.Now.ToString("ddMMMyyyy", new CultureInfo("en-US")) + "_DROP_BCU_RIC_REMOVE.txt");
            List <List <string> > res   = new List <List <string> >();
            List <string>         title = new List <string>()
            {
                "RIC"
            };

            foreach (var item in dropList)
            {
                List <string> oneRes = new List <string>();
                oneRes.Add(item.RIC);
                res.Add(oneRes);
            }
            FileUtil.WriteOutputFile(filePath, res, title, WriteMode.Append);
            TaskResultList.Add(new TaskResultEntry(Path.GetFileNameWithoutExtension(filePath), "DROP GEDA File", filePath, FileProcessType.GEDA_BULK_RIC_DELETE));
        }