Пример #1
0
 public ClientVisitSaveDataModel(User user) : this()
 {
     TemporaryPolicyDate           = DateTime.Now;
     StatusEnabled                 = user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG);
     TemporaryPolicyExpirationDate = DateTime.Now.AddWorkingDays(30);
     SignatureFileName             = Guid.NewGuid().ToString();
     PhotoFileName                 = Guid.NewGuid().ToString();
     OldClientInfo                 = new ClientVersionEditModel(EntityType.Old);
     NewClientInfo                 = new ClientVersionEditModel(EntityType.New);
     OldDocument                   = new DocumentModel(DocumentType.Old);
     NewDocument                   = new DocumentModel(DocumentType.New);
     NewForeignDocument            = new DocumentModel(DocumentType.NewForeign);
     OldForeignDocument            = new DocumentModel(DocumentType.OldForeign);
     LivingAddress                 = new AddressModel(AddressType.Living);
     RegistrationAddress           = new AddressModel(AddressType.Registration);
     OldPolicy                     = new PolicyInfoClientVisitSaveModel();
     NewPolicy                     = new PolicyInfoClientVisitSaveModel();
     Registrator                   = new UserModel();
     ClientCategoryId              = 5;
     Scenaries                     = ReferencesProvider.GetReferences(Constants.ScenarioRef, user.Roles, DateTime.Now, null, true);
     DeliveryPoints                = ReferencesProvider.GetReferences(Constants.DeliveryPointRef, user.Roles, DateTime.Now, null, true);
     DeliveryCenters               = ReferencesProvider.GetReferences(Constants.DeliveryCenterRef, user.Roles, null, null, true);
     IsGoznakBlockVisible          = user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG);
     IsActualEnabled               = (user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG));
     UralsibClientCategories       = ReferencesProvider.GetReferences(Constants.UralsibClientCategoryRef, user.Roles, null, "4", true);
     ListClientAcquisitionEmployee = ReferencesProvider.GetListClientAcquisitionEmployee(null, true);
 }
Пример #2
0
 public ClientVisitSaveDataModel()
 {
     OldClientInfo           = new ClientVersionEditModel(EntityType.Old);
     NewClientInfo           = new ClientVersionEditModel(EntityType.New);
     OldDocument             = new DocumentModel(DocumentType.Old);
     NewDocument             = new DocumentModel(DocumentType.New);
     NewForeignDocument      = new DocumentModel(DocumentType.NewForeign);
     OldForeignDocument      = new DocumentModel(DocumentType.OldForeign);
     LivingAddress           = new AddressModel(AddressType.Living);
     RegistrationAddress     = new AddressModel(AddressType.Registration);
     validator               = new ClientVisitSaveDataValidator();
     StatusId                = 1;
     Statuses                = ReferencesProvider.GetReferences(Constants.ClientVisitStatusRef, "1", false);
     DeliveryCenters         = ReferencesProvider.GetReferences(Constants.DeliveryCenterForOperatorRef, null, false);
     Scenaries               = ReferencesProvider.GetReferences(Constants.ScenarioRef, null, DateTime.Now, null, true);
     DeliveryPoints          = ReferencesProvider.GetReferences(Constants.DeliveryPointRef, null, DateTime.Now, null, true);
     GoznakTypes             = ReferencesProvider.GetReferences(Constants.GOZNAKTypeRef, null, true);
     UralsibClientCategories = ReferencesProvider.GetReferences(Constants.UralsibClientCategoryRef, null, true);
     AttachmentTypes         = ReferencesProvider.GetReferences(Constants.PolicyAttachmentTypeRef, null, true);
     MedicalCenters          = ReferencesProvider.GetReferences(Constants.MedicalCenterRef, null, true);
     Carriers                = ReferencesProvider.GetReferences(Constants.CarriersRef, null, true);
     ApplicationMethods      = ReferencesProvider.GetReferences(Constants.ApplicationMethodRef, null, true);
     Representative          = new RepresentativeEditModel()
     {
         RepresentativeTypeId = 1
     };
     ListClientAcquisitionEmployee = ReferencesProvider.GetListClientAcquisitionEmployee(null, true);
 }
Пример #3
0
        public ClientVisitSaveDataModel(User user, ClientVisit clientVisit)
            : this(user)
        {
            VisitId                       = clientVisit.Id;
            ClientId                      = clientVisit.ClientId;
            VisitGroupId                  = clientVisit.VisitGroupId;
            SignatureFileName             = clientVisit.SignatureFileName ?? Guid.NewGuid().ToString();
            PhotoFileName                 = clientVisit.PhotoFileName ?? Guid.NewGuid().ToString();
            DeliveryCenterId              = clientVisit.DeliveryCenter.Id;
            ScenarioId                    = clientVisit.Scenario != null ? clientVisit.Scenario.Id : new long?();
            TemporaryPolicyDate           = clientVisit.TemporaryPolicyDate;
            TemporaryPolicyNumber         = clientVisit.TemporaryPolicyNumber;
            TemporaryPolicyExpirationDate = clientVisit.TemporaryPolicyExpirationDate;
            StatusId                      = clientVisit.Status.Id;
            StatusDate                    = clientVisit.StatusDate;
            StatusEnabled                 = user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG);
            DisableAll                    = clientVisit.Status.Id == ClientVisitStatuses.AnswerPending.Id &&
                                            !(user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG));
            OldClientInfo           = new ClientVersionEditModel(clientVisit.OldClientInfo, EntityType.Old);
            NewClientInfo           = new ClientVersionEditModel(clientVisit.NewClientInfo, EntityType.New);
            OldDocument             = new DocumentModel(clientVisit.OldDocument, DocumentType.Old);
            NewDocument             = new DocumentModel(clientVisit.NewDocument, DocumentType.New);
            NewForeignDocument      = new DocumentModel(clientVisit.NewForeignDocument, DocumentType.NewForeign);
            OldForeignDocument      = new DocumentModel(clientVisit.OldForeignDocument, DocumentType.OldForeign);
            LivingAddress           = new AddressModel(clientVisit.LivingAddress, AddressType.Living);
            RegistrationAddress     = new AddressModel(clientVisit.RegistrationAddress, AddressType.Registration);
            RegistrationAddressDate = clientVisit.RegistrationAddressDate;
            OldPolicy                 = new PolicyInfoClientVisitSaveModel(clientVisit.OldPolicy, EntityType.Old);
            NewPolicy                 = new PolicyInfoClientVisitSaveModel(clientVisit.NewPolicy, EntityType.New);
            Registrator               = new UserModel(clientVisit.Registrator);
            Representative            = new RepresentativeEditModel(clientVisit.Representative);
            CarrierId                 = clientVisit.CarrierId;
            ApplicationMethodId       = clientVisit.ApplicationMethodId;
            Comment                   = clientVisit.Comment;
            GOZNAKDate                = clientVisit.GOZNAKDate;
            GOZNAKTypeId              = clientVisit.GOZNAKType != null ? clientVisit.GOZNAKType.Id : default(long?);
            ClientCategoryId          = clientVisit.ClientCategoryId == 0 ? new long() : clientVisit.ClientCategoryId;
            DeliveryPointId           = clientVisit.DeliveryPointId == 0 ? new long() : clientVisit.DeliveryPointId;
            ClientAcquisitionEmployee = clientVisit.ClientAcquisitionEmployee;
            ClientContacts            = clientVisit.ClientContacts;
            Phone          = clientVisit.Phone;
            Email          = clientVisit.Email;
            IssueDate      = clientVisit.IssueDate;
            UralsibCard    = clientVisit.UralsibCard;
            IsActual       = clientVisit.IsActual;
            Scenaries      = ReferencesProvider.GetReferences(Constants.ScenarioRef, user.Roles, DateTime.Now, null, true);
            DeliveryPoints = ReferencesProvider.GetReferences(Constants.DeliveryPointRef, user.Roles, DateTime.Now, null, true);
            ListClientAcquisitionEmployee = ReferencesProvider.GetListClientAcquisitionEmployee(null, true);
            PolicyBlanc = clientVisit.PolicyBlanc;

            if (ScenarioId != 0 && !Scenaries.Exists(item => item.Value == ScenarioId.ToString()))
            {
                Scenaries.Add(ReferencesProvider.GetReferences(Constants.ScenarioRef).FirstOrDefault(item => item.Value == ScenarioId.ToString()));
            }
            if (DeliveryPointId.HasValue && !DeliveryPoints.Exists(item => item.Value == DeliveryPointId.Value.ToString()))
            {
                DeliveryPoints.Add(ReferencesProvider.GetReferences(Constants.DeliveryPointRef).FirstOrDefault(item => item.Value == DeliveryPointId.Value.ToString()));
            }
            if (ClientCategoryId.HasValue && !UralsibClientCategories.Exists(item => item.Value == ClientCategoryId.Value.ToString()))
            {
                UralsibClientCategories.Add(ReferencesProvider.GetReferences(Constants.UralsibClientCategoryRef).FirstOrDefault(item => item.Value == ClientCategoryId.Value.ToString()));
            }
            IssueDateEnabled = (user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG)) ||
                               (StatusId == ClientVisitStatuses.PolicyReadyForClient.Id && user.Roles.Contains(Role.Registrator));
            IsReadyToFundSubmitRequestEnabled = user.Roles.Contains(Role.Administrator) || user.Roles.Contains(Role.OperatorSG);
            PolicyPartyNumber           = clientVisit.PolicyPartyNumber;
            FundResponseApplyingMessage = clientVisit.FundResponseApplyingMessage;
            IsReadyToFundSubmitRequest  = clientVisit.IsReadyToFundSubmitRequest;
            CreateDate       = clientVisit.CreateDate;
            UpdateDate       = clientVisit.UpdateDate;
            IsDifficultCase  = clientVisit.IsDifficultCase;
            AttachmentDate   = clientVisit.AttachmentDate;
            AttachmentTypeId = clientVisit.AttachmentType != null ? clientVisit.AttachmentType.Id : new long?();
            MedicalCentreId  = clientVisit.MedicalCentre != null ? clientVisit.MedicalCentre.Id : new long?();
        }