private void InsertIgwValues(IgwModel igw, Cell igwCell, WorksheetPart worksheetPart) { uint igwRow = (uint)GetRowNumber(igwCell.CellReference); // find incoming & outgoing total Calls & and total mins i.e. C, D, E, F string incomingTotalCallsColumn = ((char)((int)GetColumnName(igwCell.CellReference)[0] + 1)).ToString(); // C string incomingTotalMinsColumn = ((char)((int)GetColumnName(igwCell.CellReference)[0] + 2)).ToString(); // D string outgoingTotalCallsColumn = ((char)((int)GetColumnName(igwCell.CellReference)[0] + 3)).ToString(); // E string outgoingTotalMinsColumn = ((char)((int)GetColumnName(igwCell.CellReference)[0] + 4)).ToString(); // F // Find the cells to be updated using the column & row number Cell incomingTotalCallsCell = ExcelHelper.Instance.InsertCellInWorksheet(incomingTotalCallsColumn, igwRow, worksheetPart); Cell incomingTotalMinsCell = ExcelHelper.Instance.InsertCellInWorksheet(incomingTotalMinsColumn, igwRow, worksheetPart); Cell outgoingTotalCallsCell = ExcelHelper.Instance.InsertCellInWorksheet(outgoingTotalCallsColumn, igwRow, worksheetPart); Cell outgoingTotalMinsCell = ExcelHelper.Instance.InsertCellInWorksheet(outgoingTotalMinsColumn, igwRow, worksheetPart); // Set DataTypes to number incomingTotalCallsCell.DataType = new EnumValue <CellValues>(CellValues.Number); incomingTotalMinsCell.DataType = new EnumValue <CellValues>(CellValues.Number); outgoingTotalCallsCell.DataType = new EnumValue <CellValues>(CellValues.Number); outgoingTotalMinsCell.DataType = new EnumValue <CellValues>(CellValues.Number); // Set values incomingTotalCallsCell.CellValue = new CellValue(igw.TotalCallsIncoming); incomingTotalMinsCell.CellValue = new CellValue(igw.TotalMinsIncoming); //incomingTotalMinsCell.CellFormula = new CellFormula(igw.TotalMinsIncoming); outgoingTotalCallsCell.CellValue = new CellValue(igw.TotalCallsOutgoing); outgoingTotalMinsCell.CellValue = new CellValue(igw.TotalMinsOutgoing); // Save the worksheet. worksheetPart.Worksheet.Save(); }
private void PopulateIgwModels() { igws = new List <IgwModel>(); var sourceNetworks = ( domDataTable.AsEnumerable() .Select(row => row.Field <string>("SourceNetwork")) .ToArray() ); foreach (string sourceNetwork in sourceNetworks) { IgwModel igw = new IgwModel(); igw.SourceNetwork = sourceNetwork; var DomIgwDataRow = domDataTable.AsEnumerable() .Where(row => row.Field <string>("SourceNetwork").Equals(sourceNetwork)) .FirstOrDefault(); if (DomIgwDataRow != null) { igw.TotalCallsIncoming = DomIgwDataRow["CallCount"] == null ? null : DomIgwDataRow["CallCount"].ToString(); igw.TotalMinsIncoming = DomIgwDataRow["BilledDuration"] == null ? null : DomIgwDataRow["BilledDuration"].ToString(); } igw.ExcelDisplayName = GetExcelDisplayName(igw.SourceNetwork); igws.Add(igw); } }