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);
        }
Exemplo n.º 2
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 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);
        }