/// <summary> /// The check. /// </summary> /// <param name="statement"> /// The statement. /// </param> public override void CheckObject(Statement statement) { if (statement == null) { throw new ArgumentNullException("statement"); } if (statement.NotCheckPolisNumber.HasValue && statement.NotCheckPolisNumber.Value) { return; } // Если нужно выдать новый полис и полис выдан, то обязательно надо заполнить номер полиса ////if (statement.AbsentPrevPolicy.HasValue && statement.AbsentPrevPolicy.Value && statement.PolicyIsIssued.HasValue //// && statement.PolicyIsIssued.Value && string.IsNullOrEmpty(statement.NumberPolicy)) ////{ //// throw new FaultEnpException(); ////} // Проверка соответствия полу, дате рождения и контрольному разряду if (!string.IsNullOrEmpty(statement.NumberPolicy)) { if (!EnpChecker.CheckIdentifier(statement.NumberPolicy)) { throw new FaultEnpException(); } if (statement.InsuredPersonData != null && statement.InsuredPersonData.Birthday != null && statement.InsuredPersonData.Gender != null) { if ( !EnpChecker.CheckBirthdayAndGender( statement.NumberPolicy, statement.InsuredPersonData.Birthday.Value, statement.InsuredPersonData.Gender.Id == Sex.Sex1)) { throw new FaultEnpBirthdayAndGenderException(); } } } ////// Если новый полис выдавать не требуется, то ЕНП должен быть известен, он на полисе, который предъявили ////if ((!statement.AbsentPrevPolicy.HasValue || statement.AbsentPrevPolicy == false) //// && string.IsNullOrEmpty(statement.NumberPolicy)) ////{ //// throw new FaultEnpAbsentPrevPolicyException(); ////} }
/// <summary> /// The check. /// </summary> /// <param name="statement"> /// The statement. /// </param> public override void CheckObject(Statement statement) { if (statement == null) { throw new ArgumentNullException("statement"); } // Проверка соответствия полу, дате рождения и контрольному разряду var policy = statement.MedicalInsurances.LastOrDefault(x => x.PolisType.Id != PolisType.В); if (!(statement.PolicyIsIssued.HasValue && statement.PolicyIsIssued.Value)) { return; } if (policy == null) { throw new FaultNewEnpException(); } if (!string.IsNullOrEmpty(policy.Enp)) { if (!EnpChecker.CheckIdentifier(policy.Enp)) { throw new FaultEnpException(); } if (statement.InsuredPersonData != null && statement.InsuredPersonData.Birthday != null && statement.InsuredPersonData.Gender != null) { if ( !EnpChecker.CheckBirthdayAndGender( policy.Enp, statement.InsuredPersonData.Birthday.Value, statement.InsuredPersonData.Gender.Id == Sex.Sex1)) { throw new FaultNewEnpBirthdayAndGenderException(); } } } else { throw new FaultEnpException(); } }
/// <summary> /// Переносит данные из объекта в элементы на форме /// </summary> /// <param name="statement"> /// The statement. /// </param> public override void MoveDataFromObject2GUI(Statement statement) { fStatus.Value = statement.Status != null ? statement.Status.Id.ToString(CultureInfo.InvariantCulture) : StatusStatement.New.ToString(CultureInfo.InvariantCulture); tbDateFiling.Text = statement.DateFiling.HasValue ? ((DateTime)statement.DateFiling).ToShortDateString() : DateTime.Today.ToShortDateString(); // Причина подачи заявления if (statement.CauseFiling != null) { // если заявление импортировано, то причины подачи заявления не будет и надо его добавить в общий список комбика, но при этом комбик должен быть недоступен для смены значения if (statement.CauseFiling.Id == CauseReinsurance.Initialization) { AddInitializationCauseFiling(); ddlCauseFiling.Enabled = false; } ddlCauseFiling.SelectedValue = statement.CauseFiling.Id.ToString(CultureInfo.InvariantCulture); if (ddlCauseFiling.SelectedValue == CauseReinsurance.Choice.ToString(CultureInfo.InvariantCulture)) { chbNewPolicy.Enabled = false; } } // Способ подачи if (statement.ModeFiling != null) { ddlModeFiling.SelectedValue = statement.ModeFiling.Id.ToString(CultureInfo.InvariantCulture); } // Наличие ходатайства о регистрации в качестве застрахованного лица if (statement.HasPetition != null) { chbHasPetition.Checked = (bool)statement.HasPetition; } // Форма изготовления полиса if (statement.FormManufacturing != null) { ddlPolicyType.SelectedValue = statement.FormManufacturing.Id.ToString(CultureInfo.InvariantCulture); hfPolicyType.Value = ddlPolicyType.SelectedValue; } chbNewPolicy.Checked = statement.AbsentPrevPolicy.HasValue && statement.AbsentPrevPolicy.Value; hfNewPolicy.Value = chbNewPolicy.Checked ? "1" : "0"; // Номер полиса tbNumberPolicy.Text = statement.NumberPolicy; cbNotCheckEnp.Checked = statement.NumberPolicy != null && statement.NumberPolicy.Length == 16 && statement.InsuredPersonData != null && statement.InsuredPersonData.Birthday.HasValue && statement.InsuredPersonData.Gender != null && (!EnpChecker.CheckIdentifier(statement.NumberPolicy) || !EnpChecker.CheckBirthdayAndGender( statement.NumberPolicy, statement.InsuredPersonData.Birthday.Value, statement.InsuredPersonData.Gender.Code == "1")); if (cbNotCheckEnp.Checked) { cbNotCheckEnp.Visible = true; } CheckIsRightToEdit(); }
public void CheckEnpFaset() { var r = EnpChecker.CheckBirthdayAndGender("7856510844000446", new DateTime(1984, 3, 5), true); Assert.IsTrue(r); }