Exemple #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);
 }
Exemple #2
0
 public ClientVisitSaveDataModel(User user, ClientVisit clientVisit, bool replaceNewOld)
     : this(user, clientVisit)
 {
     if (replaceNewOld)
     {
         OldClientInfo      = new ClientVersionEditModel(clientVisit.NewClientInfo, EntityType.Old);
         NewClientInfo      = new ClientVersionEditModel(EntityType.New);
         OldDocument        = new DocumentModel(clientVisit.NewDocument, DocumentType.Old);
         NewDocument        = new DocumentModel(DocumentType.New);
         NewForeignDocument = new DocumentModel(DocumentType.NewForeign);
         OldForeignDocument = new DocumentModel(clientVisit.NewForeignDocument, DocumentType.OldForeign);
         OldPolicy          = new PolicyInfoClientVisitSaveModel(clientVisit.NewPolicy, EntityType.Old);
         NewPolicy          = new PolicyInfoClientVisitSaveModel(EntityType.New);
         Registrator        = new UserModel(user);
         StatusDate         = new DateTime();
         StatusId           = 1;
         Comment            = user.Fullname;
     }
 }
Exemple #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?();
        }