public ScopedService(IOpenHabMessageService openHab, IDataSingleton dataSingleton, UserDbContext context)
        {
            _openHab       = openHab;
            _dataSingleton = dataSingleton;
            _context       = context;

            Settings settings = _context.Settings.First();

            _dataSingleton.SetSettings(settings);
        }
 public UpdateHub(ILogger <UpdateHub> logger, DataDbContext context,
                  SignInManager <ShootingWebAgentUser> signInManager, UserManager <ShootingWebAgentUser> userManager,
                  IDataSingleton dataSingleton)
 {
     _logger        = logger;
     _context       = context;
     _signInManager = signInManager;
     _userManager   = userManager;
     _dataSingleton = dataSingleton;
 }
Ejemplo n.º 3
0
 public ChangePasswordModel(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     ILogger <ChangePasswordModel> logger, IDataSingleton iDataSingleton)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _logger         = logger;
     _iDataSingleton = iDataSingleton;
 }
        public ScopedService(IOpenHabMessageService openHab, IDataSingleton dataSingleton, UserDbContext context)
        {
            _openHab       = openHab;
            _dataSingleton = dataSingleton;
            _context       = context;

            _dataSingleton.SetGateTimeOut(_context.Settings.First(settings => settings.Id > 0).GateTimeout);
            _dataSingleton.SetStatusGatePath(_context.Settings.First(settings => settings.Id > 0).StatusOpenHabLink);
            _dataSingleton.SetGatePath(_context.Settings.First(settings => settings.Id > 0).GateOpenHabLink);
        }
 public ValuesController(UserDbContext context, IOpenHabMessageService openHab, IDataSingleton iDataSingleton,
                         SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager,
                         RoleManager <IdentityRole> roleManager)
 {
     _context        = context;
     _openHab        = openHab;
     _iDataSingleton = iDataSingleton;
     _signInManager  = signInManager;
     _userManager    = userManager;
     _roleManager    = roleManager;
 }
        public HomeController(UserDbContext context, IDataSingleton dataSingleton, IOpenHabMessageService habMessageService)
        {
            _context           = context;
            _iDataSingleton    = dataSingleton;
            _habMessageService = habMessageService;
            _myDataModel       = new DataModel(_iDataSingleton);

            string version = Assembly.GetEntryAssembly()?.GetName().Version.ToString();

            _myDataModel.VersionNumber = $"v{version?.Remove(version.Length - 2)}";

            List <User> users = _context.Users.OrderByDescending(u => u.LastConnection).ToList();

            _myDataModel.LastUsers = new List <string>();
            foreach (var user in users)
            {
                if (_myDataModel.LastUsers.Count <= 3)
                {
                    _myDataModel.LastUsers.Add(user.Name);
                }
            }

            if (users.Count > 0)
            {
                _myDataModel.LastConnection = users[0].LastConnection;
            }
            _myDataModel.UsersAllowed    = _context.Users.Where(u => u.AccessRights.Equals(AccessRights.Allowed)).ToList().Count;
            _myDataModel.UsersRegistered = _context.Users.ToList().Count;


            _myDataModel.Errors          = _context.ErrorLogs.Where(e => e.LogLevel.Equals(LogLevel.Error)).ToList().Count();
            _myDataModel.LogMessagesList = new List <string>();
            List <ErrorLog> errorLogs = _context.ErrorLogs.OrderByDescending(e => e.MsgDateTime).ToList();

            int iter = 0;

            foreach (var errorLog in errorLogs)
            {
                if (iter >= _max_Count)
                {
                    break;
                }

                _myDataModel.LogMessagesList.Add(errorLog.ToString());
                iter++;
            }
        }
Ejemplo n.º 7
0
 public ValuesController(UserDbContext context, IOpenHabMessageService openHab, IDataSingleton iDataSingleton)
 {
     _context        = context;
     _openHab        = openHab;
     _iDataSingleton = iDataSingleton;
 }
 public OpenHabMessageService(IDataSingleton iDataSingleton)
 {
     _iDataSingleton = iDataSingleton;
 }
 public LoginModel(SignInManager <IdentityUser> signInManager, ILogger <LoginModel> logger, IDataSingleton iDataSingleton)
 {
     _signInManager  = signInManager;
     _logger         = logger;
     _iDataSingleton = iDataSingleton;
 }
 public DataModel(IDataSingleton iDataSingleton)
 {
     _iDataSingleton = iDataSingleton;
 }
Ejemplo n.º 11
0
 public HomeController(ILogger <HomeController> logger, IDataSingleton dataSingleton, DataDbContext context)
 {
     _logger        = logger;
     _dataSingleton = dataSingleton;
     _context       = context;
 }
 public SettingsController(UserDbContext context, IDataSingleton iDataSingleton)
 {
     _context        = context;
     _iDataSingleton = iDataSingleton;
 }