private void fillEditableTable(WaresTypes waresTypes) { var isTare = waresTypes == WaresTypes.Tare; var table = isTare ? Document.TareInfo : Document.NomenclatureInfo; list = new List<NomenclatureData>(); if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { long nomemclatureId = (long)row[isTare ? Document.Tare : Document.Nomenclature]; string nomenclatureDescription = null; bool withoutTray = false; var shelfLifeDays = 0; var unitsQuantityPerPallet = 0; if (isTare) { nomenclatureDescription = FastInputDataCache.GetCashedData(typeof(Nomenclature).Name).GetDescription(nomemclatureId); } else { var nomenclature = new Nomenclature() { ReadingId = nomemclatureId }; nomenclatureDescription = nomenclature.Description; shelfLifeDays = nomenclature.ShelfLife; unitsQuantityPerPallet = nomenclature.UnitsQuantityPerPallet; withoutTray = nomenclature.WithoutTray; } NomenclatureData element = new NomenclatureData { LineNumber = Convert.ToInt64(row["LineNumber"]), Description = new ObjectValue(nomenclatureDescription, nomemclatureId), ShelfLifeDays = shelfLifeDays, UnitsAmountInOneStandartPallet = unitsQuantityPerPallet, WithoutTray = withoutTray }; element.Quantity = Convert.ToInt32(row[isTare ? Document.TareCount : Document.NomenclatureCount]); if (!isTare) { Parties party = new Parties() { ReadingId = row[Document.NomenclatureParty] }; element.Date = party.DateOfManufacture; element.UpdatePalletQuantity(); } list.Add(element); } } else if (isTare) { computeTare(); } }
private void fillEditableTable(WaresTypes waresTypes) { var isTare = waresTypes == WaresTypes.Tare; var table = isTare ? Document.TareInfo : Document.NomenclatureInfo; list = new List <NomenclatureData>(); if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { long nomemclatureId = (long)row[isTare ? Document.Tare : Document.Nomenclature]; string nomenclatureDescription = null; bool withoutTray = false; var shelfLifeDays = 0; var unitsQuantityPerPallet = 0; if (isTare) { nomenclatureDescription = FastInputDataCache.GetCashedData(typeof(Nomenclature).Name).GetDescription(nomemclatureId); } else { var nomenclature = new Nomenclature() { ReadingId = nomemclatureId }; nomenclatureDescription = nomenclature.Description; shelfLifeDays = nomenclature.ShelfLife; unitsQuantityPerPallet = nomenclature.UnitsQuantityPerPallet; withoutTray = nomenclature.WithoutTray; } NomenclatureData element = new NomenclatureData { LineNumber = Convert.ToInt64(row["LineNumber"]), Description = new ObjectValue(nomenclatureDescription, nomemclatureId), ShelfLifeDays = shelfLifeDays, UnitsAmountInOneStandartPallet = unitsQuantityPerPallet, WithoutTray = withoutTray }; element.Quantity = Convert.ToInt32(row[isTare ? Document.TareCount : Document.NomenclatureCount]); if (!isTare) { Parties party = new Parties() { ReadingId = row[Document.NomenclatureParty] }; element.Date = party.DateOfManufacture; element.UpdatePalletQuantity(); } list.Add(element); } } else if (isTare) { computeTare(); } }
private void choseWare(WaresTypes waresTypes) { var isProductuin = waresTypes == WaresTypes.Production; setVisibilityForMainColumns(true); if (isProductuin) { waresButton.Enabled = false; tareButton.Enabled = true; tareList = list; if (waresList != null) { list = waresList; } else { fillEditableTable(waresTypes); waresList = list; } shelfLifeDaysGridColumn.RowIndex = 1; nonStandartPalletsCountColumn.RowIndex = 1; nonStandartPalletCountPer1Column.RowIndex = 1; unitsOnNotFullNonStandartPalletColumn.RowIndex = 1; } else { tareButton.Enabled = false; waresButton.Enabled = true; waresList = list; if (tareList != null) { list = tareList; } else { fillEditableTable(waresTypes); tareList = list; } } dateColumn.Visible = isProductuin; shelfLifeDaysGridColumn.Visible = isProductuin; standartPalletsCountColumn.Visible = isProductuin; nonStandartPalletsCountColumn.Visible = isProductuin; standartPalletCountPer1Column.Visible = isProductuin; nonStandartPalletCountPer1Column.Visible = isProductuin; unitsOnNotFullPalletColumn.Visible = isProductuin; unitsOnNotFullNonStandartPalletColumn.Visible = isProductuin; palletsCountButton.Enabled = isProductuin; grid.DataSource = list; editControlsArea.Controls.Clear(); updateVerticalScrollVisibility(); editControlsArea.Controls.Add(scrollUp); editControlsArea.Controls.Add(scrollDown); updateSelectedRowInfo(); }
private void choseWare(WaresTypes waresTypes) { var isProductuin = waresTypes == WaresTypes.Production; setVisibilityForMainColumns(true); if (isProductuin) { waresButton.Enabled = false; tareButton.Enabled = true; tareList = list; if (waresList != null) { list = waresList; } else { fillEditableTable(waresTypes); waresList = list; } shelfLifeDaysGridColumn.RowIndex = 1; nonStandartPalletsCountColumn.RowIndex = 1; nonStandartPalletCountPer1Column.RowIndex = 1; unitsOnNotFullNonStandartPalletColumn.RowIndex = 1; } else { tareButton.Enabled = false; waresButton.Enabled = true; waresList = list; if (tareList != null) { list = tareList; } else { fillEditableTable(waresTypes); tareList = list; } } dateColumn.Visible = isProductuin; shelfLifeDaysGridColumn.Visible = isProductuin; standartPalletsCountColumn.Visible = isProductuin; nonStandartPalletsCountColumn.Visible = isProductuin; standartPalletCountPer1Column.Visible = isProductuin; nonStandartPalletCountPer1Column.Visible = isProductuin; unitsOnNotFullPalletColumn.Visible = isProductuin; unitsOnNotFullNonStandartPalletColumn.Visible = isProductuin; palletsCountButton.Enabled = isProductuin; grid.DataSource = list; editControlsArea.Controls.Clear(); updateVerticalScrollVisibility(); editControlsArea.Controls.Add(scrollUp); editControlsArea.Controls.Add(scrollDown); updateSelectedRowInfo(); }