public override int GetHashCode()
        {
            int hashCode = 801909259;

            if (IdempotencyKey != null)
            {
                hashCode += IdempotencyKey.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (PlanId != null)
            {
                hashCode += PlanId.GetHashCode();
            }

            if (CustomerId != null)
            {
                hashCode += CustomerId.GetHashCode();
            }

            if (StartDate != null)
            {
                hashCode += StartDate.GetHashCode();
            }

            if (CanceledDate != null)
            {
                hashCode += CanceledDate.GetHashCode();
            }

            if (TaxPercentage != null)
            {
                hashCode += TaxPercentage.GetHashCode();
            }

            if (PriceOverrideMoney != null)
            {
                hashCode += PriceOverrideMoney.GetHashCode();
            }

            if (CardId != null)
            {
                hashCode += CardId.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            return(hashCode);
        }
        public ActionResult _DeleteTaxPercentage(_DeleteTaxPercentageViewModel model)
        {
            TaxPercentage TaxPercentage = null;

            if (model.TaxPercentageId.HasValue)
            {
                TaxPercentage       = context.TaxPercentage.FirstOrDefault(x => x.TaxPercentageId == model.TaxPercentageId);
                TaxPercentage.State = ConstantHelpers.ESTADO.INACTIVO;
            }

            context.SaveChanges();
            PostMessage(MessageType.Success);

            return(RedirectToAction("ListTaxPercentage"));
        }
        public static decimal ComputeSalesTax(BaseProduct product)
        {
            decimal tax = 0;

            if (product.IsTaxable)
            {
                tax += product.Price * product.TaxRate;
            }

            if (product.IsImported)
            {
                tax += (product.Price * TaxPercentage.GetTaxPercentage("ImportedTax"));
            }

            return(RoundingToNearest05Rule(tax));
        }
Beispiel #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Product != null ? Product.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ Rate.GetHashCode();
         hashCode = (hashCode * 397) ^ TaxPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ DiscountPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ Total.GetHashCode();
         hashCode = (hashCode * 397) ^ Subtotal.GetHashCode();
         hashCode = (hashCode * 397) ^ Tax.GetHashCode();
         hashCode = (hashCode * 397) ^ LineIdx;
         return(hashCode);
     }
 }
        public ActionResult AddEditTaxPercentage(AddEditTaxPercentageViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    model.Fill(CargarDatosContext(), model.TaxPercentageId, model.FatherId);
                    TryUpdateModel(model);
                    PostMessage(MessageType.Error);
                    return(View(model));
                }

                TaxPercentage taxPercentage = null;

                if (model.TaxPercentageId.HasValue)
                {
                    taxPercentage = context.TaxPercentage.FirstOrDefault(x => x.TaxPercentageId == model.TaxPercentageId);
                }
                else
                {
                    taxPercentage       = new TaxPercentage();
                    taxPercentage.State = ConstantHelpers.ESTADO.ACTIVO;
                    context.TaxPercentage.Add(taxPercentage);
                }

                taxPercentage.Description = model.Description;

                context.SaveChanges();
                PostMessage(MessageType.Success);

                return(RedirectToAction("ListTaxPercentage", new { FatherId = model.FatherId }));
            }
            catch (Exception ex)
            {
                PostMessage(MessageType.Error);
                model.Fill(CargarDatosContext(), model.TaxPercentageId, model.FatherId);

                return(View(model));
            }
        }
Beispiel #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (InvoiceId != null ? InvoiceId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ InvoiceNumber;
         hashCode = (hashCode * 397) ^ (InvoiceNumberAsString != null ? InvoiceNumberAsString.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Total.GetHashCode();
         hashCode = (hashCode * 397) ^ Subtotal.GetHashCode();
         hashCode = (hashCode * 397) ^ Tax.GetHashCode();
         hashCode = (hashCode * 397) ^ TaxPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ InvoiceDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (ContractName != null ? ContractName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PeriodStartDate.GetHashCode();
         hashCode = (hashCode * 397) ^ PeriodEndDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Currency != null ? Currency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (From != null ? From.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (To != null ? To.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LineItems?.Sum(x => x.GetHashCode()) ?? 0);
         return(hashCode);
     }
 }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreateSubscriptionRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((PlanId == null && other.PlanId == null) || (PlanId?.Equals(other.PlanId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((StartDate == null && other.StartDate == null) || (StartDate?.Equals(other.StartDate) == true)) &&
                   ((CanceledDate == null && other.CanceledDate == null) || (CanceledDate?.Equals(other.CanceledDate) == true)) &&
                   ((TaxPercentage == null && other.TaxPercentage == null) || (TaxPercentage?.Equals(other.TaxPercentage) == true)) &&
                   ((PriceOverrideMoney == null && other.PriceOverrideMoney == null) || (PriceOverrideMoney?.Equals(other.PriceOverrideMoney) == true)) &&
                   ((CardId == null && other.CardId == null) || (CardId?.Equals(other.CardId) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)));
        }
Beispiel #8
0
        public override int GetHashCode()
        {
            int hashCode = -1265150766;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (PlanId != null)
            {
                hashCode += PlanId.GetHashCode();
            }

            if (CustomerId != null)
            {
                hashCode += CustomerId.GetHashCode();
            }

            if (StartDate != null)
            {
                hashCode += StartDate.GetHashCode();
            }

            if (CanceledDate != null)
            {
                hashCode += CanceledDate.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (TaxPercentage != null)
            {
                hashCode += TaxPercentage.GetHashCode();
            }

            if (InvoiceIds != null)
            {
                hashCode += InvoiceIds.GetHashCode();
            }

            if (PriceOverrideMoney != null)
            {
                hashCode += PriceOverrideMoney.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (CardId != null)
            {
                hashCode += CardId.GetHashCode();
            }

            if (PaidUntilDate != null)
            {
                hashCode += PaidUntilDate.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            return(hashCode);
        }
Beispiel #9
0
 private bool Equals(IInvoiceLineItem other)
 {
     return(Product == other.Product && Description == other.Description && Quantity.Equals(other.Quantity) && Rate.Equals(other.Rate) && TaxPercentage.Equals(other.TaxPercentage) &&
            DiscountPercentage.Equals(other.DiscountPercentage) && Total.Equals(other.Total) && Subtotal.Equals(other.Subtotal) && Tax.Equals(other.Tax) && LineIdx == other.LineIdx);
 }