//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));
        }
Ejemplo n.º 2
0
        private ProductionXmlFileTemplate getSpeedGuideXmlFileContent(Workbook warGuideBWorkbook)
        {
            var       template      = new ProductionXmlFileTemplate();
            Worksheet insertV3Sheet = ExcelUtil.GetWorksheet(configObj.WorksheetWarrantGuideBInsertV3, warGuideBWorkbook);

            if (insertV3Sheet == null)
            {
                LogMessage(string.Format("There's no worksheet {0} in workbook {1}", configObj.WorksheetWarrantGuideBInsertV3, warGuideBWorkbook.FullName));
            }

            int lastAddedRicNum;

            for (int i = 86; i < 1966; i++)
            {
                if (i % 20 == 6)
                {
                    Core.Ric ric = new Core.Ric {
                        Name = string.Format("HK/WTS{0}", (i / 20 + 2).ToString("D2"))
                    };
                    template.rics.rics.Add(ric);
                }

                Fid fid = new Fid {
                    Id = ((i - 86) % 20) + 319, Value = getFidValue(insertV3Sheet, i)
                };

                lastAddedRicNum = template.rics.rics.Count - 1;
                template.rics.rics[lastAddedRicNum].fids.Add(fid);
            }
            return(template);
        }
Ejemplo n.º 3
0
        private ProductionXmlFileTemplate GetHKMAINSSXmlFileContent(Worksheet worksheet)
        {
            ProductionXmlFileTemplate template = new ProductionXmlFileTemplate();
            int lastAddedRicNum = 0;
            // the default id value of the first fid node in each ric node
            int lastStartId = 316;
            // the start row of the range which will be copied from the HKMAINSSExcel file to the HKMAINSSXml file
            int startRow = (configObj.HKMAINSS_CONFIG_StartPage - 1) * configObj.HKMAINSS_CONFIG_LineNum + 1;
            // the end row of the range which will be copied from the HKMAINSSExcel file to the HKMAINSSXml file
            int endRow = configObj.HKMAINSS_CONFIG_TotalPage * configObj.HKMAINSS_CONFIG_LineNum;

            //copy the records whose Range is from startRow to endRow in the HKMAINSSExcel file
            for (int i = startRow; i <= endRow; i++)
            {
                if ((i - startRow) % configObj.HKMAINSS_CONFIG_LineNum == 0)
                {
                    lastAddedRicNum = template.rics.rics.Count - 1;

                    Core.Ric ric = new Core.Ric();
                    ric.Name = string.Format("HK/MAINSS{0}", (((i - startRow) / configObj.HKMAINSS_CONFIG_LineNum) + configObj.HKMAINSS_CONFIG_StartPage).ToString("D2"));
                    template.rics.rics.Add(ric);

                    if (lastAddedRicNum >= 0)
                    {
                        Fid lastFid = new Fid();
                        lastFid.Id = 339;
                        string continuedPageDescription = "Continued on <" + template.rics.rics[lastAddedRicNum + 1].Name + ">";
                        continuedPageDescription = continuedPageDescription.PadLeft(recordTotalLength);
                        lastFid.Value            = string.Format("\"{0}\"", continuedPageDescription);
                        template.rics.rics[lastAddedRicNum].fids.Add(lastFid);
                    }
                }

                if ((i - startRow) % configObj.HKMAINSS_CONFIG_LineNum == 3)
                {
                    lastStartId = 315;
                    continue;
                }

                Fid fid = new Fid();
                fid.Id = lastStartId + (i - startRow) % configObj.HKMAINSS_CONFIG_LineNum;
                string colValue = GetFormatedValue(i, worksheet);
                fid.Value = string.Format("\"{0}\"", colValue);

                lastAddedRicNum = template.rics.rics.Count - 1;
                template.rics.rics[lastAddedRicNum].fids.Add(fid);

                if ((i - startRow) % configObj.HKMAINSS_CONFIG_LineNum == (configObj.HKMAINSS_CONFIG_LineNum - 1))
                {
                    lastStartId = 316;
                }
            }
            return(template);
        }
Ejemplo n.º 4
0
        private ProductionXmlFileTemplate GetGemssXmlFileContent(Worksheet gemssWorksheet)
        {
            ProductionXmlFileTemplate template = new ProductionXmlFileTemplate();
            int lastAddedRicNum = 0;

            for (int i = 1; i <= 240; i++)
            {
                if (i % 24 == 1)
                {
                    lastAddedRicNum = template.rics.rics.Count - 1;
                    if (lastAddedRicNum > 0)
                    {
                        Fid lastFid = new Fid();
                        lastFid.Id    = 339;
                        lastFid.Value = string.Format("\"Continued on <{0}>\"", template.rics.rics[lastAddedRicNum].Name);
                    }
                    Core.Ric ric = new Core.Ric();
                    ric.Name = string.Format("HK/GEMSS{0}", (i / 24 + 1).ToString("D2"));
                    template.rics.rics.Add(ric);
                }

                if (i % 24 == 0)
                {
                    continue;
                }

                Fid fid = new Fid();
                fid.Id = 316 + (i - 1) % 24;
                if (ExcelUtil.GetRange(i, 1, gemssWorksheet).Text != null)
                {
                    fid.Value = string.Format("\"{0}\"", ExcelUtil.GetRange(i, 1, gemssWorksheet).Text.ToString());
                    if (fid.Value == "\" \"")
                    {
                        fid.Value = " ".PadLeft(recordTotalLength);
                        fid.Value = "\"" + fid.Value + "\"";
                    }
                }
                else
                {
                    fid.Value = string.Format("\"{0}\"", " ".PadLeft(recordAlignrightLength));
                }

                lastAddedRicNum = template.rics.rics.Count - 1;
                template.rics.rics[lastAddedRicNum].fids.Add(fid);
            }
            return(template);
        }