Exemplo n.º 1
0
        private static RowModel ParseGecoRow(TableModel table, string CustomerName, int TotalRow)
        {
            int       counter    = 1;
            RowModel  displayRow = new RowModel();
            CellModel cellName   = new CellModel();

            cellName.Value = CustomerName;
            displayRow.Cells.Add(cellName);
            for (int i = 6; i < 43; i += 3)
            {
                var       Row  = ExcelSupport.ReadRow(table, TotalRow);
                CellModel cell = new CellModel();
                if (ExcelSupport.EmptyCellChecker(Row, i))
                {
                    cell.Value = "0";
                }
                else
                {
                    cell.Value = CommonUtils.DeciString(Row.Cells[i].Value);
                    //cell = Common.GetCell(Row, i);
                    Debug.WriteLine(cell.Value);
                }
                counter++;
                displayRow.Cells.Add(cell);
            }
            return(displayRow);
        }
        public static TableModel CogeFetcher(MemoryStream memoryStream)
        {
            ExcelSupport excelSupport     = new ExcelSupport();
            TableModel   CogeTable        = new TableModel();
            TableModel   CogeOut          = new TableModel();
            TableModel   CogeDisplayTable = new TableModel();
            RowsModel    rowsModel        = new RowsModel();

            try
            {
                CogeTable = excelSupport.ExcelTableLoader(memoryStream, "REV_CUST");
                Console.WriteLine("Coge File Loaded");
                CogeDisplayTable = BuildCoge(CogeTable);
                Console.WriteLine("File Decoded");
                CogeOut        = SortTable(CogeDisplayTable);
                CogeOut.Header = CogeDisplayTable.Header;
                CogeOut.Other  = CogeDisplayTable.Other;
                CogeOut.Footer = CogeDisplayTable.Footer;
                return(CogeOut);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }
        public static TableModel CogeFetcher(string path)
        {
            ExcelSupport excelSupport     = new ExcelSupport();
            TableModel   CogeTable        = new TableModel();
            TableModel   CogeDisplayTable = new TableModel();
            bool         filedecoded;

            try
            {
                CogeTable = excelSupport.ExcelTableLoader(path, "REV_CUST");
                {
                    Console.WriteLine("File Loaded");
                }
                CogeDisplayTable = BuildCoge(CogeTable);
                if (CogeDisplayTable == null)
                {
                    filedecoded = false;
                    return(null);
                }
                filedecoded = true;
                Console.WriteLine("File Decoded");
                return(CogeDisplayTable);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }
Exemplo n.º 4
0
        private static List <GecoPosition> DetermineCustomerTotalPositions(TableModel table)
        {
            List <GecoPosition> GecoPostions = new List <GecoPosition>();

            _CustomerRowEnd = ExcelSupport.FindRowByCellContent(table, "Total", 0, _GecoStartRow);
            Debug.WriteLine("Customer End Row :" + _CustomerRowEnd);

            for (int i = _GecoStartRow; i < _CustomerRowEnd + 1; i++)
            {
                GecoPosition gecoPosition = new GecoPosition();
                var          GecoRow      = ExcelSupport.ReadRow(table, i);
                GecoRow = ExcelSupport.CellTyper(GecoRow);
                if (ExcelSupport.EmptyCellChecker(GecoRow, 0))
                {
                }
                else
                {
                    Debug.WriteLine("Customer: " + GecoRow.Cells[0].Value);
                    Debug.WriteLine("Line # :" + i);

                    gecoPosition.CustomerRow  = i;
                    gecoPosition.CustomerName = GecoRow.Cells[0].Value;

                    gecoPosition.TotalRow = ExcelSupport.FindRowByCellContent(table, "Tot.Customer", 1, i);
                    Debug.WriteLine("Cust Total :" + gecoPosition.TotalRow);

                    GecoPostions.Add(gecoPosition);
                    Debug.Write(gecoPosition.CustomerName);
                }
            }
            return(GecoPostions);
        }
 public static bool SaveCogeExcelFile(TableModel tableModel)
 {
     if (ExcelSupport.SaveExcelFile(tableModel, "Coge", "D:\\Data\\"))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
        public static TableModel GecoFetcher(string path)
        {
            ExcelSupport excelSupport     = new ExcelSupport();
            TableModel   GecoTable        = new TableModel();
            TableModel   GecoDisplayTable = new TableModel();
            RowsModel    rowsModel        = new RowsModel();

            try
            {
                GecoTable = excelSupport.ExcelTableLoader(path, "Profit & Loss");
                rowsModel = excelSupport.ExcelTableLoader(path, "Profit & Loss", true);
                Console.WriteLine("Geco File Loaded");
                GecoDisplayTable = BuildGeco(GecoTable);
                Console.WriteLine("File Decoded");
                return(GecoDisplayTable);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }
Exemplo n.º 7
0
        public static TableModel GecoFetcher(MemoryStream memoryStream)
        {
            RowsModel    RowsSorted       = new RowsModel();
            RowModel     rowModel         = new RowModel();
            ExcelSupport excelSupport     = new ExcelSupport();
            TableModel   GecoTable        = new TableModel();
            TableModel   GecoDisplayTable = new TableModel();

            //IList<RowModel> rowsModel;
            try
            {
                GecoTable = excelSupport.ExcelTableLoader(memoryStream, "Profit & Loss");
                Console.WriteLine("Geco File Loaded");
                GecoDisplayTable = BuildGeco(GecoTable);
                Console.WriteLine("File Decoded");
                return(GecoDisplayTable);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }
        public static TableModel BuildCoge(TableModel table)
        {
            TableModel cogeTable = new TableModel();

            _customerRowStart = ExcelSupport.FindRowByCellContent(table, "CUSTOMERS", 0, 0);
            _customerRowEnd   = ExcelSupport.FindRowByCellContent(table, "TOTAL", 0, _customerRowStart);
            try
            {
                for (int i = _customerRowStart; i < _customerRowEnd + 1; i++)
                {
                    var CogeRow = ExcelSupport.ReadRow(table, i, 13);
                    CogeRow = ExcelSupport.SizeRow(CogeRow, 14, 0);
                    CogeRow = ExcelSupport.CellTyper(CogeRow);
                    Debug.WriteLine("Index = " + i);
                    switch (ExcelSupport.EmptyCellChecker(CogeRow, 0))
                    {
                    case true:
                        break;

                    default:
                        if (CogeRow.Cells[0].Value == "CUSTOMERS")
                        {
                            cogeTable.Header = CogeRow;
                            break;
                        }
                        else if ((CogeRow.Cells[0].Value).Contains("TOTAL"))
                        {
                            cogeTable.Footer = CogeRow;
                            break;
                        }
                        else if (CogeRow.Cells[0].Value == "Other customers")
                        {
                            cogeTable.Other = CogeRow;
                            break;
                        }
                        else if ((CogeRow.Cells[0].Value).Contains("Customer "))
                        {
                            break;
                        }
                        else if ((CogeRow.Cells[0].Value).Contains("Other customers, "))
                        {
                            break;
                        }
                        else if ((CogeRow.Cells[0].Value).Contains("ADJUSTMENTS"))
                        {
                            break;
                        }
                        else
                        {
                            cogeTable.Body.Add(CogeRow);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(null);
            }

            return(cogeTable);
        }
Exemplo n.º 9
0
        private static RowModel GetRowData(TableModel table)
        {
            var row = ExcelSupport.GetRow(table, _GecoStartRow);

            return(row != null?GetRowGeco(row, false) : null);
        }
Exemplo n.º 10
0
        private static RowModel GetHeaderRow(TableModel table)
        {
            var row = ExcelSupport.GetRow(table, _GecoMonthHeader);

            return(row != null?GetRowGeco(row, true) : null);
        }