Esempio n. 1
0
        public APCFull UsingXMLDocument(XmlDocument xmlDoc)
        {
            XmlNodeList ItemNodes = xmlDoc.SelectNodes("//Resultado");

            APCFull APC = new APCFull();

            Generales[]             arrayG  = new Generales[1];
            Resumen[]               arrayR  = new Resumen[1];
            Detalle[]               arrayD  = new Detalle[1];
            ReferenciasCanceladas[] arrayRC = new ReferenciasCanceladas[1];
            Movimientos[]           arrayM  = new Movimientos[1];


            // Validacion
            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                foreach (XmlNode Item in ItemNode.SelectSingleNode("Validacion"))
                {
                    APC.Valido = Item.InnerText;
                }
            }
            if (APC.Valido == "0")
            {
                APC.Mensaje = "Error en Web Service de APC";
                return(APC);
            }

            // Estatus
            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                foreach (XmlNode Item in ItemNode.SelectSingleNode("Estatus"))
                {
                    APC.Estatus = Item.InnerText;
                }
            }
            if (APC.Estatus == "0")
            {
                APC.Mensaje = "Cliente no existe";
                return(APC);
            }
            APC.Mensaje = "Ok";

            // Generales
            int i = 0;

            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                if (ItemNode.SelectSingleNode("Generales") != null)
                {
                    foreach (XmlNode Item in ItemNode.SelectSingleNode("Generales"))
                    {
                        Generales g = new Generales();
                        foreach (XmlNode Item2 in Item)
                        {
                            switch (Item2.Name)
                            {
                            case "NOMBRE":
                                g.NOMBRE = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "APELLIDO":
                                g.APELLIDO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "IDENT_CLIE":
                                g.IDENT_CLIE = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_CREACION":
                                g.FEC_CREACION = Item2.InnerText.Length > 0 ? APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText) : "";
                                break;

                            case "NOM_ASOC":
                                g.NOM_ASOC = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_DEFUNCION":
                                g.FEC_DEFUNCION = Item2.InnerText.Length > 0 ? APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText) : "";
                                break;
                            }
                        }
                        arrayG[i] = g;
                        i++;
                        Array.Resize <Generales>(ref arrayG, i);
                    }
                }
            }
            APC.GEN = arrayG;

            // Resumen
            i = 0;
            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                if (ItemNode.SelectSingleNode("Resumen") != null)
                {
                    foreach (XmlNode Item in ItemNode.SelectSingleNode("Resumen"))
                    {
                        Resumen g = new Resumen();
                        foreach (XmlNode Item2 in Item)
                        {
                            switch (Item2.Name)
                            {
                            case "RELACION":
                                g.RELACION = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "CANTIDAD":
                                g.CANTIDAD = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "MONTO":
                                g.MONTO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "SALDO_ACTUAL":
                                g.SALDO_ACTUAL = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;
                            }
                        }
                        arrayR[i] = g;
                        i++;
                        Array.Resize <Resumen>(ref arrayR, i + 1);
                    }
                }
            }
            APC.RES = arrayR;


            // Detalle
            i = 0;
            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                if (ItemNode.SelectSingleNode("Detalle") != null)
                {
                    foreach (XmlNode Item in ItemNode.SelectSingleNode("Detalle"))
                    {
                        Detalle g = new Detalle();
                        foreach (XmlNode Item2 in Item)
                        {
                            switch (Item2.Name)
                            {
                            case "NOM_ASOC":
                                g.NOM_ASOC = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "DESCR_CORTA_RELA":
                                g.DESCR_CORTA_RELA = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_INICIO_REL":
                                g.FEC_INICIO_REL = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_FIN_REL":
                                g.FEC_FIN_REL = Item2.InnerText.Length > 0 ? APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText) : "";
                                break;

                            case "MONTO_ORIGINAL":
                                g.MONTO_ORIGINAL = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "NUM_PAGOS":
                                g.NUM_PAGOS = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "DESCR_FORMA_PAGO":
                                g.DESCR_FORMA_PAGO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "IMPORTE_PAGO":
                                g.IMPORTE_PAGO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_ULTIMO_PAGO":
                                g.FEC_ULTIMO_PAGO = Item2.InnerText.Length > 0 ? APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText) : "";
                                break;

                            case "MONTO_ULTIMO_PAGO":
                                g.MONTO_ULTIMO_PAGO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "DESCR_OBS_CORTA":
                                g.DESCR_OBS_CORTA = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "SALDO_ACTUAL":
                                g.SALDO_ACTUAL = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "NUM_DIAS_ATRASO":
                                g.NUM_DIAS_ATRASO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "HISTORIA":
                                g.HISTORIA = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "MONTO_CODIFICADO":
                                g.MONTO_CODIFICADO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_ACTUALIZACION":
                                g.FEC_ACTUALIZACION = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "COD_GRUPO_ECON":
                                g.COD_GRUPO_ECON = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "TIPO_ASOC":
                                g.TIPO_ASOC = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "NUM_REFER":
                                g.NUM_REFER = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;
                            }
                        }
                        arrayD[i] = g;
                        i++;
                        Array.Resize <Detalle>(ref arrayD, i + 1);
                    }
                }
            }
            APC.DET = arrayD;


            // ReferenciasCanceladas
            i = 0;
            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                if (ItemNode.SelectSingleNode("ReferenciasCanceladas") != null)
                {
                    foreach (XmlNode Item in ItemNode.SelectSingleNode("ReferenciasCanceladas"))
                    {
                        ReferenciasCanceladas g = new ReferenciasCanceladas();
                        foreach (XmlNode Item2 in Item)
                        {
                            switch (Item2.Name)
                            {
                            case "NOM_ASOC":
                                g.NOM_ASOC = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "DESCR_CORTA_RELA":
                                g.DESCR_CORTA_RELA = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_INICIO_REL":
                                g.FEC_INICIO_REL = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_FIN_REL":
                                g.FEC_FIN_REL = Item2.InnerText.Length > 0 ? APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText) : "";
                                break;

                            case "MONTO_ORIGINAL":
                                APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC_LIQUIDACION":
                                g.FEC_LIQUIDACION = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "HISTORIA":
                                g.HISTORIA = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "DESCR_OBS_CORTA":
                                g.DESCR_OBS_CORTA = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "MONTO_CODIFICADO":
                                g.MONTO_CODIFICADO = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "NUM_REFER":
                                g.NUM_REFER = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "COD_GRUPO_ECON":
                                g.COD_GRUPO_ECON = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "TIPO_ASOC":
                                g.TIPO_ASOC = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;
                            }
                        }
                        arrayRC[i] = g;
                        i++;
                        Array.Resize <ReferenciasCanceladas>(ref arrayRC, i + 1);
                    }
                }
            }
            APC.REF = arrayRC;


            // Movimientos
            i = 0;
            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                if (ItemNode.SelectSingleNode("Movimientos") != null)
                {
                    foreach (XmlNode Item in ItemNode.SelectSingleNode("Movimientos"))
                    {
                        Movimientos m = new Movimientos();
                        foreach (XmlNode Item2 in Item)
                        {
                            switch (Item2.Name)
                            {
                            case "NOM_ASOC":
                                m.NOM_ASOC = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "FEC1":
                                m.FEC1 = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;

                            case "IDENT_CLIE":
                                m.IDENT_CLIE = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                                break;
                            }
                        }
                        arrayM[i] = m;
                        i++;
                        Array.Resize <Movimientos>(ref arrayM, i + 1);
                    }
                }
            }
            APC.MOV = arrayM;


            // Score
            Score gsc = new Score();

            foreach (XmlNode ItemNode in ItemNodes)
            {
                //TextBox1.Text = ItemNode.Name + " " + ItemNode.InnerXml;
                if (ItemNode.SelectSingleNode("Score") == null)
                {
                    //gsc.SCORE = "-1";
                    //gsc.PI = "-1";
                    //gsc.EXCLUSION = "";

                    //APC.SC = gsc;
                    return(APC);
                }
                foreach (XmlNode Item in ItemNode.SelectSingleNode("Score"))
                {
                    foreach (XmlNode Item2 in Item)
                    {
                        switch (Item2.Name)
                        {
                        case "SCORE":
                            gsc.SCORE = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                            break;

                        case "PI":
                            gsc.PI = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                            break;

                        case "EXCLUSION":
                            gsc.EXCLUSION = APCEncrypt.ScorePlusEncrypt.DecryptString(Item2.InnerText);
                            break;
                        }
                    }
                }
            }
            APC.SC = gsc;

            return(APC);
        }
Esempio n. 2
0
        /// <summary>
        /// Iterating through all the components for slicers, pivot, row fields, and value columns and collecting them in Hash Tables
        /// Passing them to other method wherein all the pivot tables, slicers, and row fields, filters are created based on values from
        /// their hashTables.
        /// </summary>
        /// <param name="InputCSVFolderPath"></param>
        /// <param name="component"></param>
        /// <param name="PivotOutputReportFullPath"></param>
        /// <param name="dSummaryViewComponents"></param>
        /// <param name="htHyperLinks"></param>
        /// <param name="otherNodes"></param>
        private static void GeneratePivotReportForMultipleFiles(
            string InputCSVFolderPath,
            XmlNode component, string PivotOutputReportFullPath,
            ref Dictionary <string, string[]> dSummaryViewComponents,
            ref Hashtable htHyperLinks,
            List <XmlNode> otherNodes)
        {
            StringBuilder exceptionCommentsInfo = new StringBuilder();
            int           numberOfFilesCount    = 1;
            string        sheetName             = string.Empty;

            try
            {
                //Pivot Report - RowFields
                Hashtable htRowPivotfields;
                //Pivot Report - PageFilters
                Hashtable htPivotPageFilters;
                //Pivot Report - PageSlicers
                Hashtable htPageSlicers;

                //Slicers and Dicers HashTables
                Hashtable htComponentSliceandDiceViews = new Hashtable();

                int RowPivotfieldCount = 1, PivotPageFiltersCount = 1;
                int sliceandDiceViewsCount = 1;

                //Get the Components Lists by Reading the Component Tags and Attribute.
                //Example Content Types, Master Pages, etc from Pivot Config XML
                string componentName     = component.Attributes["Name"].InnerText;
                string InputFileName     = component.Attributes["InputFileName"].InnerText;
                string summaryViewColumn = component.Attributes["SummaryViewColumn"].InnerText;
                string description       = component.SelectSingleNode("Description").InnerText;
                string componentSliceAndDiceSheetname = "";

                //Exception Comments
                exceptionCommentsInfo.Append("ComponentName: " + componentName + ", InputFileName: " + InputFileName + ", SummaryViewColumn: " + summaryViewColumn);

                //Read All The INput File CSV for a Component. If Any Components has the multiple Usage or Input File, we are reading all files
                //Example: If Content Type Usage Files are - ContentType_Usage.csv, ContentType_Usage_03112016_035049.csv
                string searchpattern = System.IO.Path.GetFileNameWithoutExtension(InputCSVFolderPath + "\\" + InputFileName);
                searchpattern = searchpattern + "*.csv";
                string[] files = FileUtility.FindAllFilewithSearchPattern(InputCSVFolderPath, searchpattern);

                //Null Check
                if (files != null)
                {
                    if (files.Count() > 0)
                    {
                        foreach (string filePath in files)
                        {
                            string inputCSVFile  = filePath;
                            string inputFileName = filePath.Substring(filePath.LastIndexOf("\\") + 1);

                            htRowPivotfields   = new Hashtable();
                            htPivotPageFilters = new Hashtable();
                            htPageSlicers      = new Hashtable();

                            if (System.IO.File.Exists(inputCSVFile))
                            {
                                //Get Data InputDataSheetName
                                string inputDataSheetName = System.IO.Path.GetFileNameWithoutExtension(filePath);

                                //Deleting columns from csv
                                if (inputDataSheetName == "CThavingFeatureIDTag_Definition_Usage" || inputDataSheetName == "ListTemplates_Usage" || inputDataSheetName == "PreMT_CThavingFeatureIDTag_Definition")
                                {
                                    deleteColumnFromCSV(inputDataSheetName, InputCSVFolderPath, inputCSVFile, inputFileName);
                                }

                                exceptionCommentsInfo.Clear();
                                exceptionCommentsInfo.Append(", InputDataSheetName: " + inputDataSheetName);

                                Excel.Application oApp;
                                Excel.Worksheet   oSheet;
                                Excel.Workbook    oBook = null;

                                oApp = new Excel.Application();

                                try
                                {
                                    oBook = oApp.Workbooks.Open(inputCSVFile);
                                    if (inputDataSheetName.Length >= Constants.SheetNameMaxLength)
                                    {
                                        oSheet = (Excel.Worksheet)oBook.Sheets.get_Item(1);
                                    }
                                    else
                                    {
                                        oSheet = (Excel.Worksheet)oBook.Sheets.get_Item(inputDataSheetName);
                                    }

                                    // Now capture range of the first sheet
                                    Excel.Range oRange = oSheet.UsedRange;

                                    if (oRange.Rows.Count > 1)
                                    {
                                        if (files.Count() > 1)
                                        {
                                            sheetName = componentName + "_" + numberOfFilesCount;
                                            //SliceAndDiceSheet
                                            componentSliceAndDiceSheetname = componentName + "_" + numberOfFilesCount + Constants.SliceAndDiceSheet_Suffix;
                                        }
                                        else
                                        {
                                            sheetName = componentName;
                                            componentSliceAndDiceSheetname = componentName + Constants.SliceAndDiceSheet_Suffix;
                                        }

                                        dSummaryViewComponents.Add(sheetName, new string[] { inputCSVFile, summaryViewColumn });

                                        string pivotCountField = string.Empty; string pivotSliceandDiceCountField = string.Empty;
                                        string slicerStyle = string.Empty;

                                        //Read Item Tags inside the Component Tag, to generate - Pivot and Slice and Dice View
                                        foreach (XmlNode ItemNode in component.SelectNodes("Item"))
                                        {
                                            string itemType = ItemNode.Attributes["Type"].InnerText;

                                            //Create Pivot View
                                            if (itemType == "PivotView")
                                            {
                                                var count = ItemNode.SelectSingleNode("ValueColumn");
                                                pivotCountField = count.Attributes["Name"].InnerText;

                                                var slicerstyle = ItemNode.SelectSingleNode("SlicersStyling");
                                                slicerStyle = slicerstyle.Attributes["Style"].InnerText;

                                                //Row Filter
                                                foreach (XmlNode RowFieldRoot in ItemNode.SelectNodes("Rows"))
                                                {
                                                    foreach (XmlNode rowFeild in RowFieldRoot.ChildNodes)
                                                    {
                                                        string rowPageFieldName = rowFeild.Attributes["Column"].InnerText;
                                                        string rowPageLabel     = rowFeild.Attributes["Label"].InnerText;
                                                        htRowPivotfields.Add(RowPivotfieldCount, rowPageFieldName + "~" + rowPageLabel);
                                                        RowPivotfieldCount++;
                                                    }
                                                }

                                                //Page Filters
                                                foreach (XmlNode FilterFeildRoot in ItemNode.SelectNodes("Filters"))
                                                {
                                                    foreach (XmlNode filterFeild in FilterFeildRoot.ChildNodes)
                                                    {
                                                        string filterName = filterFeild.InnerText;
                                                        htPivotPageFilters.Add(PivotPageFiltersCount, filterName);
                                                        PivotPageFiltersCount++;
                                                    }
                                                }

                                                //Slicers
                                                foreach (XmlNode SlicersRoot in ItemNode.SelectNodes("Slicers"))
                                                {
                                                    int i = 0;
                                                    i = SlicersRoot.ChildNodes.Count - 1;
                                                    foreach (XmlNode SlicersRootFeild in SlicersRoot.ChildNodes)
                                                    {
                                                        string slicerName = SlicersRootFeild.InnerText;
                                                        htPageSlicers.Add(i, slicerName + "~" + slicerStyle);
                                                        i--;
                                                    }
                                                }
                                            }

                                            //Create Slice and Dice View Sheet
                                            if (itemType == "SliceDiceView")
                                            {
                                                //Loop views for each Component
                                                foreach (XmlNode viewsNode in ItemNode.SelectNodes("Views"))
                                                {
                                                    foreach (XmlNode viewNode in viewsNode.ChildNodes)
                                                    {
                                                        htComponentSliceandDiceViews.Add(inputDataSheetName + sliceandDiceViewsCount, viewNode.OuterXml);
                                                        sliceandDiceViewsCount++;
                                                    }
                                                }
                                            }
                                        }

                                        //Pivot Sheet
                                        string componentPivotSheetName = sheetName;
                                        //Length of Sheet Name Should be less than 31 Char
                                        if (componentPivotSheetName.Length >= Constants.SheetNameMaxLength)
                                        {
                                            componentPivotSheetName = componentPivotSheetName.Substring(0, Constants.SheetNameMaxLength);
                                        }


                                        //Length of Sheet Name Should be less than 31 Char
                                        if (componentSliceAndDiceSheetname.Length >= Constants.SheetNameMaxLength)
                                        {
                                            componentSliceAndDiceSheetname = componentSliceAndDiceSheetname.Substring(0, Constants.SheetNameMaxLength);
                                        }

                                        //Create Pivot View and Slicer View Sheet
                                        PivotViewHelper.GeneratePivotAndSlicersView(inputCSVFile, PivotOutputReportFullPath, ref componentPivotSheetName, inputDataSheetName, componentPivotSheetName, htRowPivotfields, htPivotPageFilters, htPageSlicers, pivotCountField, component, numberOfFilesCount, otherNodes);

                                        htHyperLinks.Add(sheetName + "~" + inputFileName, description);

                                        RowPivotfieldCount     = 1;
                                        PivotPageFiltersCount  = 1;
                                        htPageSlicers          = null;
                                        htPivotPageFilters     = null;
                                        htRowPivotfields       = null;
                                        sliceandDiceViewsCount = 1;
                                        numberOfFilesCount    += 1;
                                    }
                                    else
                                    {
                                        Logger.LogInfoMessage(string.Format("[GeneratePivotReports][GeneratePivotReportForMultipleFiles]" + " No records available for the component " + componentName + " in file " + inputDataSheetName), true);
                                    }

                                    object misValue = System.Reflection.Missing.Value;
                                    oBook.Close(false, misValue, misValue);

                                    oApp.Application.Quit();
                                    oApp.Quit();

                                    Marshal.ReleaseComObject(oSheet);
                                    Marshal.ReleaseComObject(oBook);
                                }
                                catch (Exception ex)
                                {
                                    if (oBook != null)
                                    {
                                        oBook.Close();
                                    }

                                    if (oApp != null)
                                    {
                                        oApp.Quit();
                                        oApp.Application.Quit();
                                    }

                                    Marshal.ReleaseComObject(oBook);

                                    Logger.LogErrorMessage(string.Format("[GeneratePivotReports][GeneratePivotReportForMultipleFiles][Exception]: " + ex.Message), true);
                                    ExceptionCsv.WriteException(Constants.NotApplicable, Constants.NotApplicable, Constants.NotApplicable, "Pivot", ex.Message, ex.ToString(),
                                                                "[GeneratePivotReports]: GeneratePivotReportForMultipleFiles", ex.GetType().ToString(), "ExceptionCommentsInfo: " + exceptionCommentsInfo);
                                }
                                finally
                                {
                                    Marshal.ReleaseComObject(oApp);
                                    oApp = null;

                                    GC.Collect();
                                    GC.WaitForPendingFinalizers();
                                }

                                if (inputDataSheetName == "CThavingFeatureIDTag_Definition_Usage" || inputDataSheetName == "ListTemplates_Usage" || inputDataSheetName == "PreMT_CThavingFeatureIDTag_Definition")
                                {
                                    string path1 = InputCSVFolderPath + @"\" + "Backup";
                                    //copy file to backup folder
                                    string destCSVFile1 = path1 + @"\" + inputFileName;
                                    System.IO.File.Copy(destCSVFile1, inputCSVFile, true);

                                    DeleteFolderAndFiles(path1);
                                }
                            }
                            else
                            {
                                string ErrorMessage = "[GeneratePivotReports][GeneratePivotReportForMultipleFiles] File Not Found Error: Input CSV file is not present in path:" + inputCSVFile + ", ExceptionCommentsInfo: " + exceptionCommentsInfo;

                                Logger.LogErrorMessage(ErrorMessage, true);
                                ExceptionCsv.WriteException(Constants.NotApplicable, Constants.NotApplicable, Constants.NotApplicable, "Pivot", "File Not Found", ErrorMessage,
                                                            "[GeneratePivotReports]: GeneratePivotReportForMultipleFiles", "File Not Found", "Input CSV File (" + inputCSVFile + ")");
                            }
                        }
                    }
                    else
                    {
                        string ErrorMessage = "[GeneratePivotReports][GeneratePivotReportForMultipleFiles] File Not Found Error: Input CSV file is not present in path:" + InputCSVFolderPath + "\\" + InputFileName + ", " + exceptionCommentsInfo;
                        Logger.LogErrorMessage(ErrorMessage, true);
                        ExceptionCsv.WriteException(Constants.NotApplicable, Constants.NotApplicable, Constants.NotApplicable, "Pivot", "File Not Found", ErrorMessage,
                                                    "[GeneratePivotReports]: GeneratePivotReportForMultipleFiles", "File Not Found", "Input CSV File (" + InputCSVFolderPath + "\\" + InputFileName + ")");
                    }
                }
                else
                {
                    string ErrorMessage = "[GeneratePivotReports][GeneratePivotReportForMultipleFiles] File Not Found Error: Input CSV file is not present in path InputCSVFolderPath: " + InputCSVFolderPath + ", SearchPattern: " + searchpattern + ", " + exceptionCommentsInfo;
                    Logger.LogErrorMessage(ErrorMessage, true);
                }
            }
            catch (Exception ex)
            {
                Logger.LogErrorMessage(string.Format("[GeneratePivotReports][GeneratePivotReportForMultipleFiles][Exception]: " + ex.Message + ", ExceptionCommentsInfo: " + exceptionCommentsInfo), true);
                ExceptionCsv.WriteException(Constants.NotApplicable, Constants.NotApplicable, Constants.NotApplicable, "Pivot", ex.Message, ex.ToString(),
                                            "[GeneratePivotReports]: GeneratePivotReportForMultipleFiles", ex.GetType().ToString(), exceptionCommentsInfo.ToString());
            }
        }