Exemple #1
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 /// <param name="userManager"></param>
 public PasswordForgotService(ICrocoAmbientContextAccessor context,
                              ICrocoApplication application,
                              UserManager <ApplicationUser> userManager
                              ) : base(context, application)
 {
     UserManager = userManager;
 }
Exemple #2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="context"></param>
        /// <param name="application"></param>
        public BaseCltService(ICrocoAmbientContextAccessor context, ICrocoApplication application) : base(context, application)
        {
            var settingsFactory = Application.SettingsFactory;

            RolesSetting = settingsFactory.GetSetting <CltRolesSetting>();
            RootSettings = settingsFactory.GetSetting <RootSettings>();
        }
        public static void CheckApplicationState(ICrocoApplication app)
        {
            var appContext = app.GetDatabaseContext(SystemCrocoExtensions.GetRequestContext());

            var context = appContext.GetDbContext();

            var contextType        = context.GetType();
            var modelProjectName   = contextType.Assembly.ManifestModule.Name.Replace(".dll", "");
            var dbContextClassName = contextType.Name;


            var lastAppliedMigration = context.Database.GetAppliedMigrations().LastOrDefault();
            var lastDefinedMigration = context.Database.GetMigrations().LastOrDefault();

            var command = $"Update-Database -Context {dbContextClassName}";

            var instructions = "Зайдите в Средства->Диспетчер пакетов NuGet->" +
                               $"Консоль диспетчера пакетов, далее выберите проект по умолчанию {modelProjectName} и введите команду {command}";

            if (lastAppliedMigration == null)
            {
                throw new Exception($"К вашей базе данных не применены миграции. {instructions}");
            }

            if (lastDefinedMigration != lastAppliedMigration)
            {
                throw new Exception($"К вашей базе данных не применена последняя миграция. {instructions}");
            }
        }
Exemple #4
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="contextAccessor"></param>
 /// <param name="application"></param>
 /// <param name="principalCheker"></param>
 /// <param name="dayTasksService"></param>
 public DayTaskCommentService(ICrocoAmbientContextAccessor contextAccessor,
                              ICrocoApplication application,
                              PrincipalCheker principalCheker,
                              DayTasksService dayTasksService) : base(contextAccessor, application, principalCheker)
 {
     DayTasksService = dayTasksService;
 }
Exemple #5
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="contextAccessor"></param>
 /// <param name="application"></param>
 /// <param name="principalCheker"></param>
 /// <param name="usersStorage"></param>
 public DayTasksService(ICrocoAmbientContextAccessor contextAccessor,
                        ICrocoApplication application,
                        PrincipalCheker principalCheker,
                        IUsersStorage usersStorage) : base(contextAccessor, application, principalCheker)
 {
     UsersStorage = usersStorage;
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="application"></param>
 /// <param name="logger"></param>
 /// <param name="eccFileService"></param>
 public FilesUploadedEventHandler(ICrocoApplication application,
                                  ILogger <FilesUploadedEventHandler> logger,
                                  EccFileService eccFileService
                                  ) : base(application, logger)
 {
     EccFileService = eccFileService;
 }
Exemple #7
0
        /// <summary>
        /// Конструктора
        /// </summary>
        /// <param name="roleManager"></param>
        /// <param name="context"></param>
        /// <param name="application"></param>
        /// <param name="logger"></param>
        public RoleService(
            RoleManager <ApplicationRole> roleManager,

            ICrocoAmbientContextAccessor context,
            ICrocoApplication application, ILogger <RoleService> logger) : base(context, application, logger)
        {
            RoleManager = roleManager;
        }
Exemple #8
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 /// <param name="userManager"></param>
 /// <param name="signInManager"></param>
 /// <param name="userSearcher"></param>
 public PasswordChanger(ICrocoAmbientContextAccessor context, ICrocoApplication application,
                        UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager,
                        UserSearcher userSearcher) : base(context, application)
 {
     UserManager   = userManager;
     SignInManager = signInManager;
     UserSearcher  = userSearcher;
 }
Exemple #9
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContextAccessor"></param>
 /// <param name="application"></param>
 /// <param name="fileQueryService"></param>
 /// <param name="emailSender"></param>
 public EmailWrapperSender(ICrocoAmbientContextAccessor ambientContextAccessor,
                           ICrocoApplication application,
                           IDbFileQueryService fileQueryService,
                           IEmailSender emailSender) : base(ambientContextAccessor, application)
 {
     FileQueryService = fileQueryService;
     EmailSender      = emailSender;
 }
Exemple #10
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 /// <param name="logger"></param>
 /// <param name="fileMasterStorage"></param>
 /// <param name="eccFileService"></param>
 public EccExportFileService(ICrocoAmbientContextAccessor context,
                             ICrocoApplication application,
                             ILogger <EccExportFileService> logger,
                             IFileMasterStorage fileMasterStorage,
                             EccFileService eccFileService) : base(context, application, logger)
 {
     FileMasterStorage = fileMasterStorage;
     EccFileService    = eccFileService;
 }
Exemple #11
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 /// <param name="userMasterStorage"></param>
 /// <param name="userService"></param>
 /// <param name="logger"></param>
 public UserExportService(ICrocoAmbientContextAccessor context,
                          ICrocoApplication application,
                          IUserMasterStorage userMasterStorage,
                          UserService userService,
                          ILogger <UserExportService> logger) : base(context, application, logger)
 {
     UserMasterStorage = userMasterStorage;
     UserService       = userService;
 }
        public static void Register(ICrocoApplication application)
        {
            //Подписка обработчиками сообщений на сообщения
            application.AddMessageHandler <ChatCreatedEvent, ChatCreatedEventHandler>();
            application.AddMessageHandler <ChatRelationUpdatedEvent, ChatRelationUpdatedEventHandler>();
            application.AddMessageHandler <WebAppRequestContextLog, CrocoWebAppRequestContextLogHandler>();

            ChatOptimizations.AddRelationsFromDatabase().GetAwaiter().GetResult();
            LogApplicationInit();
        }
Exemple #13
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="app"></param>
 /// <param name="clientDataRefresher"></param>
 /// <param name="fileChecker"></param>
 /// <param name="dbFileManager"></param>
 /// <param name="relationManager"></param>
 public ClientService(ICrocoAmbientContextAccessor ambientContext,
                      ICrocoApplication app,
                      IClientDataRefresher clientDataRefresher,
                      FileChecker fileChecker,
                      IDbFileQueryService dbFileManager,
                      IDbFileRelationManager relationManager) : base(ambientContext, app)
 {
     ClientDataRefresher   = clientDataRefresher;
     FileChecker           = fileChecker;
     FilesQueryService     = dbFileManager;
     DbFileRelationManager = relationManager;
 }
Exemple #14
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 /// <param name="signInManager"></param>
 /// <param name="userSearcher"></param>
 /// <param name="passwordHashValidator"></param>
 /// <param name="authenticationManager"></param>
 /// <param name="logger"></param>
 public AccountLoginService(ICrocoAmbientContextAccessor ambientContext,
                            ICrocoApplication application,
                            SignInManager <ApplicationUser> signInManager,
                            UserSearcher userSearcher,
                            PasswordHashValidator passwordHashValidator,
                            IApplicationAuthenticationManager authenticationManager,
                            ILogger <AccountLoginService> logger) : base(ambientContext, application, logger)
 {
     SignInManager         = signInManager;
     UserSearcher          = userSearcher;
     PasswordHashValidator = passwordHashValidator;
     AuthenticationManager = authenticationManager;
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 /// <param name="userManager"></param>
 /// <param name="signInManager"></param>
 /// <param name="userSearcher"></param>
 /// <param name="passwordValidator"></param>
 /// <param name="logger"></param>
 public AccountRegistrationService(ICrocoAmbientContextAccessor ambientContext,
                                   ICrocoApplication application,
                                   UserManager <ApplicationUser> userManager,
                                   SignInManager <ApplicationUser> signInManager,
                                   UserSearcher userSearcher,
                                   CltPasswordValidator passwordValidator,
                                   ILogger <AccountRegistrationService> logger) : base(ambientContext, application, logger)
 {
     UserManager       = userManager;
     SignInManager     = signInManager;
     UserSearcher      = userSearcher;
     PasswordValidator = passwordValidator;
 }
Exemple #16
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="application"></param>
        /// <param name="modelValidator"></param>
        /// <param name="logger"></param>
        public SmtpEmailSender(ICrocoApplication application,
                               ICrocoModelValidator modelValidator,
                               ILogger <SmtpEmailSender> logger)
        {
            ModelValidator = modelValidator;
            Logger         = logger;
            EmailSettings  = application.SettingsFactory.GetSetting <SmtpEmailSettingsModel>();
            var validationResult = ModelValidator.Validate(EmailSettings);

            if (!validationResult.IsSucceeded)
            {
                Logger.LogError($"Не настроен клиент для отправки сообщений через Smtp. Проверьте настройку {typeof(SmtpEmailSettingsModel).FullName}");
            }
            SmtpClient = GetSmtpClient();
        }
Exemple #17
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 /// <param name="userSearcher"></param>
 public UserService(ICrocoAmbientContextAccessor ambientContext,
                    ICrocoApplication application,
                    UserSearcher userSearcher) : base(ambientContext, application)
 {
     UserSearcher = userSearcher;
 }
Exemple #18
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 public EmailGroupQueryWorker(ICrocoAmbientContextAccessor context, ICrocoApplication application) : base(context, application)
 {
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 public ApplicationInteractionWorker(ICrocoAmbientContextAccessor ambientContext, ICrocoApplication application) : base(ambientContext, application)
 {
 }
Exemple #20
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 /// <param name="userMasterStorage"></param>
 public UserService(ICrocoAmbientContextAccessor context, ICrocoApplication application,
                    IUserMasterStorage userMasterStorage) : base(context, application)
 {
     UserMasterStorage = userMasterStorage;
 }
Exemple #21
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 /// <param name="logger"></param>
 public ChatQueryService(ICrocoAmbientContextAccessor context,
                         ICrocoApplication application,
                         ILogger <ChatQueryService> logger) : base(context, application, logger)
 {
 }
Exemple #22
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="app"></param>
 public MessageDistributionQueryWorker(ICrocoAmbientContextAccessor context, ICrocoApplication app) : base(context, app)
 {
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="context"></param>
 /// <param name="application"></param>
 public EmailGroupFromFileCreator(ICrocoAmbientContextAccessor context,
                                  ICrocoApplication application) : base(context, application)
 {
 }
 public static void Register(ICrocoApplication application)
 {
     //LogApplicationInit();
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="application"></param>
 /// <param name="logger"></param>
 /// <param name="userService"></param>
 public ClientRegisteredEventHandler(ICrocoApplication application,
                                     ILogger <ClientRegisteredEventHandler> logger,
                                     UserService userService) : base(application, logger)
 {
     UserService = userService;
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContextAccessor"></param>
 /// <param name="application"></param>
 /// <param name="settings"></param>
 public EmailLinkFunctionInvoker(ICrocoAmbientContextAccessor ambientContextAccessor,
                                 ICrocoApplication application, EccSettings settings) : base(ambientContextAccessor, application)
 {
     UrlRedirectFormat = settings.FunctionInvokerSettings.UrlRedirectFormat;
 }
Exemple #27
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 public SmsMessageWorker(ICrocoAmbientContextAccessor ambientContext, ICrocoApplication application) : base(ambientContext, application)
 {
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 /// <param name="logger"></param>
 public ApplicationChatService(ICrocoAmbientContextAccessor ambientContext,
                               ICrocoApplication application,
                               ILogger <ApplicationChatService> logger) : base(ambientContext, application, logger)
 {
 }
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="application"></param>
 /// <param name="logger"></param>
 /// <param name="userService"></param>
 public CreateUserCommandHandler(ICrocoApplication application,
                                 ILogger <CreateUserCommandHandler> logger,
                                 UserService userService) : base(application, logger)
 {
     UserService = userService;
 }
Exemple #30
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ambientContext"></param>
 /// <param name="application"></param>
 /// <param name="emailSender"></param>
 public MailMessageSender(ICrocoAmbientContextAccessor ambientContext,
                          ICrocoApplication application,
                          EmailWrapperSender emailSender) : base(ambientContext, application)
 {
     EmailSender = emailSender;
 }