예제 #1
0
        /// <summary>
        /// Редактирование заявления
        /// </summary>
        /// <param name="statementId">
        /// The statement id.
        /// </param>
        public void CanceledStatement(Guid statementId)
        {
            var statement = GetById(statementId);

            if (StatusStatement.CanCanceled(statement.Status.Id))
            {
                var conceptCacheManager = ObjectFactory.GetInstance <IConceptCacheManager>();
                var session             = ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession();

                // Ставим статус отмененный
                statement.Status = conceptCacheManager.GetById(StatusStatement.Cancelled);
                session.Update(statement);

                // Анулируем страховки
                foreach (var medicalInsurance in statement.MedicalInsurances)
                {
                    medicalInsurance.IsActive = false;
                    session.Update(medicalInsurance);
                }

                ObjectFactory.GetInstance <IErrorManager>().Delete(x => x.Statement.Id == statementId);

                session.Flush();

                ApplyActive(statement.InsuredPerson);

                session.Flush();
            }
        }
예제 #2
0
        /// <summary>
        /// The on canceled or remove statement.
        /// </summary>
        /// <param name="insuredPerson">
        /// The insured person.
        /// </param>
        public void OnCanceledOrRemoveStatement(InsuredPerson insuredPerson)
        {
            var session        = ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession();
            var conceptManager = ObjectFactory.GetInstance <IConceptCacheManager>();

            if (insuredPerson.Statements != null &&
                (!insuredPerson.Statements.Any() ||
                 insuredPerson.Statements.All(x => StatusStatement.IsAnnuled(x.Status.Id))))
            {
                insuredPerson.Status = conceptManager.GetById(StatusPerson.Annuled);
                session.Update(insuredPerson);

                foreach (var period in insuredPerson.MedicalInsurances)
                {
                    period.IsActive = false;
                    session.Update(period);
                }
            }
        }
        public void InvalidValueChangeThrowsError()
        {
            StatusStatement stat = new StatusStatement("current");

            Assert.Throws <ImproperValue>(() => stat.Argument = "notValid");
        }