private void AddLine(Order order, int row) { Line line = new Line(); if (ErrorUtil.IsInvoiceNumberOk(monthlyExcelFile.linesRange, row, ColumnsLines.InvoiceNumber)) { line.InvoiceNumber = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.InvoiceNumber); } if (ErrorUtil.CheckRecordType(monthlyExcelFile.linesRange, row, RecordType.line)) { line.RecordType = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.RecordType); } if (LineUtil.CheckUnitPrice(monthlyExcelFile.linesRange, row)) { line.UnitPriceTI = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.UnitPriceTI); } if (LineUtil.CheckQuantity(monthlyExcelFile.linesRange, row)) { line.Quantity = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.Quantity); } if (LineUtil.CheckProductTypeExist(monthlyExcelFile.linesRange, row, catalogExcelFile.range)) { line.ProductCode = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.Product); } line.AMZProductCode = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.AMZProductCode); line.SaleUnitType = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.SaleUnitType); line.BoxesQuantity = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.BoxesQuantity); line.PackageQuantity = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.PackageQuantity); line.Discount = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.Discount); line.DiscountPrecent = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.DiscountPrecent); line.SaleDiscount = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.SaleDiscount); line.SaleDiscountPrecent = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.SaleDiscountPrecent); line.DistrbutionDiscount = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.DistrbutionDiscount); line.DistrbutionDiscountPrecent = ExcelUtil.GetStringValue(monthlyExcelFile.linesRange, row, ColumnsLines.DistrbutionDiscountPrecent); order.Lines.Add(line); recordsToBeDeleted.Add(new RecordToBeDeleted { Record = row, Sheet = Sheets.LinesSheetNumber }); }
private void PassLinesLeft() { Excel.Range range = monthlyExcelFile.linesRange; int length = ExcelUtil.GetLastRow(range.Worksheet); for (int row = 2; row < length; row++) { if (IsAnyCellContainsValue(range, row)) { ErrorUtil.IsInvoiceNumberOk(range, row, ColumnsLines.InvoiceNumber); ErrorUtil.CheckRecordType(range, row, RecordType.line); LineUtil.CheckUnitPrice(range, row); LineUtil.CheckQuantity(range, row); LineUtil.CheckProductTypeExist(range, row, catalogExcelFile.range); } } }