Exemplo n.º 1
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OverHeadCost?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CalculatedTimeCost?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CalculatedDistanceCost?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CalculatedOwnershipCost?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (VehiculeType?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Volume?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CO2perKm?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AmortizationType?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (MaximumLoad?.GetHashCode() ?? 0);
            return(hashCode);
        }
Exemplo n.º 2
0
/// <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(AmortizationType compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
Exemplo n.º 3
0
/// <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 [AmortizationType] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual AmortizationType Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, AmortizationType copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((AmortizationType)copiedObjects[this]);
            }
            copy = copy ?? new AmortizationType();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.Label = this.Label;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            return(copy);
        }
        public void Vehicule_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _vehiculebo_distancecosts_vehicule = new DSS3_LogisticsPoolingForUrbanDistribution.BO.DistanceCosts
            {
                TotalDistanceDriven  = 222222.22M,
                TotalDistanceService = 222222.22M,
                OilCost              = 222222.22M,
                OilConsumption       = 222222.22M,
                TireCost             = 222222.22M,
                YearlyReparationCost = 222222.22M,
                Cost            = 222222.22M,
                TireConsumption = 222222.22M,
            };
            var _vehiculebo_timecosts_vehicule = new DSS3_LogisticsPoolingForUrbanDistribution.BO.TimeCosts
            {
                DriverSalary               = 222222.22M,
                DriverWorkHours            = 222222.22M,
                DriverServiceHours         = 222222.22M,
                VehiculeHoursPerDay        = 222222.22M,
                VehiculeDaysPerYear        = 222222.22M,
                RoadTax                    = 222222.22M,
                VehiculeInsurance          = 222222.22M,
                GoodsInssurance            = 222222.22M,
                Maintainance               = 222222.22M,
                DaysOfReplacementVehicules = 222222.22M,
                CostOfReplacement          = 222222.22M,
                Cost = 222222.22M,
            };
            var _vehiculebo_ownershipcost_vehicule = new DSS3_LogisticsPoolingForUrbanDistribution.BO.OwnershipCost
            {
                VehiculePurchaseCost     = 222222.22M,
                RefrigerationSystemCost  = 222222.22M,
                LetteringCost            = 222222.22M,
                InterestRate             = 222222.22M,
                PaybackPeriod            = 222222.22M,
                TotalDistancePerVehicule = 222222.22M,
                AmortizationPeriod       = 222222.22M,
                ResidualValue            = 222222.22M,
                UtilizationPeriod        = 222222.22M,
                Cost = 222222.22M,
            };
            var _vehiculebo_amortizationtype1_vehicule = new DSS3_LogisticsPoolingForUrbanDistribution.BO.AmortizationType
            {
                Label = "AmortizationType_Label",
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.Vehicule>(Session)
            .CheckProperty(p => p.OverHeadCost, 222222.22M)
            .CheckProperty(p => p.CalculatedTimeCost, 222222.22M)
            .CheckProperty(p => p.CalculatedDistanceCost, 222222.22M)
            .CheckProperty(p => p.CalculatedOwnershipCost, 222222.22M)
            .CheckProperty(p => p.VehiculeType, "Vehicule_VehiculeType")
            .CheckProperty(p => p.Volume, "Vehicule_Volume")
            .CheckProperty(p => p.CO2perKm, 222222.22M)
            .CheckProperty(p => p.AmortizationType, "Vehicule_AmortizationType")
            .CheckProperty(p => p.MaximumLoad, 222222.22M)
            .CheckReference(p => p.DistanceCosts, _vehiculebo_distancecosts_vehicule)
            .CheckReference(p => p.TimeCosts, _vehiculebo_timecosts_vehicule)
            .CheckReference(p => p.OwnershipCost, _vehiculebo_ownershipcost_vehicule)
            .CheckReference(p => p.AmortizationType1, _vehiculebo_amortizationtype1_vehicule)
            .VerifyTheMappings();
        }