public virtual void RemoveSalesForecastDetails(SalesForecastDetails __item) { if (__item != null) { __item.SalesForecast = null; } }
public virtual void InternalRemoveSalesForecastDetails(SalesForecastDetails __item) { if (__item == null) { return; } salesForecastDetails?.Remove(__item); }
public virtual void InternalAddSalesForecastDetails(SalesForecastDetails __item) { if (__item == null || disableInternalAdditions) { return; } salesForecastDetails?.Add(__item); }
public void SalesForecast_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _orderproposal_orderforecasts_salesforecast = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecast { ImportId = 9695, Status = "OrderForecast_Status", CreatedBy = "OrderForecast_CreatedBy", CreatedOn = now, StartDate = now, EndDate = now, State = "OrderForecast_State", }; var _orderproposal_orderforecasts_salesforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecast { ImportId = 2026, Status = "OrderForecast_Status", CreatedBy = "OrderForecast_CreatedBy", CreatedOn = now, StartDate = now, EndDate = now, State = "OrderForecast_State", }; var _sale_salesforecastdetails_salesforecast = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails { AvgDailyDemandForecast = 222222.22M, ComputedStock = 3408, NewOrder = 8238, ForecastDate = now, Units = 1251, }; var _sale_salesforecastdetails_salesforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails { AvgDailyDemandForecast = 222222.22M, ComputedStock = 5521, NewOrder = 1056, ForecastDate = now, Units = 8559, }; new PersistenceSpecification <DSS1_RetailerDriverStockOptimisation.BO.SalesForecast>(Session) .CheckProperty(p => p.ImportId, 6538) .CheckProperty(p => p.ImportDate, now) .CheckBag(p => p.OrderForecasts, (new List <DSS1_RetailerDriverStockOptimisation.BO.OrderForecast> { _orderproposal_orderforecasts_salesforecast, _orderproposal_orderforecasts_salesforecast2 })) .CheckBag(p => p.SalesForecastDetails, (new List <DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails> { _sale_salesforecastdetails_salesforecast, _sale_salesforecastdetails_salesforecast2 })) .VerifyTheMappings(); }
public virtual void AddSalesForecastDetails(SalesForecastDetails __item) { if (__item == null) { return; } if (__item.SalesForecast != this) { __item.SalesForecast = this; } }
public virtual void SetSalesForecastDetailsAt(SalesForecastDetails __item, int __index) { if (__item == null) { salesForecastDetails[__index].SalesForecast = null; } else { salesForecastDetails[__index] = __item; if (__item.SalesForecast != this) { __item.SalesForecast = this; } } }
public virtual void AddAtIndexSalesForecastDetails(int index, SalesForecastDetails __item) { if (__item == null) { return; } salesForecastDetails?.Insert(index, __item); disableInternalAdditions = true; try { if (__item.SalesForecast != this) { __item.SalesForecast = this; } } finally { disableInternalAdditions = false; } }
public static DSS1_RetailerDriverStockOptimisation.BO.Response ImportImplementation(System.Collections.Generic.List <DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails> salesForecasts) { string message = ""; DSS1_RetailerDriverStockOptimisation.BO.SalesForecast sForecast = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecast(); sForecast.ImportDate = DateTime.UtcNow; foreach (var salesForecast in salesForecasts ?? Enumerable.Empty <DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails>()) { zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "API", DSS1_RetailerDriverStockOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Warehouse: " + (salesForecast?.Warehouse?.Code ?? "")); if ((salesForecast?.Item == null || salesForecast?.Warehouse == null)) { zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "API", DSS1_RetailerDriverStockOptimisation.Hubs.EventsHub.RaiseDebugMessage, "NULL"); message = message + (salesForecast?.Id ?? 0) + " ,"; continue; } var _var0 = salesForecast?.Item?.SKU; DSS1_RetailerDriverStockOptimisation.BO.Item existingItem = new DSS1_RetailerDriverStockOptimisation.DAL.Repository().GetAsQueryable <DSS1_RetailerDriverStockOptimisation.BO.Item>((s) => s.SKU == _var0)?.FirstOrDefault(); var _var1 = salesForecast?.Warehouse?.Code; DSS1_RetailerDriverStockOptimisation.BO.Warehouse existingWarehouse = new DSS1_RetailerDriverStockOptimisation.DAL.Repository().GetAsQueryable <DSS1_RetailerDriverStockOptimisation.BO.Warehouse>((a) => a.Code == _var1)?.FirstOrDefault(); if ((existingItem == null || existingWarehouse == null)) { message = message + (salesForecast?.Id ?? 0) + " ,"; continue; } DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails newSalesForecast = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails(); newSalesForecast.Warehouse = existingWarehouse; newSalesForecast.Item = existingItem; newSalesForecast.ForecastDate = (salesForecast?.ForecastDate ?? System.Data.SqlTypes.SqlDateTime.MinValue.Value); newSalesForecast.Units = (salesForecast?.Units ?? 0); newSalesForecast.SalesForecast = sForecast; new DSS1_RetailerDriverStockOptimisation.DAL.Repository().Save <DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails>(newSalesForecast); } new DSS1_RetailerDriverStockOptimisation.DAL.Repository().Save <DSS1_RetailerDriverStockOptimisation.BO.SalesForecast>(sForecast); if (((((message == null || message == "")) == false))) { zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "API", DSS1_RetailerDriverStockOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Error message: " + message); return(DSS1_RetailerDriverStockOptimisation.BO.ResponseExtensions.GenerateResponse("Failed", "Failed to import the entries with Ids " + message, "", "-1")); } return(DSS1_RetailerDriverStockOptimisation.BO.ResponseExtensions.GenerateResponse("Succeed", "All entries imported successfully.", "", "1")); }
/// <summary> /// Copies the current object to a new instance /// </summary> /// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param> /// <param name="copiedObjects">Objects that should be reused</param> /// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param> /// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param> /// <param name="copy">Optional - An existing [SalesForecastDetails] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual SalesForecastDetails Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, SalesForecastDetails copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((SalesForecastDetails)copiedObjects[this]); } copy = copy ?? new SalesForecastDetails(); if (!asNew) { copy.TransientId = this.TransientId; } copy.AvgDailyDemandForecast = this.AvgDailyDemandForecast; copy.ComputedStock = this.ComputedStock; copy.NewOrder = this.NewOrder; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } if (deep && this.salesForecast != null) { if (!copiedObjects.Contains(this.salesForecast)) { if (asNew && reuseNestedObjects) { copy.SalesForecast = this.SalesForecast; } else if (asNew) { copy.SalesForecast = this.SalesForecast.Copy(deep, copiedObjects, true); } else { copy.salesForecast = this.salesForecast.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.SalesForecast = (SalesForecast)copiedObjects[this.SalesForecast]; } else { copy.salesForecast = (SalesForecast)copiedObjects[this.SalesForecast]; } } } base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy); return(copy); }