Beispiel #1
0
 /// <summary>
 /// Сравнивает объекты
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 protected bool Equals(Person other)
 {
     return(Id == other.Id && string.Equals(SurName.ToLower(), other.SurName.ToLower()) && string.Equals(Name.ToLower(), other.Name.ToLower()) &&
            string.Equals(Patronymic.ToLower(), other.Patronymic.ToLower()) && string.Equals(Organization, other.Organization) &&
            string.Equals(Position, other.Position) && string.Equals(Email, other.Email) &&
            string.Equals(NumberPhone, other.NumberPhone));
 }
Beispiel #2
0
        public BaseModelValidationResult Validate()
        {
            var validationResult = new BaseModelValidationResult();

            if (string.IsNullOrWhiteSpace(Name))
            {
                validationResult.Append($"Name cannot be empty");
            }
            if (string.IsNullOrWhiteSpace(SurName))
            {
                validationResult.Append($"Surname cannot be empty");
            }
            if (!(0 < Age && Age < 100))
            {
                validationResult.Append($"Age {Age} is out of range (0..100)");
            }

            if (!string.IsNullOrEmpty(Name) && !char.IsUpper(Name.FirstOrDefault()))
            {
                validationResult.Append($"Name {Name} should start from capital letter");
            }
            if (!string.IsNullOrEmpty(SurName) && !char.IsUpper(SurName.FirstOrDefault()))
            {
                validationResult.Append($"Surname {SurName} should start from capital letter");
            }

            return(validationResult);
        }
Beispiel #3
0
        public BaseModelValidationResult Validate()
        {
            var validationResult = new BaseModelValidationResult();

            if (string.IsNullOrWhiteSpace(Name))
            {
                validationResult.Append($"Name cannot be empty");
            }
            else
            {
                if (!char.IsUpper(Name.FirstOrDefault()))
                {
                    validationResult.Append($"Name {Name} should start from capital letter");
                }
            }
            if (string.IsNullOrWhiteSpace(SurName))
            {
                validationResult.Append($"SurName cannot be empty");
            }
            else
            {
                if (!char.IsUpper(SurName.FirstOrDefault()))
                {
                    validationResult.Append($"SurName {SurName} should start from capital letter");
                }
            }
            if (Age < 18)
            {
                validationResult.Append($"FullYears should not be under 18");
            }
            return(validationResult);
        }
Beispiel #4
0
 public virtual bool Equals(User other)
 {
     if (other == null)
     {
         throw new ArgumentException("Invalid user");
     }
     return(Name.Equals(other.Name) && SurName.Equals(other.SurName) && DateOfBirth.Equals(other.DateOfBirth));
 }
        /// <summary>
        /// get account owner's name and surname
        /// </summary>
        /// <returns>owner's name</returns>
        public string GetAccountOwner()
        {
            if (Name == null || Name.Equals(string.Empty) || SurName == null || SurName.Equals(string.Empty))
            {
                throw new ArgumentException();
            }

            return(Name + " " + SurName);
        }
Beispiel #6
0
        public override int GetHashCode()
        {
            string var = Name.ToLower().Trim()
                         + SurName.ToLower().Trim()
                         + Age
                         + Experience
                         + Profession;

            return(var.ToString().GetHashCode());
        }
Beispiel #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SurName != null ? SurName.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #8
0
        //Basic Hashcode and Equals methods
        public override int GetHashCode()
        {
            int hash = 5;

            hash = 83 * hash + FirstName.GetHashCode();
            hash = 83 * hash + SurName.GetHashCode();
            hash = 83 * hash + EmailAdress.GetHashCode();
            hash = 83 * hash + PhoneNumber.GetHashCode();
            hash = 83 * hash + Birthday.GetHashCode();
            hash = 83 * hash + SerialNumber;
            return(hash);
        }
Beispiel #9
0
        /// <summary>
        /// Format patient-attributes as a header value
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            var sb        = new StringBuilder();
            var seperator = "; ";

            if (!GivenName.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientGivenName).Append("=").Append(GivenName).Append(seperator);
            }

            if (!SurName.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientSurName).Append("=").Append(SurName).Append(seperator);
            }

            if (!MiddleName.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientMiddleName).Append("=").Append(MiddleName).Append(seperator);
            }

            if (!DateOfBirth.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientDateOfBirth).Append("=").Append(DateOfBirth).Append(seperator);
            }

            if (!Gender.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientGender).Append("=").Append(Gender).Append(seperator);
            }

            if (!SocialSecurityNumber.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientSocialSecurityNumber).Append("=").Append(SocialSecurityNumber).Append(seperator);
            }

            if (!TelephoneNumber.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientTelephoneNumber).Append("=").Append(TelephoneNumber).Append(seperator);
            }

            if (!StreetAddress.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientStreetAddress).Append("=").Append(StreetAddress).Append(seperator);
            }

            if (!PostalCode.IsNullOrWhiteSpace())
            {
                sb.Append(ContextStandard.Patient.PatientPostalCode).Append("=").Append(PostalCode).Append(seperator);
            }

            return(sb.ToString().TrimEnd(';', ' '));
        }
Beispiel #10
0
        public bool isEqual(Patient patient)
        {
            var isTheSame = false;

            if (SurName.Equals(patient.SurName) &&
                FirstName.Equals(patient.FirstName) &&
                Gender.Equals(patient.Gender) &&
                DateOfConsultation.ToString().Equals(patient.DateOfConsultation.ToString()) &&
                Diagnosis.Equals(patient.Diagnosis))
            {
                isTheSame = true;
            }

            return(isTheSame);
        }
Beispiel #11
0
        /// <summary>
        /// Сравнение объектов
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(IOrgItem other)
        {
            if (other is Employee)
            {
                Employee otherEmployee = other as Employee;

                return(Id.Equals(otherEmployee.Id) && DepartmentID.Equals(otherEmployee.DepartmentID) &&
                       SurName.Equals(otherEmployee.SurName) && FirstName.Equals(otherEmployee.FirstName) &&
                       Patronymic.Equals(otherEmployee.Patronymic) &&
                       DateOfBirth.Equals(otherEmployee.DateOfBirth) &&
                       DocSeries.Equals(otherEmployee.DocSeries) && DocNumber.Equals(otherEmployee.DocNumber) &&
                       Position.Equals(otherEmployee.Position));
            }
            return(false);
        }
Beispiel #12
0
        /// <summary>
        /// Возвращает фио в международном формате
        /// </summary>
        /// <returns></returns>
        public string GetFioInternation()
        {
            var sb = new StringBuilder();

            sb.Append(FirstName);
            if (!String.IsNullOrEmpty(SurName))
            {
                sb.AppendFormat(" {0}", SurName.First());
            }
            if (!String.IsNullOrEmpty(LastName))
            {
                sb.AppendFormat(" {0}", LastName);
            }
            return(sb.ToString().Transliterate());
        }
Beispiel #13
0
        /// <summary>
        /// Возвращает ФИО в сокращенном формате
        /// </summary>
        /// <returns></returns>
        public string GetFioSmall()
        {
            var sb = new StringBuilder();

            sb.Append(LastName);
            if (!String.IsNullOrEmpty(FirstName))
            {
                sb.AppendFormat(" {0}.", FirstName.First());
            }
            if (!String.IsNullOrEmpty(SurName))
            {
                sb.AppendFormat(" {0}.", SurName.First());
            }
            return(sb.ToString());
        }
Beispiel #14
0
 public void FillingBillingInformation(BookingForm bookingForm)
 {
     SelectTitle.SelectByValue(bookingForm.Title);
     NameInput.SendKeys(bookingForm.Name);
     SurName.SendKeys(bookingForm.Surname);
     Email.SendKeys(bookingForm.Email);
     Phone.SendKeys(bookingForm.Phone);
     Birthday.SendKeys(bookingForm.Birthday.ToString());
     PassportNumber.SendKeys(bookingForm.PassportNumber);
     ExpirationDate.SendKeys(bookingForm.ExpirationDate);
     NationalityAnchor.Click();
     _wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.XPath(BookingCompletionPageConstants.NationalityItemSelectPath)));
     NationalityItemSelect.Click();
     SelectCardType.SelectByValue(bookingForm.CardType);
     CardNumber.SendKeys(bookingForm.CardNumber);
     CardExpiryYear.SelectByValue(bookingForm.CardExpiryYear);
     CVV.SendKeys(bookingForm.CVV);
 }
Beispiel #15
0
        /// <summary>
        /// Получение из person ФИО клиента вида: Иванов И.И. или Иванов И. (нет отч.) или Иванов (только фамилия)
        /// </summary>
        /// <param name="person">Отправитель или Получатель ContactPerson</param>
        /// <returns>ФИЮ. Пример Иванов И.И.</returns>
        public string GetShortFullName()
        {
            var fullname = "";

            if (Name != null)
            {
                fullname = Name.ToLower();
                fullname = fullname[0].ToString().ToUpper() + fullname.Substring(1).ToLower();
            }

            if (LastName != null)
            {
                fullname += " " + LastName.ToUpper().Substring(0, 1) + ".";
            }

            if (SurName != null)
            {
                fullname += SurName.ToUpper().Substring(0, 1) + ".";
            }

            return(fullname);
        }
Beispiel #16
0
        public bool Valid()
        {
            var dateValid = (BirthBefore != DateTime.MinValue) && (BirthAfter != DateTime.MaxValue);

            return(FirstName.IsNormalized() && LastName.IsNotEmpty() && SurName.IsNotEmpty() && dateValid);
        }
Beispiel #17
0
 public string ToUpperString()
 {
     return($"{SurName.ToUpper()}{Environment.NewLine}{Name}{Environment.NewLine}{Patronomyc}");
 }
Beispiel #18
0
        public bool Equals(IAccount other)
        {
            if (!AccountID.Equals(other.AccountID))
            {
                Error.AddMessage("Account " + UID + " AccountID: " + AccountID + " is not equal to other: " + other.AccountID);
                return(false);
            }

            if (!BirthCountry.Equals(other.BirthCountry))
            {
                Error.AddMessage("Account " + UID + " BirthCountry: " + BirthCountry + " is not equal to other: " + other.BirthCountry);
                return(false);
            }

            if (!Birthday.Equals(other.Birthday))
            {
                Error.AddMessage("Account " + UID + " Birthday: " + Birthday + " is not equal to other: " + other.Birthday);
                return(false);
            }

            if (!BirthPlace.Equals(other.BirthPlace))
            {
                Error.AddMessage("Account " + UID + " BirthPlace: " + BirthPlace + " is not equal to other: " + other.BirthPlace);
                return(false);
            }

            if (!City.Equals(other.City))
            {
                Error.AddMessage("Account " + UID + " City: " + City + " is not equal to other: " + other.City);
                return(false);
            }

            if (!Country.Equals(other.Country))
            {
                Error.AddMessage("Account " + UID + " Country: " + Country + " is not equal to other: " + other.Country);
                return(false);
            }

            if (!ExtraNames.Equals(other.ExtraNames))
            {
                Error.AddMessage("Account " + UID + " ExtraNames: " + ExtraNames + " is not equal to other: " + other.ExtraNames);
                return(false);
            }

            if (!Fax.Equals(other.Fax))
            {
                Error.AddMessage("Account " + UID + " Fax: " + Fax + " is not equal to other: " + other.Fax);
                return(false);
            }

            if (!Gender.Equals(other.Gender))
            {
                Error.AddMessage("Account " + UID + " Gender: " + Gender + " is not equal to other: " + other.Gender);
                return(false);
            }

            if (!GivenName.Equals(other.GivenName))
            {
                Error.AddMessage("Account " + UID + " GivenName: " + GivenName + " is not equal to other: " + other.GivenName);
                return(false);
            }

            if (!Group.Equals(other.Group))
            {
                Error.AddMessage("Account " + UID + " Group: " + Group + " is not equal to other: " + other.Group);
                return(false);
            }

            if (!HomePhone.Equals(other.HomePhone))
            {
                Error.AddMessage("Account " + UID + " HomePhone: " + HomePhone + " is not equal to other: " + other.HomePhone);
                return(false);
            }

            if (!HouseNumber.Equals(other.HouseNumber))
            {
                Error.AddMessage("Account " + UID + " HouseNumber: " + HouseNumber + " is not equal to other: " + other.HouseNumber);
                return(false);
            }

            if (!HouseNumberAdd.Equals(other.HouseNumberAdd))
            {
                Error.AddMessage("Account " + UID + " HouseNumberAdd: " + HouseNumberAdd + " is not equal to other: " + other.HouseNumberAdd);
                return(false);
            }

            if (!Initials.Equals(other.Initials))
            {
                Error.AddMessage("Account " + UID + " Initials: " + Initials + " is not equal to other: " + other.Initials);
                return(false);
            }

            if (!Mail.Equals(other.Mail))
            {
                Error.AddMessage("Account " + UID + " Mail: " + Mail + " is not equal to other: " + other.Mail);
                return(false);
            }

            if (!MailAlias.Equals(other.MailAlias))
            {
                Error.AddMessage("Account " + UID + " MailAlias: " + MailAlias + " is not equal to other: " + other.MailAlias);
                return(false);
            }

            if (!MobilePhone.Equals(other.MobilePhone))
            {
                Error.AddMessage("Account " + UID + " MobilePhone: " + MobilePhone + " is not equal to other: " + other.MobilePhone);
                return(false);
            }

            if (!PostalCode.Equals(other.PostalCode))
            {
                Error.AddMessage("Account " + UID + " PostalCode: " + PostalCode + " is not equal to other: " + other.PostalCode);
                return(false);
            }

            if (!RegisterID.Equals(other.RegisterID))
            {
                Error.AddMessage("Account " + UID + " RegisterID: " + RegisterID + " is not equal to other: " + other.RegisterID);
                return(false);
            }

            if (!Role.Equals(other.Role))
            {
                Error.AddMessage("Account " + UID + " Role: " + Role + " is not equal to other: " + other.Role);
                return(false);
            }

            if (!StemID.Equals(other.StemID))
            {
                Error.AddMessage("Account " + UID + " StemID: " + StemID + " is not equal to other: " + other.StemID);
                return(false);
            }

            if (!Street.Equals(other.Street))
            {
                Error.AddMessage("Account " + UID + " Street: " + Street + " is not equal to other: " + other.Street);
                return(false);
            }

            if (!SurName.Equals(other.SurName))
            {
                Error.AddMessage("Account " + UID + " SurName: " + SurName + " is not equal to other: " + other.SurName);
                return(false);
            }

            if (!UID.Equals(other.UID))
            {
                Error.AddMessage("Account " + UID + " UID: " + UID + " is not equal to other: " + other.UID);
                return(false);
            }

            if (!UntisID.Equals(other.UntisID))
            {
                Error.AddMessage("Account " + UID + " UntisID: " + UntisID + " is not equal to other: " + other.UntisID);
                return(false);
            }

            return(true);
        }
        public void ApplyChanges()
        {
            DegreeAfter  = DegreeAfter.Trim();
            DegreeBefore = DegreeBefore.Trim();
            FirstName    = FirstName.Trim();
            MiddleName   = MiddleName.Trim();
            SurName      = SurName.Trim();

            if (_degreeAfter != null)
            {
                _speaker.DegreeAfter = _degreeAfter;
            }
            if (_degreeBefore != null)
            {
                _speaker.DegreeBefore = _degreeBefore;
            }
            if (_firstName != null)
            {
                _speaker.FirstName = _firstName;
            }
            if (_imgBase64 != null)
            {
                _speaker.ImgBase64 = _imgBase64;
            }
            if (_language != null)
            {
                _speaker.DefaultLang = _language;
            }
            if (_pinned != null)
            {
                _speaker.PinnedToDocument = _pinned.Value;
            }
            if (_middleName != null)
            {
                _speaker.MiddleName = _middleName;
            }
            if (_sex != null)
            {
                _speaker.Sex = _sex.Value;
            }
            if (_surName != null)
            {
                _speaker.Surname = _surName;
            }
            if (_pinned != null)
            {
                _speaker.PinnedToDocument = _pinned.Value;
            }


            foreach (var att in _RemovedAttributes)
            {
                _speaker.Attributes.Remove(att);
            }

            _speaker.Attributes.AddRange(_AddedAttributes);

            _OriginalAttributes = _speaker.Attributes.Select(a => new SpeakerAttribute(a)).ToList();;
            //changes should be discarded after applying
            DiscardChanges();

            Changed = false;
            New     = false;
        }
Beispiel #20
0
 public override string ToString()
 {
     return(string.Format($"{SurName.ToUpper()}, {FirstName} -- {JobLevel}"));
 }
Beispiel #21
0
        private async void RegisterUser()
        {
            if (await CheckUser() == true)
            {
                Users tempUser = new Users(0, Password, int.Parse(MobileNr.Trim()), FirstName.Trim(), SurName.Trim(), Email.Trim(), null);

                if (await services.AddUser(tempUser) == true)
                {
                    IsRegisterComplete = true;
                    await navigation.PopToRootAsync();
                }
            }
        }
 public override string ToString()
 {
     return(string.Format($"{SurName.ToUpper()},{FirstName} - Part Time"));
 }