/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(VolumePerShipper compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
Exemplo n.º 2
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> GetVolumePerLSPImplementation(string Name)
 {
     System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> ChartElement = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper>();
     foreach (var i in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>((a) => a.Shipper == Name) ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>())
     {
         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "API", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, i?.Carrier != "");
         if ((i?.Carrier != ""))
         {
             decimal?OrderVolume = (i?.Get_AggregateVolume() ?? 0);
             var     _var0       = i?.Carrier;
             if ((ChartElement?.Any((a) => a.Description == _var0) ?? false))
             {
                 var _var1 = i?.Carrier;
                 ChartElement.FirstOrDefault((a) => a.Description == i.Carrier).Volume = (ChartElement?.FirstOrDefault((a) => a.Description == _var1)?.Volume ?? 0) + OrderVolume.GetValueOrDefault(0);
             }
             else
             {
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper GraphElement = new DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper();
                 GraphElement.Description = (i?.Carrier ?? "");
                 GraphElement.Volume      = OrderVolume;
                 ChartElement?.Add(GraphElement);
             }
         }
     }
     return(ChartElement);
 }
/// <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 [VolumePerShipper] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual VolumePerShipper Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, VolumePerShipper copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((VolumePerShipper)copiedObjects[this]);
            }
            copy = copy ?? new VolumePerShipper();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.Description = this.Description;
            copy.Volume      = this.Volume;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            return(copy);
        }
Exemplo n.º 4
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> GetVolumePerUnitImplementation(string Name)
 {
     System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> VolumeSpreadChart = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper>();
     foreach (var i in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>((a) => a.Shipper == Name) ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>())
     {
         foreach (var j in i?.PlannedVolume ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.CustomVolume>())
         {
             foreach (var k in j?.VolumeComposition ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumeComposition>())
             {
                 var _var2 = k?.VolumeComponent?.Name;
                 if ((VolumeSpreadChart?.Any((a) => a.Description == _var2) ?? false))
                 {
                     var _var3 = k?.VolumeComponent?.Name;
                     VolumeSpreadChart.FirstOrDefault((a) => a.Description == k.VolumeComponent.Name).Volume = (VolumeSpreadChart?.FirstOrDefault((a) => a.Description == _var3)?.Volume ?? 0) + 1;
                 }
                 else
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper GraphElement = new DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper();
                     GraphElement.Description = (k?.VolumeComponent?.Name ?? "");
                     GraphElement.Volume      = 1;
                     VolumeSpreadChart?.Add(GraphElement);
                 }
             }
         }
     }
     return(VolumeSpreadChart);
 }