Exemplo n.º 1
0
        protected override void Initialize()
        {
            base.Initialize();

            IsEikonExcelDisable = true;
            configObj           = Config as HKSpeedGuideConfig;
            xmlObj = ConfigUtil.ReadConfig(XmlFilePath, typeof(HKSpeedGuideXML)) as HKSpeedGuideXML;
        }
Exemplo n.º 2
0
        private void GetDataFromFolderWarrent(Application xlApp, HKSpeedGuideXML xmlObj, Logger logger)
        {
            string        folderPath = configObj.WarrantFolderPath; //@"D:\HKRicTemplate\Warrant";
            List <string> fileNames  = FileUtil.GetTodayFileNameFromFolder(folderPath);

            if (fileNames != null && fileNames.Count > 0)
            {
                foreach (Workbook wBook in fileNames.Select(fileName => ExcelOperation.OpenWorkBook(xlApp, folderPath, fileName)))
                {
                    warrantDataItem.GetWarrantDataFromWorkBook(wBook, configObj, xmlObj, logger);
                    //wBook.Close(Missing.Value, Missing.Value, Missing.Value);
                }
            }
        }
Exemplo n.º 3
0
        public string GetOrgNameMappingResult(string source, HKSpeedGuideXML xmlObj, Logger logger)
        {
            string mappingResult = "";

            foreach (NameMapping item in xmlObj.NameConfig.Where(item => item.OrganisationName.Equals(source)))
            {
                mappingResult = item.mappingName;
            }
            if (mappingResult.Equals(string.Empty))
            {
                logger.Log(string.Format("Check the xml file, can't find the mapping name according to the source name {0}", source));
            }
            return(mappingResult);
        }
Exemplo n.º 4
0
        private void GetWarrantData(_Worksheet wSheet, HKSpeedGuideXML xmlObj, Logger logger)
        {
            int    rowIndex  = 6;
            string cellValue = wSheet.Range[wSheet.Cells[rowIndex, 1], wSheet.Cells[rowIndex, 1]].Value2.ToString();

            while (cellValue.Equals("+ADDITION+"))
            {
                rowIndex++;
                cellValue = wSheet.Range[wSheet.Cells[rowIndex, 1], wSheet.Cells[rowIndex, 1]].Value2.ToString();
                while (!cellValue.Equals("+ADDITION+"))
                {
                    if (cellValue == "" && wSheet.Range[wSheet.Cells[rowIndex + 1, 1], wSheet.Cells[rowIndex + 1, 1]].Value2 == null && wSheet.Range[wSheet.Cells[rowIndex + 2, 1], wSheet.Cells[rowIndex + 2, 1]].Value2 == null)
                    {
                        break;
                    }
                    string col2Value = "";
                    switch (cellValue)
                    {
                    case "Underlying RIC:":
                        col2Value = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null ? "" : wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                        warrantRic.Add(col2Value);
                        break;

                    case "Organisation Name (DIRNAME):":
                        string formatValue = "";
                        if (wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null)
                        {
                            col2Value = "";
                        }
                        else
                        {
                            col2Value   = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                            formatValue = GetOrgNameMappingResult(col2Value, xmlObj, logger);
                        }
                        if (!formatValue.Equals(("")))
                        {
                            issuer.Add(formatValue);
                        }
                        break;

                    case "GN_TX20_6:":
                        col2Value = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null ? "" : wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                        underlyingRic.Add(col2Value);
                        break;

                    case "ISSUE PRICE:":
                        col2Value = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null ? "" : wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                        issuePrice.Add(col2Value);
                        break;

                    case "WNT_RATIO:":
                        col2Value = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null ? "" : wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                        convRatio.Add(col2Value);
                        break;

                    case "STRIKE_PRC:":
                        col2Value = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null ? "" : wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                        strike.Add(col2Value);
                        break;

                    case "GN_TX20_11:":
                        if (wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2 == null)
                        {
                            col2Value = "";
                        }
                        else
                        {
                            col2Value = wSheet.Range[wSheet.Cells[rowIndex, 2], wSheet.Cells[rowIndex, 2]].Value2.ToString();
                            col2Value = col2Value.Replace("M", "");
                        }
                        issueSize.Add(col2Value);
                        break;
                    }
                    rowIndex++;
                    cellValue = wSheet.Range[wSheet.Cells[rowIndex, 1], wSheet.Cells[rowIndex, 1]].Value2 == null ? "" : wSheet.Range[wSheet.Cells[rowIndex, 1], wSheet.Cells[rowIndex, 1]].Value2.ToString();
                }
                int t = rowIndex;
            }
        }
Exemplo n.º 5
0
 public void GetWarrantDataFromWorkBook(Workbook wBook, HKSpeedGuideConfig configObj, HKSpeedGuideXML xmlObj, Logger logger)
 {
     if (wBook != null)
     {
         Worksheet wSheet = (Worksheet)wBook.Worksheets[1];
         GetWarrantData(wSheet, xmlObj, logger);
     }
 }