private void PrepareEquipmentBid() { List <EquipmentBid> equipmentBids = new List <EquipmentBid>(); for (int i = 0; i < bids.Count; i++) { equipmentBids.AddRange(bids[i].EquipmentBidCollection.ToList()); } List <EquipmentBidGroup> ebGroup = new List <EquipmentBidGroup>(); for (int i = 0; i < equipmentBids.Count; i++) { EquipmentBidGroup equipmentBidGroup = ebGroup.Where(x => (x.IdEquipment == equipmentBids[i].Id_equipment) && (x.IdModification == equipmentBids[i].Id_modification)).FirstOrDefault(); if (equipmentBidGroup == null) { ebGroup.Add(new EquipmentBidGroup() { EquipmentBid = equipmentBids[i], Count = 1 }); } else { equipmentBidGroup.Count++; } } CreateRows(ebGroup); }
//Отгружено private void IsShipped() { List <EquipmentBid> equipmentBids = new List <EquipmentBid>(); for (int i = 0; i < archiveBid.Count; i++) { equipmentBids.AddRange(archiveBid[i].EquipmentBidCollection.ToList()); } List <EquipmentBidGroup> ebGroup = new List <EquipmentBidGroup>(); for (int i = 0; i < equipmentBids.Count; i++) { EquipmentBidGroup equipmentBidGroup = ebGroup.Where(x => (x.IdEquipment == equipmentBids[i].Id_equipment) && (x.IdModification == equipmentBids[i].Id_modification)).FirstOrDefault(); if (equipmentBidGroup == null) { ebGroup.Add(new EquipmentBidGroup() { EquipmentBid = equipmentBids[i], Count = 1 }); } else { equipmentBidGroup.Count++; } } if (equipmentBids.Count == 0) { return; } ReportRow rowH = new ReportRow(); rowH.Add(new ReportCell("Отгружено:")); Rows.Add(rowH); ReportRow rowT = new ReportRow(); rowT.Add(new ReportCell("Оборудование") { BorderColor = System.Drawing.Color.Black }); rowT.Add(new ReportCell("Модификация") { BorderColor = System.Drawing.Color.Black }); rowT.Add(new ReportCell("Количество") { ColumnSpan = 1, BorderColor = System.Drawing.Color.Black }); Rows.Add(rowT); ebGroup = ebGroup.OrderByDescending(x => x.Count).ToList(); for (int i = 0; i < ebGroup.Count; i++) { EquipmentBid equipmentBid = ebGroup[i].EquipmentBid; ReportRow row = new ReportRow(); row.Add(new ReportCell(equipmentBid.EquipmentName) { VerticalAlignment = VerticalAlignment.Bottom, BorderColor = System.Drawing.Color.Black }); string modificationName = ""; if (equipmentBid.Id_modification != null) { modificationName = equipmentBid.ModificationName; } row.Add(new ReportCell(modificationName) { VerticalAlignment = VerticalAlignment.Bottom, BorderColor = System.Drawing.Color.Black }); row.Add(new ReportCell(ebGroup[i].Count.ToString()) { ColumnSpan = 1, VerticalAlignment = VerticalAlignment.Bottom, BorderColor = System.Drawing.Color.Black }); Rows.Add(row); } }