Пример #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (payments != null ? payments.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FName != null ? FName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MName != null ? MName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LName != null ? LName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EGN != null ? EGN.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MPhone != null ? MPhone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Type;
         return(hashCode);
     }
 }
Пример #2
0
        public string this[string name]
        {
            get
            {
                string result = null;

                if (name == "_Name")
                {
                    if (nameChanged)
                    {
                        if (string.IsNullOrEmpty(_Name))
                        {
                            result = "Field is empty";
                        }
                        else if (!CarSystemGUI.Validate.NameValidate(_Name))
                        {
                            result = "Name can contain only letters";
                        }
                    }
                }
                if (name == "Surename")
                {
                    if (surenameChanged)
                    {
                        if (string.IsNullOrEmpty(Surename))
                        {
                            result = "Field is empty";
                        }
                        else if (!CarSystemGUI.Validate.NameValidate(Surename))
                        {
                            result = "Name can contain only letters";
                        }
                    }
                }

                if (name == "IDCardNumber")
                {
                    if (idCardNumberChanged)
                    {
                        if (string.IsNullOrWhiteSpace(IDCardNumber.ToString()))
                        {
                            result = "Field is empty";
                        }
                        else if (!CarSystemGUI.Validate.EGNValidate(IDCardNumber.ToString()))
                        {
                            result = "ID Card number must be 10 digit number";
                        }

                        //else if(this["IDCardNumber"]==)
                    }
                }
                if (name == "EGN")
                {
                    if (egnChanged)
                    {
                        if (string.IsNullOrWhiteSpace(EGN.ToString()))
                        {
                            result = "Field is empty";
                        }
                        else if (!CarSystemGUI.Validate.EGNValidate(EGN.ToString()))
                        {
                            result = "EGN number must be 10 digit number";
                        }
                    }
                }
                if (name == "Country")
                {
                    if (countryChanged)
                    {
                        if (string.IsNullOrWhiteSpace(Country))
                        {
                            result = "Field is empty";
                        }
                    }
                }
                if (name == "City")
                {
                    if (cityChanged)
                    {
                        if (string.IsNullOrWhiteSpace(City))
                        {
                            result = "Field is empty";
                        }
                    }
                }
                if (name == "Street")
                {
                    if (streetChanged)
                    {
                        if (string.IsNullOrWhiteSpace(Street))
                        {
                            result = "Field is empty";
                        }
                    }
                }

                if (name == "Phone")
                {
                    if (phoneChanged)
                    {
                        if (string.IsNullOrWhiteSpace(Phone))
                        {
                            result = "Field is empty";
                        }
                        else if (!CarSystemGUI.Validate.PhoneNumberValidate(Phone))
                        {
                            result = "Wrong input";
                        }
                    }
                }
                if (name == "Email")
                {
                    if (emailChanged)
                    {
                        if (string.IsNullOrWhiteSpace(Email))
                        {
                            result = "Field is empty";
                        }
                        else if (!CarSystemGUI.Validate.EmailValidate(Email))
                        {
                            result = "Wrong input";
                        }
                    }
                }

                return(result);
            }
        }