Esempio n. 1
0
        public DomainResponseDto <Rent> FinishRent(decimal damageFee = 0, decimal discount = 0)
        {
            if (IsFinished)
            {
                return(DomainValidations.Failure <Rent>("Already finished: " + LastModificationTime?.FormatDate()));
            }

            var wasProductsDamaged = damageFee != 0M;

            if (wasProductsDamaged)
            {
                AddDamageFee(damageFee);
            }

            var hasDiscount = discount != 0M;

            if (hasDiscount)
            {
                AddDiscount(discount);
            }

            Status = RentStatus.Closed;

            return(this.GetSuccessResponse("RentFinished"));
        }
 /// <summary>
 /// Equality method between two objects of the same type.
 /// Because the Equals method is strongly typed by generic constraints,
 /// it is not necessary to test for the correct object type.
 /// For safety we just want to match on business key value - in this case the fields
 /// that cannot be different between the two objects if they are supposedly equal.
 /// </summary>
 /// <param name="obj">The other object of this type that we are testing equality with</param>
 /// <returns></returns>
 public virtual bool Equals(GetDetailOutputDtoBase <TIdType> obj)
 {
     if (obj != null)
     {
         return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) &&
                DescriptionShort.Equals(obj.DescriptionShort) &&
                CreationTime.Equals(obj.CreationTime) &&
                CreatorUserName.Equals(obj.CreatorUserName) &&
                LastModifierUserName.Equals(obj.LastModifierUserName) &&
                LastModificationTime.Equals(obj.LastModificationTime)
                );
     }
     return(false);
 }
Esempio n. 3
0
 /// <summary> 
 /// Computes and retrieves a hash code for an object. 
 /// </summary> 
 /// <remarks> 
 /// This method implements the <see cref="Object">Object</see> method. 
 /// </remarks> 
 /// <returns>A hash code for an object.</returns>
 public override int GetHashCode()
 {
     return
         (TenantId.GetHashCode()
          + CreatorUserId.GetHashCode()
          + CreationTime.GetHashCode()
          + Name.GetHashCode()
          + DescriptionFull.GetHashCode()
          + DescriptionShort.GetHashCode()
          + LastModifierUserId.GetHashCode()
          + LastModificationTime.GetHashCode()
          + DeletionTime.GetHashCode()
          + DeleterUserId.GetHashCode()
         );
 }
 /// <summary>
 /// Equality method between two objects of the same type.
 /// Because the Equals method is strongly typed by generic constraints,
 /// it is not necessary to test for the correct object type.
 /// For safety we just want to match on business key value - in this case the fields
 /// that cannot be different between the two objects if they are supposedly equal.
 /// </summary>
 /// <param name="obj">The other object of this type that we are testing equality with</param>
 /// <returns></returns>
 public virtual bool Equals(GetAllInputDtoBase <TIdType> obj)
 {
     if (obj != null)
     {
         return(Name.Equals(obj.Name) && Culture.Equals(obj.Culture) && TenantId.Equals(obj.TenantId) &&
                DescriptionShort.Equals(obj.DescriptionShort) &&
                DescriptionFull.Equals(obj.DescriptionFull) &&
                IsActive.Equals(obj.IsActive) &&
                CreationTime.Equals(obj.CreationTime) &&
                CreatorUserName.Equals(obj.CreatorUserName) &&
                LastModifierUserName.Equals(obj.LastModifierUserName) &&
                LastModificationTime.Equals(obj.LastModificationTime)
                );
     }
     return(false);
 }
 /// <summary>
 /// Equality method between two objects of the same type.
 /// Because the Equals method is strongly typed by generic constraints,
 /// it is not necessary to test for the correct object type.
 /// For safety we just want to match on business key value - in this case the fields
 /// that cannot be different between the two objects if they are supposedly equal.
 /// </summary>
 /// <param name="obj">The other object of this type that we are testing equality with</param>
 /// <returns></returns>
 public virtual bool Equals(GetAdminOutputDtoBase <TIdType> obj)
 {
     if (obj != null)
     {
         return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) &&
                TranslatedFromId.Equals(obj.TranslatedFromId) &&
                IsActive.Equals(obj.IsActive) &&
                IsDeleted.Equals(obj.IsDeleted) &&
                DescriptionFull.Equals(obj.DescriptionFull) &&
                CreationTime.Equals(obj.CreationTime) &&
                CreatorUserId.Equals(obj.CreatorUserId) &&
                CreatorUserName.Equals(obj.CreatorUserName) &&
                LastModifierUserId.Equals(obj.LastModifierUserId) &&
                LastModifierUserName.Equals(obj.LastModifierUserName) &&
                LastModificationTime.Equals(obj.LastModificationTime)
                );
     }
     return(false);
 }
Esempio n. 6
0
        /// <summary>
        /// Equality method between two objects of the same type.
        /// Because the Equals method is strongly typed by generic constraints,
        /// it is not necessary to test for the correct object type.
        /// </summary>
        /// <param name="obj">The other object of this type we are testing equality with</param>
        /// <returns>True if the objects are equal in value</returns>
        public virtual bool Equals(MetadataInformation obj)
        {
            // If parameter is null, return false.
            if (obj is null)
            {
                return(false);
            }

            // Optimization for a common success case.
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            // If run-time types are not exactly the same, return false.
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            // Return true if the fields match.
            // Note that the base class is not invoked because it is
            // System.Object, which defines Equals as reference equality.
            return
                (
                TenantId.Equals(obj.TenantId) &&
                CreatorUserId.Equals(obj.CreatorUserId) &&
                Name.Equals(obj.Name) &&
                DescriptionFull.Equals(obj.DescriptionFull) &&
                DescriptionShort.Equals(obj.DescriptionShort) &&
                LastModifierUserId.Equals(obj.LastModifierUserId) &&
                CreationTime.Equals(obj.CreationTime) &&
                LastModificationTime.Equals(obj.LastModificationTime) &&
                IsDeleted.Equals(obj.IsDeleted) &&
                IsActive.Equals(obj.IsActive)
                )
            ;
        }