示例#1
0
        public void InputDataToLRProductSheet(ContractInfoBusiness contractInfoBusiness,
                                              string OutPutFolderPath, string yearMonthDay)
        {
            excelApp = new ExcelCore.ExcelCore();
            try
            {
                //contractInfoBusiness.lstLRInsureContModel
                ProcessLogProxy.Normal("Start building LRProduct excel");
                var lstHanReModel          = contractInfoBusiness.lstHanReModel;
                var lstMuReModel           = contractInfoBusiness.lstMuReModel;
                var lstRGAModel            = contractInfoBusiness.lstRGAModel;
                var lstSwissReModel        = contractInfoBusiness.lstSwissReModel;
                var lstHugeDisasterModel   = contractInfoBusiness.lstHugeDisasterModel;
                var lstTEMP_LMProductModel = contractInfoBusiness.lstTEMP_LMProductModel;
                var lstProductInfoModel    = contractInfoBusiness.lstProductInfoModel;
                //var lstTEMP_LMLiabilityModel = contractInfoBusiness.lstTEMP_LMLiabilityModel;
                var           excelPath     = OutPutFolderPath + @"\TEMP_" + ExcelTemplateName.LRProduct + ".xlsx";
                ExcelTemplate excelTemplate = new ExcelTemplate();
                excelTemplate.CreateTemplate(excelApp, excelPath, ExcelTemplateName.LRProduct);
                excelApp.OpenExcel(excelPath, false);
                excelApp.SelectSheet(LRProductSheetName);

                int serialNumber  = 1;
                int startRowIndex = 2;

                this.Test2(lstHanReModel, yearMonthDay, ref serialNumber, ref startRowIndex,
                           lstTEMP_LMProductModel, contractInfoBusiness);
                this.Test2(lstMuReModel, yearMonthDay, ref serialNumber, ref startRowIndex,
                           lstTEMP_LMProductModel, contractInfoBusiness);
                this.Test2(lstRGAModel, yearMonthDay, ref serialNumber, ref startRowIndex,
                           lstTEMP_LMProductModel, contractInfoBusiness);
                this.Test2(lstSwissReModel, yearMonthDay, ref serialNumber, ref startRowIndex,
                           lstTEMP_LMProductModel, contractInfoBusiness);

                foreach (var temp in lstHugeDisasterModel)
                {
                    var tempList = lstTEMP_LMProductModel.Where(e => e.StartDate <= temp.EffectiveDate);

                    var tempModel = (from lmProduct in tempList
                                     join productInfo in lstProductInfoModel
                                     on lmProduct.ProductCode equals productInfo.ProductCode
                                     select new
                    {
                        productCode = lmProduct.ProductCode,
                        productName = lmProduct.ProductName,
                        productType = lmProduct.ProductType,
                        TermType = lmProduct.TermType
                    }).ToList();

                    int contractOrder = 0;
                    foreach (var temp1 in tempModel)
                    {
                        this.Test3(yearMonthDay, serialNumber, startRowIndex, temp, contractOrder,
                                   temp1.productCode, temp1.productName, temp1.productType,
                                   temp1.TermType, contractInfoBusiness);

                        contractOrder += 1;
                        serialNumber++;
                        startRowIndex++;
                    }

                    //foreach (var temp1 in tempModel)
                    //{
                    //    this.Test3(yearMonthDay, serialNumber, ref startRowIndex, temp, contractOrder,
                    //        temp1.productCode, temp1.productName, temp1.productType, temp1.LiabilityCode,
                    //        temp1.TermType, contractInfoBusiness);

                    //    contractOrder += 1;
                    //}
                }
                ProcessLogProxy.SuccessMessage("Build Success");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                excelApp.SetSheetAutoFit(LRProductSheetName);
                excelApp.Save();
                excelApp.Close();
            }
        }