private CityTax GetCityTaxes(string city)
        {
            CityTax cityTaxes;

            _cityTaxesCache.TryGetValue(city, out cityTaxes);
            if (cityTaxes == null)
            {
                cityTaxes = new CityTax();
                _cityTaxesCache.Add(city, cityTaxes);
            }
            return(cityTaxes);
        }
Exemple #2
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (CancellationFee == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "CancellationFee");
     }
     if (NoShowFee == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "NoShowFee");
     }
     if (PrePaymentAmount == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "PrePaymentAmount");
     }
     if (RatePlan == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RatePlan");
     }
     if (TaxDetails == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TaxDetails");
     }
     if (TimeSlices == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TimeSlices");
     }
     if (TotalGrossAmount == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TotalGrossAmount");
     }
     if (UnitGroup == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "UnitGroup");
     }
     if (CancellationFee != null)
     {
         CancellationFee.Validate();
     }
     if (CityTax != null)
     {
         CityTax.Validate();
     }
     if (NoShowFee != null)
     {
         NoShowFee.Validate();
     }
     if (PrePaymentAmount != null)
     {
         PrePaymentAmount.Validate();
     }
     if (RatePlan != null)
     {
         RatePlan.Validate();
     }
     if (TaxDetails != null)
     {
         foreach (var element in TaxDetails)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (TimeSlices != null)
     {
         foreach (var element1 in TimeSlices)
         {
             if (element1 != null)
             {
                 element1.Validate();
             }
         }
     }
     if (TotalGrossAmount != null)
     {
         TotalGrossAmount.Validate();
     }
     if (UnitGroup != null)
     {
         UnitGroup.Validate();
     }
     if (ValidationMessages != null)
     {
         foreach (var element2 in ValidationMessages)
         {
             if (element2 != null)
             {
                 element2.Validate();
             }
         }
     }
 }
Exemple #3
0
        public void SeedTestCases(SupportContext context, string userId)
        {
            // Get some Income Type objects
            IncomeType it1 = context.IncomeTypes.Where(c => c.Code == "wages").First();
            IncomeType it2 = context.IncomeTypes.Where(c => c.Code == "bonuses").First();
            IncomeType it3 = context.IncomeTypes.Where(c => c.Code == "winnings").First();
            IncomeType it4 = context.IncomeTypes.Where(c => c.Code == "milretire").First();

            // Get some Deduction Type objects
            // ~TODO~ Add the Deduction Types to the SeedCodeTables.sql
            DeductionType dt1 = context.DeductionTypes.Where(c => c.Code == "Alimony").First();
            DeductionType dt2 = context.DeductionTypes.Where(c => c.Code == "Trad401").First();
            DeductionType dt3 = context.DeductionTypes.Where(c => c.Code == "TradIRA").First();
            DeductionType dt4 = context.DeductionTypes.Where(c => c.Code == "LifeIns").First();

            // Get some CityTax objects
            CityTax ct1 = context.CityTaxes.Where(c => c.Name == "No City Tax").First();
            CityTax ct2 = context.CityTaxes.Where(c => c.Name == "Hudson (Resident)").First();
            CityTax ct3 = context.CityTaxes.Where(c => c.Name == "Lansing (Non-Resident)").First();
            CityTax ct4 = context.CityTaxes.Where(c => c.Name == "Portland (Non-Resident)").First();
            CityTax ct5 = context.CityTaxes.Where(c => c.Name == "Saginaw (Resident)").First();

            // Get some FilingStatus objects
            FilingStatus fs1 = context.FilingStatus.Where(c => c.Code == "Single").First();
            FilingStatus fs2 = context.FilingStatus.Where(c => c.Code == "Head").First();
            FilingStatus fs3 = context.FilingStatus.Where(c => c.Code == "Jointly").First();
            FilingStatus fs4 = context.FilingStatus.Where(c => c.Code == "Seperately").First();
            FilingStatus fs5 = context.FilingStatus.Where(c => c.Code == "Widow").First();

            // Get some PartyType objects
            PartyType ptA = context.PartyTypes.Where(c => c.Code == "A").First();
            PartyType ptB = context.PartyTypes.Where(c => c.Code == "B").First();
            PartyType pt3 = context.PartyTypes.Where(c => c.Code == "3").First();

            // Create some cases
            Random rnd      = new Random();
            int    caseNo1A = rnd.Next(10, 99);
            int    caseNo1B = rnd.Next(10, 99);
            int    caseNo2A = rnd.Next(16238, 99999);
            int    caseNo2B = rnd.Next(16238, 99999);

            var case1 = new Case()
            {
                AspNetUserId = userId, CaseNumber = caseNo1A + "-" + caseNo2B + "-Test"
            };
            var case2 = new Case()
            {
                AspNetUserId = userId, CaseNumber = caseNo1B + "-" + caseNo2A + "-Test"
            };

            context.Cases.Add(case1);
            context.Cases.Add(case2);
            SaveChanges(context);

            // Create some Child objects
            Child ch11 = new Child()
            {
                Case = case1, Name = "John", Overnights = 93.0m
            };
            Child ch12 = new Child()
            {
                Case = case1, Name = "Jack", Overnights = 57.4m
            };
            Child ch13 = new Child()
            {
                Case = case1, Name = "Amber", Overnights = 180m
            };
            Child ch14 = new Child()
            {
                Case = case1, Name = "Mary", Overnights = 180m
            };
            Child ch15 = new Child()
            {
                Case = case1, Name = "Daron", Overnights = 180m
            };

            Child ch21 = new Child()
            {
                Case = case2, Name = "Aaron", Overnights = 220m
            };
            Child ch22 = new Child()
            {
                Case = case2, Name = "Bob", Overnights = 220m
            };
            Child ch23 = new Child()
            {
                Case = case2, Name = "Jim", Overnights = 220m
            };
            Child ch24 = new Child()
            {
                Case = case2, Name = "Chuck", Overnights = 220m
            };
            Child ch25 = new Child()
            {
                Case = case2, Name = "Lisa", Overnights = 200m
            };

            context.Children.Add(ch11);
            context.Children.Add(ch12);
            context.Children.Add(ch13);
            context.Children.Add(ch14);
            context.Children.Add(ch15);
            context.Children.Add(ch21);
            context.Children.Add(ch22);
            context.Children.Add(ch23);
            context.Children.Add(ch24);
            context.Children.Add(ch25);
            SaveChanges(context);

            // Create some Party objects
            Party p1 = new Party()
            {
                Case = case1, Name = "Brad Benix", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptA, CityTax = ct1, FilingStatus = fs1
            };
            Party p2 = new Party()
            {
                Case = case1, Name = "Alison Benix", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptB, CityTax = ct2, FilingStatus = fs2
            };
            Party p3 = new Party()
            {
                Case = case2, Name = "Harry Marly", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptA, CityTax = ct3, FilingStatus = fs3
            };
            Party p4 = new Party()
            {
                Case = case2, Name = "Mary Marly", AdditionalChildren = 0, ChildCareAmount = 0, Exemptions = 5, ExemptionsUnder17 = 3, HealthCareAmount = 0, PartyType = ptB, CityTax = ct4, FilingStatus = fs4
            };

            context.Parties.Add(p1);
            context.Parties.Add(p2);
            context.Parties.Add(p3);
            context.Parties.Add(p4);
            SaveChanges(context);

            // Create some Deduction objects
            Deduction d1 = new Deduction()
            {
                DeductionType = dt1, Party = p1, Amount = 1000m
            };
            Deduction d2 = new Deduction()
            {
                DeductionType = dt2, Party = p2, Amount = 1200m
            };
            Deduction d3 = new Deduction()
            {
                DeductionType = dt3, Party = p3, Amount = 1300m
            };
            Deduction d4 = new Deduction()
            {
                DeductionType = dt4, Party = p4, Amount = 2000m
            };

            context.Deductions.Add(d1);
            context.Deductions.Add(d2);
            context.Deductions.Add(d3);
            context.Deductions.Add(d4);
            SaveChanges(context);

            // Create some Income objects
            Income i1 = new Income()
            {
                IncomeType = it1, Party = p1, Amount = 54000m
            };
            Income i2 = new Income()
            {
                IncomeType = it2, Party = p2, Amount = 43000m
            };
            Income i3 = new Income()
            {
                IncomeType = it3, Party = p3, Amount = 62000m
            };
            Income i4 = new Income()
            {
                IncomeType = it4, Party = p4, Amount = 38000m
            };

            context.Incomes.Add(i1);
            context.Incomes.Add(i2);
            context.Incomes.Add(i3);
            context.Incomes.Add(i4);
            SaveChanges(context);
        }
Exemple #4
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (CancellationFee == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "CancellationFee");
     }
     if (NoShowFee == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "NoShowFee");
     }
     if (TaxDetails == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TaxDetails");
     }
     if (TimeSlices == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TimeSlices");
     }
     if (TotalGrossAmount == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TotalGrossAmount");
     }
     if (CancellationFee != null)
     {
         CancellationFee.Validate();
     }
     if (CityTax != null)
     {
         CityTax.Validate();
     }
     if (NoShowFee != null)
     {
         NoShowFee.Validate();
     }
     if (Services != null)
     {
         foreach (var element in Services)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (TaxDetails != null)
     {
         foreach (var element1 in TaxDetails)
         {
             if (element1 != null)
             {
                 element1.Validate();
             }
         }
     }
     if (TimeSlices != null)
     {
         foreach (var element2 in TimeSlices)
         {
             if (element2 != null)
             {
                 element2.Validate();
             }
         }
     }
     if (TotalGrossAmount != null)
     {
         TotalGrossAmount.Validate();
     }
     if (ValidationMessages != null)
     {
         foreach (var element3 in ValidationMessages)
         {
             if (element3 != null)
             {
                 element3.Validate();
             }
         }
     }
 }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Balance == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Balance");
     }
     if (BookingId == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "BookingId");
     }
     if (CancellationFee == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "CancellationFee");
     }
     if (Id == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Id");
     }
     if (NoShowFee == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "NoShowFee");
     }
     if (PrimaryGuest == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryGuest");
     }
     if (Property == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Property");
     }
     if (RatePlan == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RatePlan");
     }
     if (TotalGrossAmount == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TotalGrossAmount");
     }
     if (UnitGroup == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "UnitGroup");
     }
     if (Actions != null)
     {
         foreach (var element in Actions)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (AdditionalGuests != null)
     {
         foreach (var element1 in AdditionalGuests)
         {
             if (element1 != null)
             {
                 element1.Validate();
             }
         }
     }
     if (AssignedUnits != null)
     {
         foreach (var element2 in AssignedUnits)
         {
             if (element2 != null)
             {
                 element2.Validate();
             }
         }
     }
     if (Balance != null)
     {
         Balance.Validate();
     }
     if (Booker != null)
     {
         Booker.Validate();
     }
     if (CancellationFee != null)
     {
         CancellationFee.Validate();
     }
     if (CityTax != null)
     {
         CityTax.Validate();
     }
     if (Commission != null)
     {
         Commission.Validate();
     }
     if (Company != null)
     {
         Company.Validate();
     }
     if (NoShowFee != null)
     {
         NoShowFee.Validate();
     }
     if (PaymentAccount != null)
     {
         PaymentAccount.Validate();
     }
     if (PrimaryGuest != null)
     {
         PrimaryGuest.Validate();
     }
     if (Property != null)
     {
         Property.Validate();
     }
     if (RatePlan != null)
     {
         RatePlan.Validate();
     }
     if (Services != null)
     {
         foreach (var element3 in Services)
         {
             if (element3 != null)
             {
                 element3.Validate();
             }
         }
     }
     if (TimeSlices != null)
     {
         foreach (var element4 in TimeSlices)
         {
             if (element4 != null)
             {
                 element4.Validate();
             }
         }
     }
     if (TotalGrossAmount != null)
     {
         TotalGrossAmount.Validate();
     }
     if (Unit != null)
     {
         Unit.Validate();
     }
     if (UnitGroup != null)
     {
         UnitGroup.Validate();
     }
     if (ValidationMessages != null)
     {
         foreach (var element5 in ValidationMessages)
         {
             if (element5 != null)
             {
                 element5.Validate();
             }
         }
     }
 }