Пример #1
0
        /// <summary>
        /// The check.
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        public override void CheckObject(Statement statement)
        {
            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            try
            {
                if (!string.IsNullOrEmpty(statement.InsuredPersonData.Snils))
                {
                    if (statement.InsuredPersonData.NotCheckSnils.HasValue && statement.InsuredPersonData.NotCheckSnils.Value)
                    {
                        return;
                    }

                    var res = SnilsChecker.CheckIdentifier(statement.InsuredPersonData.Snils);
                    if (!res)
                    {
                        throw new FaultSnilsException();
                    }
                }
            }
            catch (NullReferenceException)
            {
                throw new FaultSnilsException();
            }
        }
Пример #2
0
        public void CheckBadSnils()
        {
            var r = SnilsChecker.CheckIdentifier("03596739301");

            Assert.AreEqual(false, r);
        }
Пример #3
0
        public void CheckSnils()
        {
            var r = SnilsChecker.CheckIdentifier("03596739300");

            Assert.AreEqual(true, r);
        }
Пример #4
0
        /// <summary>
        /// Переносит данные из объекта в элементы на форме
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        public override void MoveDataFromObject2GUI(Statement statement)
        {
            if (statement.InsuredPersonData != null)
            {
                var insuredPersonData = statement.InsuredPersonData;

                // Фамилия
                tbLastName.Text = insuredPersonData.LastName;
                if (string.IsNullOrEmpty(tbLastName.Text) && statement.Id != Guid.Empty)
                {
                    chbIsLastNameAbsent.Checked = true;
                    ChbIsLastNameAbsentCheckedChanged(null, null);
                }

                // Имя
                tbFirstName.Text = insuredPersonData.FirstName;
                if (string.IsNullOrEmpty(tbFirstName.Text) && statement.Id != Guid.Empty)
                {
                    chbIsFirstNameAbsent.Checked = true;
                    ChbIsFirstNameAbsentCheckedChanged(null, null);
                }

                // Отчество
                tbMiddleName.Text = insuredPersonData.MiddleName;
                if (string.IsNullOrEmpty(tbMiddleName.Text) && statement.Id != Guid.Empty)
                {
                    chbIsMiddleNameAbsent.Checked = true;
                    ChbIsMiddleNameAbsentCheckedChanged(null, null);
                }

                // Пол
                if (insuredPersonData.Gender != null)
                {
                    ddlGender.SelectedValue = insuredPersonData.Gender.Id.ToString(CultureInfo.InvariantCulture);
                }

                // Несуществующая дата рождения в документе УДЛ
                if (insuredPersonData.IsIncorrectDate != null)
                {
                    chBIsIncorrectDate.Checked = (bool)insuredPersonData.IsIncorrectDate;
                }

                // Дата рождения
                switch (insuredPersonData.BirthdayType)
                {
                case (int)BirthdayType.Full:
                {
                    if (insuredPersonData.Birthday != null)
                    {
                        tbBirthDate.Text = insuredPersonData.Birthday.Value.ToShortDateString();
                    }

                    rbBirthDate.Checked  = true;
                    rbBirthMonth.Checked = false;
                    rbBirthYear.Checked  = false;
                    RbBirthDateCheckedChanged(null, null);
                }

                break;

                case (int)BirthdayType.MonthAndYear:
                {
                    if (insuredPersonData.Birthday != null)
                    {
                        tbBirthMonth.Text = insuredPersonData.Birthday.Value.ToString("MMMM yyyy");
                    }

                    rbBirthDate.Checked  = false;
                    rbBirthMonth.Checked = true;
                    rbBirthYear.Checked  = false;
                    RbBirthMonthCheckedChanged(null, null);
                }

                break;

                case (int)BirthdayType.Year:
                {
                    if (insuredPersonData.Birthday != null)
                    {
                        tbBirthYear.Text = insuredPersonData.Birthday.Value.ToString("yyyy");
                    }

                    rbBirthDate.Checked  = false;
                    rbBirthMonth.Checked = false;
                    rbBirthYear.Checked  = true;
                    RbBirthYearCheckedChanged(null, null);
                }

                break;
                }

                // Место рождения
                if (insuredPersonData.OldCountry != null)
                {
                    ddlBirthPlace.SelectedValue = insuredPersonData.OldCountry.Id.ToString(CultureInfo.InvariantCulture);
                }

                tbBirthPlace.Text = insuredPersonData.Birthplace;

                // Не специалист...
                if (!insuredPersonData.IsNotGuru != null)
                {
                    chBIsNotGuru.Checked = (bool)insuredPersonData.IsNotGuru;
                }

                // СНИЛС
                tbSnils.Text = insuredPersonData.Snils;

                // Проверяем корректность снилса
                chbNotCheckDigitsSnils.Checked = chbNotCheckDigitsSnils.Visible = !string.IsNullOrEmpty(insuredPersonData.Snils) && !SnilsChecker.CheckIdentifier(insuredPersonData.Snils);


                // Без гражданства
                chbWithoutCitizenship.Checked = insuredPersonData.IsNotCitizenship;
                ChbWithoutCitizenshipCheckedChanged(null, null);

                // Беженец
                chbIsRefugee.Checked = insuredPersonData.IsRefugee;
                ChbIsRefugeeCheckedChanged(null, null);

                // Гражданство
                if (insuredPersonData.Citizenship != null)
                {
                    ddlCitizenship.SelectedValue = insuredPersonData.Citizenship.Id.ToString(CultureInfo.InvariantCulture);
                }

                // Категория
                UpdateCategory();
                if (insuredPersonData.Category != null)
                {
                    ddlCategory.SelectedValue = insuredPersonData.Category.Id.ToString(CultureInfo.InvariantCulture);
                    hfSelectedCategory.Value  = ddlCategory.SelectedValue;

                    SetVisibleDocumentResidency(CategoryPerson.IsDocumentResidency(insuredPersonData.Category.Id));
                }
                else
                {
                    SetVisibleDocumentResidency(false);
                }
            }

            UpdateDocTypeUdl();
            if (statement.DocumentUdl != null)
            {
                // Вид документа
                if (statement.DocumentUdl.DocumentType != null)
                {
                    documentUDL.DocumentType = statement.DocumentUdl.DocumentType.Id;
                }

                // Серия
                documentUDL.DocumentSeries = statement.DocumentUdl.Series;

                // Номер
                documentUDL.DocumentNumber = statement.DocumentUdl.Number;

                // Орган
                documentUDL.DocumentIssuingAuthority = statement.DocumentUdl.IssuingAuthority;

                // Дата выдачи
                documentUDL.DocumentIssueDate = statement.DocumentUdl.DateIssue;
                documentUDL.DocumentExpDate   = statement.DocumentUdl.DateExp;
            }

            // Документ подтвержающий право проживания
            UpdateDocTypeResidency();
            if (statement.ResidencyDocument != null)
            {
                // Вид документа
                if (statement.ResidencyDocument.DocumentType != null)
                {
                    documentResidency.DocumentType = statement.ResidencyDocument.DocumentType.Id;
                }

                // Серия
                documentResidency.DocumentSeries = statement.ResidencyDocument.Series;

                // Номер
                documentResidency.DocumentNumber = statement.ResidencyDocument.Number;

                // Орган
                documentResidency.DocumentIssuingAuthority = statement.ResidencyDocument.IssuingAuthority;

                // Дата выдачи
                documentResidency.DocumentIssueDate = statement.ResidencyDocument.DateIssue;
                documentResidency.DocumentExpDate   = statement.ResidencyDocument.DateExp;
            }

            #endregion
        }