public AggregatorController(AccountEF _accountContext, UserManager <UserAccountEF> userManager, IEmailSender emailSender, IClaimServiceFactory claimsManager)
 {
     accountContext = _accountContext;
     _userManager   = userManager;
     _emailSender   = emailSender;
     _claimsManager = claimsManager;
 }
 public HistoryController(ILogger <HistoryController> logger,
                          GridDataContext peiuGridDataContext, IClaimServiceFactory claimsManager,
                          AccountEF accountContext)
 {
     _accountContext      = accountContext;
     _peiuGridDataContext = peiuGridDataContext;
     this.claimsManager   = claimsManager;
     this.logger          = logger;
 }
Exemplo n.º 3
0
 public NotificationController(PeiuGridDataContext peiuGridDataContext, IRedisConnectionFactory redis,
                               AccountDataContext accountContext,
                               IClaimServiceFactory claimServiceFactory)
 {
     this.peiuGridDataContext = peiuGridDataContext;
     db = redis.Connection().GetDatabase(1);
     this.claimServiceFactory = claimServiceFactory;
     this._accountContext     = accountContext;
 }
 public NotificationController(PeiuGridDataContext peiuGridDataContext, IRedisConnectionFactory redis,
                               AccountEF accountContext, ILogger <NotificationController> logger, IClaimServiceFactory claimsManager,
                               IClaimServiceFactory claimServiceFactory)
 {
     this.peiuGridDataContext = peiuGridDataContext;
     db = redis.Connection().GetDatabase(1);
     this._accountContext = accountContext;
     this.logger          = logger;
     this._claimsManager  = claimsManager;
 }
Exemplo n.º 5
0
        public static string GetSiteIdsClaim(AccountEF _accountContext, IClaimServiceFactory _claimsManager, HttpContext httpContext)
        {
            var           result = GetAvaliableRccCodes(_accountContext, _claimsManager, httpContext);
            List <string> codes  = new List <string>();

            foreach (IGrouping <int, int> row in result)
            {
                codes.Add($"{row.Key}:{row}");
            }
            return(string.Join(',', codes));
        }
Exemplo n.º 6
0
 public ContractorController(UserManager <UserAccountEF> userManager,
                             SignInManager <UserAccountEF> signInManager, RoleManager <Role> _roleManager,
                             IEmailSender emailSender, IHTMLGenerator _htmlGenerator, IClaimServiceFactory claimsManager,
                             IStringLocalizer <LocalizedIdentityErrorDescriber> localizer,
                             AccountEF accountContext)
 {
     _userManager    = userManager;
     _accountContext = accountContext;
     _signInManager  = signInManager;
     _localizer      = localizer;
     _emailSender    = emailSender;
     htmlGenerator   = _htmlGenerator;
     roleManager     = _roleManager;
     _claimsManager  = claimsManager;
 }
 public BoardController(UserManager <UserAccountEF> userManager,
                        SignInManager <UserAccountEF> signInManager, RoleManager <Role> _roleManager,
                        IEmailSender emailSender, IHTMLGenerator _htmlGenerator, IClaimServiceFactory claimsManager, ILogger <BoardController> logger,
                        IConfiguration config, AccountEF accountEF, MysqlDataContext accountDataContext)
 {
     _userManager    = userManager;
     _accountContext = accountDataContext;
     _signInManager  = signInManager;
     _emailSender    = emailSender;
     htmlGenerator   = _htmlGenerator;
     roleManager     = _roleManager;
     _claimsManager  = claimsManager;
     _accountEF      = accountEF;
     this.logger     = logger;
 }
Exemplo n.º 8
0
 public AuthController(UserManager <UserAccount> userManager,
                       SignInManager <UserAccount> signInManager, RoleManager <Role> _roleManager,
                       IEmailSender emailSender, IHTMLGenerator _htmlGenerator, IClaimServiceFactory claimsManager,
                       IStringLocalizer <LocalizedIdentityErrorDescriber> localizer, ReservedRegisterNotifyPublisher _publisher,
                       AccountDataContext accountContext)
 {
     _userManager    = userManager;
     _accountContext = accountContext;
     _signInManager  = signInManager;
     _localizer      = localizer;
     _emailSender    = emailSender;
     htmlGenerator   = _htmlGenerator;
     Publisher       = _publisher;
     roleManager     = _roleManager;
     _claimsManager  = claimsManager;
 }
Exemplo n.º 9
0
 public StatisticsController(UserManager <UserAccount> userManager,
                             SignInManager <UserAccount> signInManager, RoleManager <Role> _roleManager, IRedisConnectionFactory redis, ILogger <StatisticsController> logger,
                             IEmailSender emailSender, IHTMLGenerator _htmlGenerator, IClaimServiceFactory claimsManager, PeiuGridDataContext peiuGridDataContext,
                             AccountDataContext accountContext)
 {
     _userManager         = userManager;
     _accountContext      = accountContext;
     _signInManager       = signInManager;
     _emailSender         = emailSender;
     htmlGenerator        = _htmlGenerator;
     roleManager          = _roleManager;
     _claimsManager       = claimsManager;
     _peiuGridDataContext = peiuGridDataContext;
     _redisConn           = redis.Connection();
     _redisDb             = _redisConn.GetDatabase();
     this.logger          = logger;
 }
 public AuthController(UserManager <UserAccountEF> userManager,
                       SignInManager <UserAccountEF> signInManager, RoleManager <Role> _roleManager, IDistributedCache distributedCache,
                       IEmailSender emailSender, IHTMLGenerator _htmlGenerator, IClaimServiceFactory claimsManager, ILogger <AuthController> logger,
                       IStringLocalizer <LocalizedIdentityErrorDescriber> localizer, IConfiguration config,
                       AccountEF accountContext)
 {
     _userManager          = userManager;
     _accountContext       = accountContext;
     _signInManager        = signInManager;
     _localizer            = localizer;
     _emailSender          = emailSender;
     htmlGenerator         = _htmlGenerator;
     roleManager           = _roleManager;
     _claimsManager        = claimsManager;
     this.distributedCache = distributedCache;
     WebServerUrl          = config.GetSection("WebServerUrl").Value;
     this.logger           = logger;
 }
Exemplo n.º 11
0
        public static bool ValidateSiteId(AccountEF _accountContext, IClaimServiceFactory _claimsManager, HttpContext httpContext, int siteId)
        {
            bool IsValidate = false;

            if (httpContext.User.IsInRole(UserRoleTypes.Supervisor))
            {
                IsValidate = _accountContext.VwContractorsites.Any(x => x.UserId != null && x.SiteId == siteId);
                //string key = $"Supervisor.Statistics.H{DateTime.Now.Hour}";
                //if (await _redisDb.HashExistsAsync(key, "chg") && await _redisDb.HashExistsAsync(key, "dhg"))
                //    return
                // datas.AddRange(await session.CreateCriteria<TodayAccumchgdhg>().ListAsync<TodayAccumchgdhg>());
            }
            else if (httpContext.User.IsInRole(UserRoleTypes.Contractor))
            {
                string userId = _claimsManager.GetClaimsValue(httpContext.User, ClaimTypes.NameIdentifier);
                IsValidate = _accountContext.VwContractorsites.Any(x => x.UserId != null && x.UserId == userId && x.SiteId == siteId);
            }
            else if (httpContext.User.IsInRole(UserRoleTypes.Aggregator))
            {
                string groupId = _claimsManager.GetClaimsValue(httpContext.User, UserClaimTypes.AggregatorGroupIdentifier);
                IsValidate = _accountContext.VwContractorsites.Any(x => x.UserId != null && x.AggGroupId == groupId && x.SiteId == siteId);
            }
            return(IsValidate);
        }
Exemplo n.º 12
0
        public static IEnumerable <IGrouping <int, VwContractorsiteEF> > GetAvaliableRccEntities(AccountEF _accountContext, IClaimServiceFactory _claimsManager, HttpContext httpContext)
        {
            IEnumerable <VwContractorsiteEF> results = null;

            if (httpContext.User.IsInRole(UserRoleTypes.Supervisor))
            {
                results = _accountContext.VwContractorsites.Where(x => x.UserId != null).ToArray();//.OrderBy(x => x.RCC).GroupBy(key => key.RCC, value => value.SiteId);
                //string key = $"Supervisor.Statistics.H{DateTime.Now.Hour}";
                //if (await _redisDb.HashExistsAsync(key, "chg") && await _redisDb.HashExistsAsync(key, "dhg"))
                //    return
                // datas.AddRange(await session.CreateCriteria<TodayAccumchgdhg>().ListAsync<TodayAccumchgdhg>());
            }
            else if (httpContext.User.IsInRole(UserRoleTypes.Contractor))
            {
                string userId = _claimsManager.GetClaimsValue(httpContext.User, ClaimTypes.NameIdentifier);
                results = _accountContext.VwContractorsites.Where(x => x.UserId != null && x.UserId == userId);
            }
            else if (httpContext.User.IsInRole(UserRoleTypes.Aggregator))
            {
                string groupId = _claimsManager.GetClaimsValue(httpContext.User, UserClaimTypes.AggregatorGroupIdentifier);
                results = _accountContext.VwContractorsites.Where(x => x.UserId != null && x.AggGroupId == groupId);
            }
            return(results.OrderBy(x => x.RCC).GroupBy(key => key.RCC, value => value));
        }
Exemplo n.º 13
0
        public static IEnumerable <int> GetAvaliableSiteIdsByAggGroupId(AccountEF _accountContext, IClaimServiceFactory _claimsManager, HttpContext httpContext, string AggGroupId)
        {
            IEnumerable <VwContractorsiteEF> results = null;

            if (httpContext.User.IsInRole(UserRoleTypes.Supervisor))
            {
                results = _accountContext.VwContractorsites.Where(x => x.AggGroupId == AggGroupId);
                //string key = $"Supervisor.Statistics.H{DateTime.Now.Hour}";
                //if (await _redisDb.HashExistsAsync(key, "chg") && await _redisDb.HashExistsAsync(key, "dhg"))
                //    return
                // datas.AddRange(await session.CreateCriteria<TodayAccumchgdhg>().ListAsync<TodayAccumchgdhg>());
            }
            else
            {
                return(null);
            }
            return(results.Select(x => x.SiteId).ToArray());
        }