Exemplo n.º 1
0
        /// <summary>
        /// The get vizit.
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <returns>
        /// The <see cref="VizitType"/> .
        /// </returns>
        protected virtual VizitType GetVizit(Statement statement)
        {
            var vizit = new VizitType();

            vizit.DVIZIT   = statement.DateFiling.HasValue ? statement.DateFiling.Value.ToShortDateString() : string.Empty;
            vizit.PETITION = statement.HasPetition.HasValue ? Convert.ToInt32(statement.HasPetition.Value) : 0;

            if (statement.ModeFiling != null)
            {
                vizit.METHOD = statement.ModeFiling.Code;
            }

            if (statement.FormManufacturing != null)
            {
                if (statement.AbsentPrevPolicy.HasValue && statement.AbsentPrevPolicy.Value)
                {
                    vizit.FPOLIS = statement.FormManufacturing.Code;
                }
            }

            if (statement.CauseFiling != null)
            {
                if (CauseReinsurance.IsReinsurance(statement.CauseFiling.Id))
                {
                    vizit.RSMO = statement.CauseFiling.Code;
                }
                else
                {
                    vizit.RPOLIS = statement.CauseFiling.Code;
                }
            }

            return(vizit);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   The save statement.
        /// </summary>
        /// <returns> The <see cref="bool" /> . </returns>
        private bool SaveStatementInternal()
        {
            try
            {
                if (!ValidateSteps())
                {
                    var draftStatement = MakeStatement();
                    CurrentStatement = statementService.SaveStatement(draftStatement);
                    return(true);
                }
            }
            catch (FaultPersonAlreadyBelongsToSmoException)
            {
                // Меняем операцию на переоформление
                Session[SessionConsts.COperation] = StatementSearchMenuItem.Reneval;
                step1.FillCauseFiling(x => !CauseReinsurance.IsReinsurance(x.Id));
                CurrentStatement.CauseFiling = null;
                cvErrors.Text = "Лицо принадлежит текущей СМО, замена СМО невозможна, поменяйте причину подачи заявления.";
                GoToStep(1);
                return(false);
            }
            catch (LogicalControlException exception)
            {
                cvErrors.Text = exception.GetAllMessages();

                // Проверяем есть ли ошибка дубль по документу
                if (exception.Contains <FaultDocumentUdlExistsException>())
                {
                    step2.documentUDL.ShowCheckBoxValidDocument();
                }

                // Проверяем есть ли ошибка дубль по СНИЛСУ
                if (exception.Contains <FaultSnilsExistsException>())
                {
                    step2.SetSnilsExistError();
                }

                GoToStep(exception.ToStep());
            }
            catch (Exception)
            {
                cvErrors.Text =
                    "При сохранении заявления произошла ошибка. Обратитесь к администратору. В письме укажите время возникновения ошибки.";
            }

            // todo строка закоменчена т.к. при наличии ошибок до заполнения statement не дойдём - MakeStatement()
            ////statementService.UnBindStatement(statement);

            return(false);
        }
Exemplo n.º 3
0
        /// <summary>
        ///   Проверка доступности элементов редактирования для ввода
        /// </summary>
        public override void CheckIsRightToEdit()
        {
            var propertyList = GetPropertyListForCheckIsRightToEdit();

            // ВС
            tbTemporaryCertificateNumber.Enabled = statementService.IsRightToEdit(
                propertyList,
                Utils.GetExpressionNode(x => x.MedicalInsurances[0].PolisNumber));
            tbTemporaryCertificateDateIssue.Enabled = statementService.IsRightToEdit(
                propertyList,
                Utils.GetExpressionNode(x => x.MedicalInsurances[0].DateFrom));

            tbPolicyNumber.MaxLength = CurrentStatement.FormManufacturing != null &&
                                       CurrentStatement.FormManufacturing.Id == PolisType.К ? 14 : 11;

            if (CurrentStatement.AbsentPrevPolicy != null)
            {
                lbTemporaryCertificate.Visible                           =
                    tbTemporaryCertificateNumber.Visible                 =
                        lblTemporaryCertificateNumber.Visible            =
                            tbTemporaryCertificateDateIssue.Visible      =
                                lblTemporaryCertificateDateIssue.Visible = CurrentStatement.AbsentPrevPolicy.Value; /*NeedNewPolicy*/
            }

            if (CurrentStatement.CauseFiling != null)
            {
                // Полис
                if (CauseReinsurance.IsReinsurance(CurrentStatement.CauseFiling.Id))
                {
                    if (CurrentStatement.AbsentPrevPolicy.Value /*NeedNewPolicy*/)
                    {
                        chbPolicyIsIssued.Enabled = statementService.IsRightToEdit(
                            propertyList,
                            Utils.GetExpressionNode(x => x.PolicyIsIssued));
                    }
                    else
                    {
                        chbPolicyIsIssued.Enabled = false;
                        chbPolicyIsIssued.Checked = true;
                    }
                }
                else
                {
                    if (CurrentStatement.CauseFiling.Id == CauseReneval.Edit)
                    {
                        chbPolicyIsIssued.Enabled = false;
                        chbPolicyIsIssued.Checked = true;
                    }
                    else
                    {
                        chbPolicyIsIssued.Enabled = statementService.IsRightToEdit(
                            propertyList,
                            Utils.GetExpressionNode(x => x.PolicyIsIssued));
                    }
                }
            }

            tbEnpNumber.Enabled = chbPolicyIsIssued.Checked &&
                                  statementService.IsRightToEdit(
                propertyList,
                Utils.GetExpressionNode(x => x.MedicalInsurances[1].Enp));
            tbPolicyNumber.Enabled = chbPolicyIsIssued.Checked &&
                                     statementService.IsRightToEdit(
                propertyList,
                Utils.GetExpressionNode(
                    x =>
                    x.MedicalInsurances[1]
                    .PolisNumber));
            tbPolicyDateIssue.Enabled = chbPolicyIsIssued.Checked &&
                                        statementService.IsRightToEdit(
                propertyList,
                Utils.GetExpressionNode(
                    x =>
                    x.MedicalInsurances[1]
                    .DateFrom));

            if (CurrentStatement.AbsentPrevPolicy != null)
            {
                if (!CurrentStatement.AbsentPrevPolicy.Value /*!NeedNewPolicy*/)
                {
                    if (string.IsNullOrEmpty(tbPolicyDateIssue.Text))
                    {
                        tbPolicyDateIssue.Text = DateTime.Now.ToString("dd.MM.yyyy");
                    }

                    Parent.FindControl("FinishNavigationTemplateContainerID").FindControl("btnPrintTemporaryCertificate").Visible
                        = false;
                }
                else
                {
                    Parent.FindControl("FinishNavigationTemplateContainerID").FindControl("btnPrintTemporaryCertificate").Visible
                        = true;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Page.Master is AuthentificatedPage)
                {
                    ((AuthentificatedPage)Page.Master).GotoMainPage += CloseStatement;
                }

                Session[SessionConsts.CInStatementEditing] = true;
                if (IsPostBack)
                {
                    string eventArgs = Request["__EVENTARGUMENT"];
                    if (!string.IsNullOrEmpty(eventArgs))
                    {
                        switch (eventArgs)
                        {
                        case "forward":
                            GotoNextStep(new WizardNavigationEventArgs(Wizard1.ActiveStepIndex, Wizard1.ActiveStepIndex + 1));
                            break;

                        case "back":
                            GotoPreviousStep(new WizardNavigationEventArgs(Wizard1.ActiveStepIndex, Wizard1.ActiveStepIndex - 1));
                            break;
                        }
                    }

                    // закрытие заявления подтверждённое
                    UtilsHelper.PerformConfirmedAction(confirm, CloseStatement, Request);

                    // если заявление отменённое то спрашиваем про смену статуса перед печатью //новое то надо задавать вопросы про подтверждение сохранения
                    if (CurrentStatement.Status != null && CurrentStatement.Status.Id == StatusStatement.Cancelled)
                    {
                        // подтверждённое сохранение заявления перед печатью
                        UtilsHelper.PerformConfirmedAction(confirmPrint, PrintStatement, Request);
                        UtilsHelper.PerformConfirmedAction(confirmPrintVs, PrintVs, Request);

                        ////// если заявление отменено то при попытке его сохранить предупреждение что статус сменится на новый.
                        ////UtilsHelper.PerformConfirmedAction(confirmSave, SaveStatement, Request);
                    }

                    // подтверждённая печать без шаблона печати вс (в том числе по умолчанию)
                    UtilsHelper.PerformConfirmedAction(сonfirmPrintVsWithoutTemplate, PrintVsOnly, Request);
                }

                if (!IsPostBack)
                {
                    SetOnClientClickCloseButton("StartNavigationTemplateContainerID");
                    SetOnClientClickCloseButton("StepNavigationTemplateContainerID");
                    SetOnClientClickCloseButton("FinishNavigationTemplateContainerID");

                    Statement st = null;

                    var op        = Session[SessionConsts.COperation];
                    var operation = (StatementSearchMenuItem)(op ?? StatementSearchMenuItem.Reinsuranse);
                    switch (operation)
                    {
                    case StatementSearchMenuItem.Reinsuranse:
                    {
                        step1.FillCauseFiling(x => CauseReinsurance.IsReinsurance(x.Id));

                        st = ExampleStatement;


                        st.Status           = regulatoryService.GetConcept(StatusStatement.New);
                        st.AbsentPrevPolicy = false;
                    }

                    break;

                    case StatementSearchMenuItem.Reneval:
                    {
                        step1.FillCauseFiling(x => !CauseReinsurance.IsReinsurance(x.Id));
                        st = ExampleStatement;
                    }

                    break;

                    case StatementSearchMenuItem.Edit:
                    {
                        st = CurrentStatement;

                        // поскольку текущее заявление было прибиндено к сессии на странице поиска, надо заново прибиндить уже к сессии хибернейта текушей страницы,
                        // иначе не инициализируются лэзи свойства
                        ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Update(st);
                        if (CauseReinsurance.IsReinsurance(st.CauseFiling.Id))
                        {
                            step1.FillCauseFiling(x => CauseReinsurance.IsReinsurance(x.Id));
                        }
                        else
                        {
                            step1.FillCauseFiling(x => !CauseReinsurance.IsReinsurance(x.Id));
                        }
                    }

                    break;
                    }

                    CurrentStatement = st;

                    //// Подтверждение сохранения заявления перед печатью
                    //// если заявление новое или имеет статус отменено то надо задавать вопросы про подтверждение сохранения
                    // вопросы про сохранение заявления теперь только для отменённых заявлений

                    if (CurrentStatement != null && Wizard1.ActiveStep != null && CurrentStatement.Status != null &&
                        CurrentStatement.Status.Id == StatusStatement.Cancelled)
                    {
                        var control = Wizard1.ActiveStep.FindControl("FinishNavigationTemplateContainerID");
                        if (control != null)
                        {
                            var buttonPrint = (Button)control.FindControl("btnFinish");
                            if (buttonPrint != null)
                            {
                                buttonPrint.OnClientClick = confirmPrint.ViewConfirmScriptForButton;
                            }

                            var buttonPrintTemp = (Button)control.FindControl("btnPrintTemporaryCertificate");
                            if (buttonPrintTemp != null)
                            {
                                buttonPrintTemp.OnClientClick = confirmPrintVs.ViewConfirmScriptForButton;
                            }
                        }

                        confirmPrint.Message   = "Заявление будет переведено в статус 'Новое' и пойдет в обработку";
                        confirmPrintVs.Message = "Заявление будет переведено в статус 'Новое' и пойдет в обработку";
                    }

                    ////// если заявление отменено то при попытке его сохранить предупреждение что статус сменится на новый. и для печати тоже изменится мессага про то что сменится статус у заявления
                    ////if (CurrentStatement != null && (CurrentStatement.Status != null
                    ////                                 && Wizard1.ActiveStep != null
                    ////                                 && CurrentStatement.Status.Id == StatusStatement.Cancelled))
                    ////{
                    ////  var control = Wizard1.ActiveStep.FindControl("FinishNavigationTemplateContainerID");
                    ////  var findControl = control;
                    ////  if (findControl != null)
                    ////  {
                    ////    var btnSave = (Button)findControl.FindControl("btnSaveStatement");
                    ////    btnSave.OnClientClick = confirmSave.ViewConfirmScriptForButton;
                    ////  }
                    ////}

                    // загрузка данных из объекта
                    if (st != null)
                    {
                        step1.MoveDataFromObject2GUI(st);
                        step2.MoveDataFromObject2GUI(st);
                        step3.MoveDataFromObject2GUI(st);
                        step4.MoveDataFromObject2GUI(st);
                        step5.MoveDataFromObject2GUI(st);
                        step6.MoveDataFromObject2GUI(st);

                        // Внешние ошибки
                        if (st.Errors != null && st.Errors.Any())
                        {
                            cvErrors.Text = st.Errors
                                            .Select(x => string.IsNullOrEmpty(x.Repl) ? x.Message1 : string.Format("{0} ({1})", x.Message1, x.Repl))
                                            .Aggregate((workingSentence, next) => string.Format("{0}; \r\n {1}", next, workingSentence));
                        }
                    }

                    if (Session[SessionConsts.CStep] != null)
                    {
                        var step = (int)Session[SessionConsts.CStep];
                        GoToStep(step);
                    }

                    if (st != null && st.Status != null && st.Status.Id == StatusStatement.Exercised)
                    {
                        var control = Wizard1.ActiveStep.FindControl("FinishNavigationTemplateContainerID");
                        ((Button)control.FindControl("btnSaveStatement")).Enabled             = false;
                        ((Button)control.FindControl("btnFinish")).Enabled                    = false;
                        ((Button)control.FindControl("btnPrintTemporaryCertificate")).Enabled = false;
                    }
                }

                Wizard1.PreRender += Wizard1PreRender;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex.Message, ex);
                throw;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// The get zah.
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <returns>
        /// The <see cref="Zah"/>.
        /// </returns>
        private Zah GetZah(Statement statement)
        {
            var zah = new Zah();

            // ZAH.1	CNE	Да	Тип заявления о выборе или замене СМО
            zah.PreferenceOrChangeSmoType = statement.CauseFiling != null &&
                                            CauseReinsurance.IsReinsurance(statement.CauseFiling.Id)
                                        ? new CneStructure
            {
                FiveDigitCode = statement.CauseFiling.Code,
                Name          = statement.CauseFiling.Name,
                Oid           = Oid.ПричинаподачизаявлениянавыборилизаменуСмо
            }
                                        : null;

            // ZAH.2	CNE	Да	Тип заявления на выдачу полиса
            var type =
                ObjectFactory.GetInstance <IConceptCacheManager>().SingleOrDefault(x => x.Id == statement.TypeStatementId);

            zah.PolicyIssueApplicationType = type != null
                                         ? new CneStructure
            {
                FiveDigitCode = type.Code,
                Name          = type.Name,
                Oid           = Oid.Кодтипазаявления
            }
                                         : null;

            // ZAH.3	CNE	Да	Причина выдачи или замены полиса
            zah.PolicyIssueOrChangeReason = statement.CauseFiling != null && CauseReneval.IsReneval(statement.CauseFiling.Id)
                                        ? new CneStructure
            {
                FiveDigitCode = statement.CauseFiling.Code,
                Name          =
                    statement.CauseFiling.Description.Replace(
                        "Переоформление полиса ОМС в связи с",
                        string.Empty)
                    .Replace(
                        "Выдача дубликата полиса ОМС в связи с",
                        string.Empty),
                Oid = Oid.Причинаподачизаявлениянавыдачудубликата
            }
                                        : null;

            // ZAH.4	CNE	Да	Форма изготовления полиса
            zah.PolicyForm = statement.FormManufacturing != null
                         ? new CneStructure
            {
                FiveDigitCode = statement.FormManufacturing.Code,
                Name          = statement.FormManufacturing.Name,
                Oid           = Oid.Формаизготовленияполиса
            }
                         : null;

            // ZAH.5	ID	Нет	Наличие представителя
            zah.IsRepresentative = statement.HasPetition.HasValue && statement.HasPetition.Value ? "1" : "0";

            // ZAH.6	CNE	Нет	Код типа ходатайствующей организации
            zah.IntercessorialOrganizationTypeCode = null;

            // ZAH.7	CNE	Нет	Способ подачи заявления
            zah.MethodOfApplicationSubmission = statement.ModeFiling != null
                                            ? new CneStructure
            {
                FiveDigitCode = statement.ModeFiling.Code,
                Name          = statement.ModeFiling.Name,
                Oid           = Oid.Способподачизаявления
            }
                                            : null;

            // ZAH.8	EI	Да	Идентификатор заявления у принявшей организации
            zah.ApplicationIDAtTheOrganizationReceivedIt = new EiStructure
            {
                Identificator    = statement.Id.ToString(),
                OrganizationCode =
                    statement.PointDistributionPolicy.Parent.Code,
                Oid = "1.2.643.2.40.3.1.4.0",
                Iso = null
            };

            // ZAH.9	EI	Нет	Идентификатор пункта выдачи полисов
            zah.PolicyIssuingPointID = new EiStructure
            {
                Identificator    = statement.PointDistributionPolicy.Code,
                OrganizationCode = statement.PointDistributionPolicy.Parent.Code,
                Oid = "1.2.643.2.40.3.1.4.0",
                Iso = null
            };

            // ZAH.10	CNE	Усл	Код территории страхования
            zah.CodeOfTeritory = new CneStructure {
                CodeTfoms = statement.PointDistributionPolicy.Parent.Parent.Code
            };

            // ZAH.11	DT	Нет	Дата составления заявления застрахованным лицом
            if (statement.DateFiling != null)
            {
                zah.CompletionDate = ConversionHelper.DateTimeToStringGoznak(statement.DateFiling.Value);
            }

            // ZAH.12	ID	Нет	Признак ознакомления с правилами ОМС
            zah.FamiliarizationAttribute = null;

            // ZAH.13	DTM	Нет	Дата и время приёма заявления
            if (statement.DateFiling != null)
            {
                zah.RecipiencyDateTime =
                    zah.CompletionDate = ConversionHelper.DateTimeToStringGoznak(statement.DateFiling.Value);
            }

            // ZAH.14	ST	Нет	ФИО лица, принявшего заявление
            zah.ReceivingEmployeeFullName = string.Empty;

            // ZAH.15	DTM	Нет	Дата и время завершения обработки заявления
            zah.ProcessingEndingDateTime = null;

            // ZAH.16	CNE	Нет	Причина отказа
            zah.DeclineReason = null;

            return(zah);
        }