public static GradationLogicCounter GetGradation(Gradation gradation) { switch (gradation) { case Gradation.Base: { return(new Base()); } case Gradation.Silver: { return(new Silver()); } case Gradation.Gold: { return(new Gold()); } case Gradation.Platinum: { return(new Platinum()); } default: { throw new ArgumentException($"{nameof(gradation)} doesnt exist"); } } }
/// <summary> /// Opens new account. /// </summary> /// <param name="gradation">Type of account.</param> public Account OpenAccount(Gradation gradation, PersonalInfo personalInfo) { switch (gradation) { case Gradation.Base: { return(new BaseAccount(personalInfo)); } case Gradation.Silver: { return(new SilverAccount(personalInfo)); } case Gradation.Gold: { return(new GoldAccount(personalInfo)); } case Gradation.Platinum: { return(new PlatinumAccount(personalInfo)); } default: { return(new BaseAccount(personalInfo)); } } }
/// <summary> Constructor. </summary> /// <param name="man"> The person with properties: string, string, string, string. </param> /// <param name="gradation"> The gradation of account rarity. </param> public BankAccount(int id, Client person, Gradation gradation, decimal balance, int points) { this.Id = id; this.Client = new Client(person.Name, person.Surname, person.Lastname, person.NumberOfPassport); this.Gradation = gradation; this.Balance = balance; this.BonusPoints = points; }
/// <summary> Constructor. </summary> /// <param name="man"> The person with properties: string, string, string, string. </param> /// <param name="gradation"> The gradation of account rarity. </param> public Account(Client man, Gradation gradation, decimal balance, decimal points) { this.man = new Client(man.Name, man.Surname, man.Lastname, man.NumberOfPassport); this.gradation = gradation; this.Balance = balance; this.BonusePoints = points; id = ++counter; }
/// <summary> /// загружает ряд в словарь по заданным градациям /// </summary> /// <param name="range"></param> private void loadRange(List <double> range) { foreach (double val in range) { if (double.IsNaN(val)) { continue; } var gi = Gradation.GetItem(val); var index = Keys.IndexOf(gi); if (index < 0) { continue; } Values[index]++; } foreach (object g in Keys) { Values[Keys.IndexOf(g)] /= range.Count; } }
public void SetGraduationType(Gradation gradation) { this.counter = GradationFactory.GetGradation(gradation); }