public Contract(Client client, TypeOfTariff typeOfTariff) { TariffEffectiveDate = DateTime.Now; Client = client; Number = rnd.Next(1000, 9999); Tariff = new Tariff(typeOfTariff); }
public Contract(Subscriber subscriber, TypeOfTariff typeOfTariff) { TariffEffectiveDate = DateTime.Now; Subscriber = subscriber; Number = rnd.Next(1000, 9999); Tariff = new Tariff(typeOfTariff); }
public Tariff(TypeOfTariff type) { TariffType = type; switch (TariffType) { case TypeOfTariff.Mini: { SubscriptionFee = 10; PricePerMinute = 1; LimitСallsPerMonth = 3; break; } case TypeOfTariff.Maxi: { SubscriptionFee = 20; PricePerMinute = 2; LimitСallsPerMonth = 8; break; } default: { SubscriptionFee = 0; PricePerMinute = 0; LimitСallsPerMonth = 0; break; } } }
public void ChangeTariff(TypeOfTariff typeOfTariff) { if (DateTime.Now.AddMonths(-1) >= TariffEffectiveDate) { TariffEffectiveDate = DateTime.Now; Tariff = new Tariff(typeOfTariff); Console.WriteLine("Tariff has been changed".ToUpper()); } else { Console.WriteLine("To change the tariff, wait until the end of the month".ToUpper()); } }
public bool ChangeTariff(TypeOfTariff typeOfTariff) { if (DateTime.Now.AddMonths(-1) >= TariffEffectiveDate) { TariffEffectiveDate = DateTime.Now; Tariff = new Tariff(typeOfTariff); //Console.WriteLine("Tariff has been changed"); return(true); } else { //Console.WriteLine("To change the tariff, wait until the end of the month"); return(false); } }
public Tariff(TypeOfTariff type) { TariffType = type; switch (TariffType) { case TypeOfTariff.Mini: { MonthlyPayment = 10; PricePerMinute = 1; LimitСallsPerMonth = 3; break; } case TypeOfTariff.Midi: { MonthlyPayment = 15; PricePerMinute = 1; LimitСallsPerMonth = 5; break; } case TypeOfTariff.Maxi: { MonthlyPayment = 20; PricePerMinute = 2; LimitСallsPerMonth = 8; break; } default: { MonthlyPayment = 0; PricePerMinute = 0; LimitСallsPerMonth = 0; break; } } }
public IContract SignContract(Subscriber subscriber, TypeOfTariff typeOfTariff) { Contract contract = new Contract(subscriber, typeOfTariff); return(contract); }