/// <summary>
        /// Method allows to compare on equality
        /// instances of this class
        /// </summary>
        /// <param name="obj">Object for compare</param>
        /// <returns>true(objects are the same) or false(objects are not the same)</returns>
        public override bool Equals(object obj)
        {
            Gambler gambler = obj as Gambler;

            if (gambler != null)
            {
                return(FirstName.Equals(gambler.FirstName) &
                       LastName.Equals(gambler.LastName) &
                       Patronym.Equals(gambler.Patronym) &
                       Rate.Equals(gambler.Rate) &
                       Bet.Equals(gambler.Bet));
            }

            return(false);
        }
Example #2
0
        public virtual string this[string columnName]
        {
            get
            {
                string       error_message = String.Empty;
                PropertyInfo property      = this.GetType().GetProperty(columnName);
                if (property != null && property.IsDefined(typeof(RequiredAttribute), true))
                {
                    RequiredAttribute required_attribute = new RequiredAttribute();
                    if (!required_attribute.IsValid(property.GetValue(this)))
                    {
                        return("Заполните обязательное поле!");
                    }
                }
                switch (columnName)
                {
                case "FirstName":
                    if (FirstName != null && FirstName.Any(c => Char.IsDigit(c)))
                    {
                        error_message = "Введите имя русскими или латинскими буквами!";
                    }
                    break;

                case "LastName":
                    if (LastName != null && LastName.Any(c => Char.IsDigit(c)))
                    {
                        error_message = "Введите фамилию русскими или латинскими буквами!";
                    }
                    break;

                case "Patronym":
                    if (Patronym != null && Patronym.Any(c => Char.IsDigit(c)))
                    {
                        error_message = "Введите отчество русскими или латинскими буквами!";
                    }
                    break;
                }
                return(error_message);
            }
        }