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");
            }
            }
        }
示例#2
0
        /// <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));
            }
            }
        }
示例#3
0
 /// <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;
 }
示例#4
0
 /// <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;
 }
示例#5
0
        /// <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;
            }
        }
示例#6
0
 public void SetGraduationType(Gradation gradation)
 {
     this.counter = GradationFactory.GetGradation(gradation);
 }