public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> GenerateOrders(int?ordersCount) { using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderGenerator", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GenerateOrders")) { System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea> areas = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea>(); System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse> warehouses = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>(); System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> orders = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(); System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> generatedOrders = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(); int?areasNo = (areas?.Count() ?? 0); int?ordersNo = (orders?.Count() ?? 0); int?warehousesNo = (warehouses?.Count() ?? 0); for (var i = 0; i < ordersCount; i = i + 1) { int?randomOrderIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (ordersNo).GetValueOrDefault(0)); DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS tempOrder = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(orders, randomOrderIndex.GetValueOrDefault(0)); DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS copyOrder = tempOrder?.Copy(false, null, true); int?randomAreaIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (areasNo).GetValueOrDefault(0)); DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea selectedGeoArea = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(areas, randomAreaIndex.GetValueOrDefault(0)); copyOrder.OrdDlsAddress = ""; copyOrder.OrdDlsCity = (selectedGeoArea?.Area ?? ""); copyOrder.OrdDlsArea = (selectedGeoArea?.County ?? ""); copyOrder.OrdDlsZipCode = (selectedGeoArea?.PostalCode ?? ""); int?randomWarehouseIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (warehousesNo).GetValueOrDefault(0)); DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse warehouse = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(warehouses, randomWarehouseIndex.GetValueOrDefault(0)); System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent> regionalAgents = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((ra) => ra.AreaSupport.Contains(selectedGeoArea)); int?randomRAIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (regionalAgents?.Count() ?? 0)); DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent regionalAgent = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(regionalAgents, randomRAIndex.GetValueOrDefault(0)); copyOrder.OrdAgencyCode = (regionalAgent?.AgencyCode ?? ""); copyOrder.OrdAgencyAddress = (regionalAgent?.AgencyAddress ?? ""); copyOrder.OrdAgencyDescr = (regionalAgent?.AgencyDescription ?? ""); DateTime?now = DateTime.UtcNow; copyOrder.OrdRegDateTime = now; int?randomDaysAdd = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(1, 100); copyOrder.OrdDeliveryDateTime = (now?.AddDays((randomDaysAdd).GetValueOrDefault(0)) ?? System.Data.SqlTypes.SqlDateTime.MinValue.Value); copyOrder.OrdStatus = 10; generatedOrders?.Add(copyOrder); new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(copyOrder); } return(generatedOrders); } }
public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics> CalculatePoDStats() { using (new zAppDev.DotNet.Framework.Profiling.Profiler("DashboardStatistics", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "CalculatePoDStats")) { System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics> wow = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics>(); DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics stats = new DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics(); stats.InFull = 0; stats.AsOrdered = 0; stats.OnTime = 0; System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery> deliveries = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery>(); foreach (var delivery in deliveries ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery>()) { stats.Supplier = (delivery?.OrderWMS?.OrdDepositorFullName ?? ""); if ((delivery?.QuantityStatus == "In Full")) { stats.InFull = (stats?.InFull ?? 0) + 1; } if ((delivery?.QualityStatus == "As Ordered")) { stats.AsOrdered = (stats?.AsOrdered ?? 0) + 1; } if ((delivery?.DeliveryStatus == "On Time")) { stats.OnTime = (stats?.OnTime ?? 0) + 1; } } stats.TotalDelivered = (deliveries?.Count() ?? 0); wow?.Add(stats); return(wow); } }