public static ArrayList GetMovementLines(int productId) { string sql = "SELECT [Date], Quantity AS Arrived, 0 AS Dispatched FROM ArrivalDetails WHERE ProductId = " + productId.ToString(); sql += " UNION "; sql += " SELECT [Date], 0 AS Arrived, Quantity AS Dispatched FROM Sales WHERE ProductId = " + productId.ToString(); DataTable dt = ZFort.DB.Execute.ExecuteString_DataTable(sql); ArrayList al = new ArrayList(); foreach (DataRow dr in dt.Rows) { MovementDetails det = new MovementDetails(); if (!dr.IsNull("Arrived")) { det.Arrived = Convert.ToInt32(dr["Arrived"]); } if (!dr.IsNull("Dispatched")) { det.Dispatched = Convert.ToInt32(dr["Dispatched"]); } if (!dr.IsNull("Date")) { det.Date = Convert.ToDateTime(dr["Date"]); } al.Add(det); } return(al); }
private void SetQuantity(MovementDetails movementDetails, QuantityFormatter quantityFormatter) { var displayString = quantityFormatter.QuantityToStringWithUnits(movementDetails.ActualQuantity.Quantity, movementDetails.ActualQuantity.Units); switch (movementDetails.ActualQuantity.Units) { case ShipmentQuantityUnits.Kilograms: ActualKilograms = displayString; break; case ShipmentQuantityUnits.CubicMetres: ActualCubicMetres = displayString; break; case ShipmentQuantityUnits.Litres: ActualLitres = displayString; break; case ShipmentQuantityUnits.Tonnes: ActualTonnes = displayString; break; default: break; } }
public MovementBlock(IList <MergeField> mergeFields, Movement movement, MovementDetails movementDetails, NotificationApplication notification, ShipmentInfo shipmentInfo) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new MovementViewModel( movement, movementDetails, notification, shipmentInfo, new DateTimeFormatter(), new QuantityFormatter(), new PhysicalCharacteristicsFormatter(), new PackagingTypesFormatter()); }
public MovementBlock(IList<MergeField> mergeFields, Movement movement, MovementDetails movementDetails, NotificationApplication notification, ShipmentInfo shipmentInfo) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new MovementViewModel( movement, movementDetails, notification, shipmentInfo, new DateTimeFormatter(), new QuantityFormatter(), new PhysicalCharacteristicsFormatter(), new PackagingTypesFormatter()); }
public MovementViewModel(Movement movement, MovementDetails movementDetails, NotificationApplication notification, ShipmentInfo shipmentInfo, DateTimeFormatter dateTimeFormatter, QuantityFormatter quantityFormatter, PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter, PackagingTypesFormatter packagingTypesFormatter) { if (notification == null) { return; } NotificationNumber = notification.NotificationNumber ?? string.Empty; IsSpecialHandling = notification.HasSpecialHandlingRequirements.GetValueOrDefault(); IsNotSpecialHandling = !notification.HasSpecialHandlingRequirements.GetValueOrDefault(true); PhysicalCharacteristics = physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString(notification.PhysicalCharacteristics); IntendedNumberOfShipments = (shipmentInfo == null) ? "0" : shipmentInfo.NumberOfShipments.ToString(); IsRecovery = notification.NotificationType == NotificationType.Recovery; IsDisposal = notification.NotificationType == NotificationType.Disposal; CA = CompetentAuthorityFormatter.GetCompetentAuthority(notification.CompetentAuthority); if (movement == null) { return; } Number = movement.Number.ToString(); if (movementDetails == null) { return; } ActualDate = dateTimeFormatter.DateTimeToDocumentFormatString(movement.Date); SetQuantity(movementDetails, quantityFormatter); PackagingTypes = packagingTypesFormatter.PackagingTypesToCommaDelimitedString(movementDetails.PackagingInfos); }
public MovementCarrierBlock(IList<MergeField> mergeFields, MovementDetails movementDetails) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new MovementCarriersViewModel(new List<MovementCarrier>()); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); }
public MovementViewModel(Movement movement, MovementDetails movementDetails, NotificationApplication notification, ShipmentInfo shipmentInfo, DateTimeFormatter dateTimeFormatter, QuantityFormatter quantityFormatter, PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter, PackagingTypesFormatter packagingTypesFormatter) { if (notification == null) { return; } NotificationNumber = notification.NotificationNumber ?? string.Empty; IsSpecialHandling = notification.HasSpecialHandlingRequirements.GetValueOrDefault(); IsNotSpecialHandling = !notification.HasSpecialHandlingRequirements.GetValueOrDefault(true); PhysicalCharacteristics = physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString(notification.PhysicalCharacteristics); IntendedNumberOfShipments = (shipmentInfo == null) ? "0" : shipmentInfo.NumberOfShipments.ToString(); IsRecovery = notification.NotificationType == NotificationType.Recovery; IsDisposal = notification.NotificationType == NotificationType.Disposal; if (movement == null) { return; } Number = movement.Number.ToString(); if (movementDetails == null) { return; } ActualDate = dateTimeFormatter.DateTimeToDocumentFormatString(movement.Date); SetQuantity(movementDetails, quantityFormatter); PackagingTypes = packagingTypesFormatter.PackagingTypesToCommaDelimitedString(movementDetails.PackagingInfos); }