Example #1
0
 public CheckClientModel(CheckClient check)
 {
     Id                        = check.Id;
     Firstname                 = check.Firstname;
     Secondname                = check.Secondname;
     Lastname                  = check.Lastname;
     Birthday                  = check.Birthday;
     Sex                       = check.Sex;
     PolicySeries              = check.PolicySeries;
     PolicyNumber              = check.PolicyNumber;
     UnifiedPolicyNumber       = check.UnifiedPolicyNumber;
     DocumentSeries            = check.DocumentSeries;
     DocumentNumber            = check.DocumentNumber;
     LivingFullAddressString   = check.LivingFullAddressString;
     OfficialFullAddressString = check.OfficialFullAddressString;
     TemporaryPolicyNumber     = check.TemporaryPolicyNumber;
     TemporaryPolicyDate       = check.TemporaryPolicyDate;
     SNILS                     = check.SNILS;
     Phone                     = check.Phone;
 }
Example #2
0
        private static bool CheckCondition(CheckClient ch, CheckClient item, SearchCheckClientModel searchCriteria)
        {
            //Закомментированный код = незакомменчиному
            //bool flagLastname = false;
            //bool flagFirstname = false;
            //...

            //if (searchCriteria.IsLastname && (ch.Lastname.ToLower() == item.Lastname.ToLower()))
            //{
            //    flagLastname = true;
            //}

            //if (searchCriteria.IsFirstname && (ch.Firstname.ToLower() == item.Firstname.ToLower()))
            //{
            //    flagFirstname = true;
            //}
            //...

            //if (!(searchCriteria.IsLastname ^ flagLastname) &&
            //    !(searchCriteria.IsFirstname ^ flagFirstname) &&
            //      ...
            //    )
            //{
            //    return true;
            //}
            //else
            //{
            //    return false;
            //}

            if (string.IsNullOrEmpty(ch.Lastname))
            {
                ch.Lastname = string.Empty;
            }
            if (string.IsNullOrEmpty(ch.Firstname))
            {
                ch.Firstname = string.Empty;
            }
            if (string.IsNullOrEmpty(ch.Secondname))
            {
                ch.Secondname = string.Empty;
            }
            if (string.IsNullOrEmpty(item.Lastname))
            {
                item.Lastname = string.Empty;
            }
            if (string.IsNullOrEmpty(item.Firstname))
            {
                item.Firstname = string.Empty;
            }
            if (string.IsNullOrEmpty(item.Secondname))
            {
                item.Secondname = string.Empty;
            }

            if (
                !(searchCriteria.IsLastname ^ (searchCriteria.IsLastname && (ch.Lastname.ToLower() == item.Lastname.ToLower()))) &&
                !(searchCriteria.IsFirstname ^ (searchCriteria.IsFirstname && (ch.Firstname.ToLower() == item.Firstname.ToLower()))) &&
                !(searchCriteria.IsSecondname ^ (searchCriteria.IsSecondname && (ch.Secondname.ToLower() == item.Secondname.ToLower()))) &&
                !(searchCriteria.IsSex ^ (searchCriteria.IsSex && (ch.Sex == item.Sex))) &&
                !(searchCriteria.IsBirthday ^ (searchCriteria.IsBirthday && (ch.Birthday == item.Birthday))) &&
                !(searchCriteria.IsPolicySeries ^ (searchCriteria.IsPolicySeries && (ch.PolicySeries == item.PolicySeries))) &&
                !(searchCriteria.IsPolicyNumber ^ (searchCriteria.IsPolicyNumber && (ch.PolicyNumber == item.PolicyNumber))) &&
                !(searchCriteria.IsUnifiedPolicyNumber ^ (searchCriteria.IsUnifiedPolicyNumber && (ch.UnifiedPolicyNumber == item.UnifiedPolicyNumber))) &&
                !(searchCriteria.IsDocumentSeries ^ (searchCriteria.IsDocumentSeries && (ch.DocumentSeries == item.DocumentSeries))) &&
                !(searchCriteria.IsDocumentNumber ^ (searchCriteria.IsDocumentNumber && (ch.DocumentNumber == item.DocumentNumber)))
                )
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }