Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //_profileRepository = new ProfileRepository();
            _fr = new FileRepository();
            _userSession = new UserSession();
            _accountRepository = new AccountRepository();
            _webContext = new WebContext();

                if (_userSession.LoggedIn && _userSession.CurrentUser != null)
                {
                    account = _userSession.CurrentUser;
                    file = _fr.GetFileByID(fileID);
                }

            //show the appropriate image

            if (file != null)
            {

                //Response.Clear();
                Response.ContentType = "jpg";
                Response.BinaryWrite(file.ContentFile.ToArray());

            }
        }
        public IEnumerable<IRoom> GetAvailableRooms(IUserSession session)
        {
            Contract.Requires(session != null, "session is null.");
            Contract.Ensures(Contract.Result<IEnumerable<IRoom>>() != null);

            return default(IEnumerable<IRoom>);
        }
Esempio n. 3
0
        public ProfilePresenter()
        {
            _redirector = ObjectFactory.GetInstance<IRedirector>();
            _userSession = ObjectFactory.GetInstance<IUserSession>();
            if (!_userSession.LoggedIn || _userSession.CurrentUser == null)
                _redirector.GoToAccountLoginPage();

            _alertService = ObjectFactory.GetInstance<IAlertService>();
            _webContext = ObjectFactory.GetInstance<IWebContext>();
            _accountService = ObjectFactory.GetInstance<IAccountService>();
            _privacyService = ObjectFactory.GetInstance<IPrivacyService>();
            _account = _userSession.CurrentUser;

            if (_webContext.AccountID > 0 && _webContext.AccountID != _userSession.CurrentUser.AccountID)
            {
                _accountBeingViewed = _accountService.GetAccountByID(_webContext.AccountID);
                _accountBeingViewed.Profile = Profile.GetProfileByAccountID(_webContext.AccountID);
            }
            else
            {
                _accountBeingViewed = _userSession.CurrentUser;
                _accountBeingViewed.Profile = Profile.GetProfileByAccountID(_userSession.CurrentUser.AccountID);
            }
            if (_accountBeingViewed == null)
                _redirector.GoToAccountLoginPage();
            if (_accountBeingViewed.Profile != null && _accountBeingViewed.Profile.ProfileID > 0)
                _privacyFlags = PrivacyFlag.GetPrivacyFlagsByProfileID(_accountBeingViewed.Profile.ProfileID);
            else
                _redirector.GoToHomePage();

        }
Esempio n. 4
0
 public UploadAvatarPresenter()
 {
     _userSession =new UserSession();
     _profileRepository = new ProfileRepository();
     _redirector = new Redirector();
     _alertService = new AlertService();
 }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _webContext = new WebContext();
     _userSession=new UserSession();
     if (!_userSession.LoggedIn)
     {
         _redirector.GoToAccountLoginPage();
     }
     else
     {
         _permissionRepository = new PermissionRepository();
         Account account=_userSession.CurrentUser;
         List<Permission> permissions = _permissionRepository.GetPermissionsByAccountID(account.AccountID);
         int i=0;
         foreach (Permission p in permissions)
         {
             if (p.PermissionID != _permissionRepository.GetPermissionByName("Admin").PermissionID)
             {
                 i++;
             }
         }
         if (i == permissions.Count)
         {
             linkAddcate.Visible = false;
             linkAddForum.Visible = false;
             lblMessage.Text = "Chỉ có Addmin mới có quyền xem trang này";
         }
     }
 }
        public ICard SaveCard(IUserSession session, ICard newCard)
        {
            CardEffect effect = new CardEffect
            {
                Affected = (int)newCard.Effect.Affected,
                CardAttackChange = newCard.Effect.CardAttackChange,
                CardAttackMultiplier = newCard.Effect.CardAttackMultiplier,
                Description = newCard.Effect.Description,
                DisableOpponentEffect = newCard.Effect.DisableOpponentEffect,
                EffectTiming = (int)newCard.Effect.EffectTiming,
                LifePointsChange = newCard.Effect.LifePointsChange,
                Name = newCard.Effect.Name,
                ProbabilityOfEffect = newCard.Effect.ProbabilityOfEffect
            };

            Card created = new Card
            {
                Name = newCard.Name,
                ImageUrl = newCard.ImageUrl,
                Effect = effect,
                AttackPoints = newCard.AttackPoints,
                DefensePoints = newCard.DefensePoints
            };

            RequestContext.Model<Entities>().AddToCards(created);
            RequestContext.Model<Entities>().SaveChanges();

            return created;
        }
 public PublicController(
     IMiddleManagement MiddleManagement,
     IUserSession UserSession,
     IFormsAuthentication FormAuthentication)
     : base(MiddleManagement, UserSession, FormAuthentication)
 {
 }
Esempio n. 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     re = new SPKTCore.Core.Impl.Redirector();
     _userSession = new UserSession();
     if (_userSession.LoggedIn)
         re.GotoHomePage();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JoinController"/> class.
 /// </summary>
 /// <param name="userRepository">The user repository.</param>
 /// <param name="fileService">The file service.</param>
 /// <param name="userSession">The user session.</param>
 /// <param name="joinRepository">The join repository.</param>
 public RegisterController(IUserRepository userRepository, IStorage fileService, IUserSession<Domain.Model.User> userSession, IJoinRepository joinRepository)
 {
     _userRepository = userRepository;
     _joinRepository = joinRepository;
     _fileService = fileService;
     _userSession = userSession;
 }
Esempio n. 10
0
 public AlertService()
 {
     _userSession = new UserSession();
     _alertRepository = new AlertRepository();
     _webContext = new WebContext();
     alert = new Alert();
 }
Esempio n. 11
0
        public SessionQueryContext(IUserSession session)
        {
            if (session == null)
                throw new ArgumentNullException("session");

            this.session = session;
        }
Esempio n. 12
0
 public CommentsPresenter()
 {
     _commentRepository = new CommentRepository();
     _webContext = new WebContext();
     _userSession = new UserSession();
     _alertService = new AlertService();
 }
Esempio n. 13
0
 public HomePresenter()
 {
     _userSession = new UserSession();
     _accountService=new AccountService();
     _redirector = new Redirector();
     _profileService = new ProfileService();
 }
 public ManagePrivacyPresenter()
 {
     _profileService = ObjectFactory.GetInstance<IProfileService>();
     _userSession = ObjectFactory.GetInstance<IUserSession>();
     account = _userSession.CurrentUser;
     profile = _profileService.LoadProfileByAccountID(account.AccountID);
 }
Esempio n. 15
0
        public GrantManager(IUserSession session)
        {
            Session = session;

            context = new SessionQueryContext(session);
            privCache = new MemoryCache(16, 256, 10);
        }
Esempio n. 16
0
 public ReadMessagePresenter()
 {
     _webContext = new WebContext();
     _userSession = new UserSession();
     _redirector = new Redirector();
     _messageRepository = new SPKTCore.Core.DataAccess.Impl.MessageRepository();
 }
Esempio n. 17
0
        public void TestTearDown()
        {
            OnTearDown();

            if (QueryContext != null)
                QueryContext.Dispose();

            if (session != null)
                session.Dispose();

            if (Database != null)
                Database.Dispose();

            if (DatabaseContext != null)
                DatabaseContext.Dispose();

            if (SystemContext != null)
                SystemContext.Dispose();

            Database = null;
            DatabaseContext = null;
            SystemContext = null;
            QueryContext = null;
            session = null;
        }
Esempio n. 18
0
 public BoxFriendPresenter()
 {
     _friendRepository = new SPKTCore.Core.DataAccess.Impl.FriendRepository();
     _userSession = new SPKTCore.Core.Impl.UserSession();
     _friendService = new FriendService();
     _friendInvite = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository();
 }
Esempio n. 19
0
 public MyBlogsPresenter()
 {
     _webContext = ObjectFactory.GetInstance<IWebContext>();
     _blogRepository = ObjectFactory.GetInstance<IBlogRepository>();
     _redirector = ObjectFactory.GetInstance<IRedirector>();
     _userSession = ObjectFactory.GetInstance<IUserSession>();
 }
 public OrderingHistoryCommandService(IOrderingHistoryService orderingHistoryService, IUnitOfWork unitOfWork, ICommandExecutor executor)
 {
   _orderingHistoryService = orderingHistoryService;
   _unitOfWork = unitOfWork;
   _executor = executor;
   _userSession = new UserSession();
 }
 public TypeMemberCommandService(ITypeMemberService typeMemberService, IUnitOfWork unitOfWork, ICommandExecutor executor)
 {
   _typeMemberService = typeMemberService;
   _unitOfWork = unitOfWork;
   _executor = executor;
   _userSession = new UserSession();
 }
 public ContentMenuCommandService(IContentMenuService contentMenuService, IUnitOfWork unitOfWork, ICommandExecutor executor)
 {
   _contentMenuService = contentMenuService;
   _unitOfWork = unitOfWork;
   _executor = executor;
   _userSession = new UserSession();
 }
Esempio n. 23
0
 public PersonReportService(ICommandExecutor executor, IRepository<Domain.Entity.User> userRepository, IPersonService personService)
 {
   _executor = executor;
   _personService = personService;
   _userRepository = userRepository;
   _userSession = new UserSession();
 }
        public void Dispatch(IUserSession userSession, object command)
        {

            try
            {
             
                _decoratedDispatcher.Dispatch(userSession,command);

               
            }
            catch (Exception e)
            {
                var errorMessage = "1) Error calling " + command.GetType() + "\n";
              
              var properties = command.GetType().GetProperties();
              var propertiesMessage = properties.Aggregate("", (current, property) => current + ("Property Name " + property.Name + " Property Value " + property.GetValue(command)));

              errorMessage += "2) " + propertiesMessage + "\n";
                errorMessage += "3) " + e.Message; 
              _logger.Error(errorMessage);
              
              throw;

            }
        }
Esempio n. 25
0
 public TableQueryInfo(IUserSession session, TableInfo tableInfo, ObjectName tableName, ObjectName aliasName)
 {
     Session = session;
     TableInfo = tableInfo;
     TableName = tableName;
     AliasName = aliasName;
 }
Esempio n. 26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _usersession = new UserSession();
     _for = new FolderRepository();
     _redirect = new Redirector();
     up = new UploadAvatarPresenter();
 }
 void ValidateTheCommand(IUserSession userSession, object command)
 {
     foreach (object validator in GetMatchingCommandValidators(command))
     {
         InvokeMethod("Validate", validator, userSession, command);
     }
 }
Esempio n. 28
0
 public NotifycationControlPresenter()
 {
     _webContext = new WebContext();
     _userSession = new UserSession();
     _redirector = new Redirector();
     _notifycationService = new NotificationService();
 }
        public void Init(IInviteFriends view)
        {
            _view = view;
            _userSession = ObjectFactory.GetInstance<IUserSession>();
            _email = ObjectFactory.GetInstance<IEmail>();
            _webContext = ObjectFactory.GetInstance<IWebContext>();
            _account = _userSession.CurrentUser;

            if (_account != null)
            {
                _view.DisplayToData(_account.FirstName + " " + _account.LastName + " &lt;" + _account.Email + "&gt;");

                if (_webContext.AccoundIdToInvite > 0)
                {
                    _accountToInvite = Account.GetAccountByID(_webContext.AccoundIdToInvite);

                    if (_accountToInvite != null)
                    {
                        SendInvitation(_accountToInvite.Email,
                                       _accountToInvite.FirstName + " " + _accountToInvite.LastName + " muốn kết bạn với bạn!");
                        _view.ShowMessage(" Yêu cầu kết bạn đã được gửi đến" + _accountToInvite.Username);
                        _view.TogglePnlInvite(false);
                    }
                }
            }
        }
Esempio n. 30
0
        public void Init(IInviteFriends view)
        {
            _view = view;
            //_userSession = ObjectFactory.GetInstance<IUserSession>();
            //_email = ObjectFactory.GetInstance<IEmail>();
            //_friendInvitationRepository = ObjectFactory.GetInstance<IFriendInvitationRepository>();
            //_accountRepository = ObjectFactory.GetInstance<IAccountRepository>();
            //_webContext = ObjectFactory.GetInstance<IWebContext>();
            _userSession = new SPKTCore.Core.Impl.UserSession();
            _friendInvitationRepository = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository();
            _email = new SPKTCore.Core.Impl.Email();
            _webContext = new SPKTCore.Core.Impl.WebContext();
            if (_userSession.LoggedIn)
            {
                _account = _userSession.CurrentUser;
                _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository();
                if (_account != null)
                {
                    _view.DisplayToData(_account.UserName + " &lt;" + _account.Email + "&gt;");

                    if (_webContext.AccoundIdToInvite > 0)
                    {
                        _accountToInvite = _accountRepository.GetAccountByID(_webContext.AccoundIdToInvite);

                        if (_accountToInvite != null)
                        {
                            SendInvitation(_accountToInvite.Email,
                                           _account.UserName + " " + _account.UserName + " ");
                            _view.ShowMessage(_accountToInvite.UserName + " Đã được gửi đi!");
                            _view.TogglePnlInvite(false);
                        }
                    }
                }
            }
        }
 public ExchangeRateReportService(ICommandExecutor executor, IExchangeRateService exchangeRateService)
 {
     _executor            = executor;
     _exchangeRateService = exchangeRateService;
     _userSession         = new UserSession();
 }
Esempio n. 32
0
 /// <summary>
 /// 服务标准化的通用实现
 /// </summary>
 public void Initialize(IUserSession session, DateTime currentTime, TypedHashtable cachingStates)
 {
     _CurrentSession = session;
     _CurrentTime    = currentTime;
     _Cache          = cachingStates;
 }
 public void OnDestroyed(IUserSession userSession)
 {
     _onDestroyed(userSession);
 }
 public void OnEstablished(IUserSession userSession)
 {
     _onEstablished(userSession);
 }
Esempio n. 35
0
 public TaskService(IProjectRepository projectRepository, ITaskRepository taskRepository, IUserSession userSession, IAppSettings appSettings,
                    IServiceStackClient serviceStackClient, ServiceFactory serviceFactory)
 {
     _userSession        = userSession;
     _appSettings        = appSettings;
     _serviceStackClient = serviceStackClient;
     _serviceFactory     = serviceFactory;
     _projectRepository  = projectRepository;
     _taskRepository     = taskRepository;
     _userSession        = userSession;
 }
Esempio n. 36
0
 public PreInsertHasRowLevelSecurityHook(IUserSession session)
 {
     _session = session ?? throw new ArgumentNullException(nameof(session));
 }
 public TntQueryProcessor(ISession session, IUserSession userSession, IDateTime dateTime)
 {
     _session     = session;
     _userSession = userSession;
     _dateTime    = dateTime;
 }
Esempio n. 38
0
 public Handler(IUserSession userSession) => _userSession = userSession;
Esempio n. 39
0
 public Handler(IMailer mailer, UserManager <User> userManager, IUserSession <User> userSession)
 {
     _mailer      = mailer;
     _userManager = userManager;
     _userSession = userSession;
 }
Esempio n. 40
0
 public UnturnedUserSession(UnturnedUser user, IUserSession baseSession)
 {
     User             = user;
     SessionData      = baseSession?.SessionData ?? new Dictionary <string, object>();
     SessionStartTime = baseSession?.SessionStartTime ?? DateTime.Now;
 }
 public WsFederationSigninEndpoint(ILogger <WsFederationSigninEndpoint> logger, IdentityServerOptions options, IWsFederationRequestValidator validator, IWsFederationResponseGenerator responseGenerator, IUserSession userSession)
 {
     _logger            = logger;
     _options           = options;
     _validator         = validator;
     _responseGenerator = responseGenerator;
     _userSession       = userSession;
 }
Esempio n. 42
0
 public void LogInfo(IUserSession userSession, object sender, DateTime timeStamp, string message, object command)
 {
     _logger.InfoFormat("{0}: {1}", sender.GetType().Name, message);
 }
Esempio n. 43
0
 public void LogException(IUserSession userSession, object sender, DateTime timeStamp, Exception exception,
                          object command)
 {
 }
 public NumberingDbContext(IHookEngine hookEngine,
                           IUserSession session,
                           DbContextOptions <NumberingDbContext> options) : base(hookEngine, session, options)
 {
 }
Esempio n. 45
0
 public PreUpdateModificationTrackingHook(IUserSession session, IDateTime dateTime)
 {
     _session  = session ?? throw new ArgumentNullException(nameof(session));
     _dateTime = dateTime ?? throw new ArgumentNullException(nameof(dateTime));
 }
Esempio n. 46
0
 public AddTeamToCommand(string[] cmdArgs, IUserSession session)
     : base(cmdArgs, session)
 {
 }
Esempio n. 47
0
        public async Task <bool> DoDMTest(IUserSession session, List <int> testSeq)
        {
            var successStatus = true;

            try
            {
                // 1
                long dmid = 0;
                if (testSeq.Contains(1))
                {
                    ConsoleOutput.PrintMessage("3.1 DirectMessages\\GetDirectMessages", ConsoleColor.Gray);
                    var directmessages1 = await session.GetDirectMessages();

                    if (directmessages1.OK)
                    {
                        dmid = directmessages1.ToList()[0].Id;
                        foreach (var x in directmessages1)
                        {
                            ConsoleOutput.PrintMessage(
                                string.Format("ID: {2} // From: {0} // Message: {1}", x.SenderScreenName, x.Text, x.Id));
                        }
                    }
                    else
                    {
                        successStatus = false;
                    }
                }

                // 2
                if (testSeq.Contains(2))
                {
                    ConsoleOutput.PrintMessage("3.2 DirectMessages\\GetDirectMessagesSent", ConsoleColor.Gray);
                    var directmessages2 = await session.GetDirectMessagesSent();

                    if (directmessages2.OK)
                    {
                        foreach (var x in directmessages2)
                        {
                            ConsoleOutput.PrintMessage(
                                String.Format("To: {0} // Message: {1}", x.Recipient.ScreenName, x.Text));
                        }
                    }
                    else
                    {
                        successStatus = false;
                    }
                }

                // 3
                if (testSeq.Contains(3))
                {
                    ConsoleOutput.PrintMessage("3.3 DirectMessages\\GetDirectMessageSingle", ConsoleColor.Gray);
                    var directmessages3 = await session.GetDirectMessageSingle(dmid);

                    if (directmessages3.OK)
                    {
                        ConsoleOutput.PrintMessage(
                            String.Format("From: {0} // Message: {1}", directmessages3.SenderScreenName, directmessages3.Text));
                    }
                    else
                    {
                        successStatus = false;
                    }
                }

                // 4
                if (testSeq.Contains(4))
                {
                    ConsoleOutput.PrintMessage("3.4 DirectMessages\\SendDirectMessage", ConsoleColor.Gray);
                    var directmessages4 =
                        await session.SendDirectMessage("livefire test of boxkite.twitter please ignore", "nickhodgeau");

                    if (directmessages4.OK)
                    {
                        ConsoleOutput.PrintMessage(
                            String.Format("From: {0} // Message: {1}", directmessages4.SenderScreenName, directmessages4.Text));
                    }
                    else
                    {
                        successStatus = false;
                    }
                }

                // 5
                if (testSeq.Contains(5))
                {
                    ConsoleOutput.PrintMessage("3.5 DirectMessages\\SendDirectMessage > 140 chars", ConsoleColor.Gray);

                    var directmessage5contents = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";

                    var directmessages5 =
                        await session.SendDirectMessage("realnickhodge", directmessage5contents);

                    if (directmessages5.OK)
                    {
                        ConsoleOutput.PrintMessage(
                            String.Format("From: {0} // Length: {1} // Message: {2}", directmessages5.SenderScreenName,
                                          directmessage5contents.Length, directmessages5.Text));
                    }
                    else
                    {
                        ConsoleOutput.PrintError(
                            String.Format("Error: {0}", directmessages5.twitterControlMessage.twitter_error_message));
                        successStatus = false;
                    }
                }
            }
            catch (Exception e)
            {
                ConsoleOutput.PrintError(e.ToString());
                return(false);
            }
            return(successStatus);
        }
Esempio n. 48
0
        public ActionResult Asset(string assetIdNum, string isCheckedIn)
        {
            string   assetId = "a/" + assetIdNum;
            DateTime now     = DateTime.Now;

            if (isPreviewRequest)
            {
                using (IUserSession session = _ContentStore.OpenReadSession(_CurrentUser))
                {
                    IAsset asset = session.Site.Asset(assetId);

                    if (asset.IsExternal)
                    {
                        Response.Redirect(asset.ExternalUrl, true);
                    }

                    if (asset == null || asset.StartDate > now)
                    {
                        throw new HttpException(404, string.Format("Asset {0} not found.", assetId));
                    }
                    if (asset.EndDate < now)
                    {
                        throw new HttpException(404, string.Format("Asset {0} has expired.", assetId));
                    }

                    FileInfo file     = asset.File();
                    string   mimeType = MimeMapping.GetMimeMapping(file.FullName);
                    return(new RangeFilePathResult(mimeType, file.FullName, file.LastWriteTimeUtc, file.Length));
                    //return base.File(file.FullName, mimeType);
                }
            }
            else
            {
                SitePath = CmsRoute.GetSitePath();
                Assets.AssetFactory map = Assets.AssetFactory.Get(SitePath);
                var assetMapEntry       = map.GetAssetByID(assetId);

                Assets.AssetTree tree = Assets.AssetTree.Get(CmsRoute.GetSitePath());
                var assetTreeEntry    = tree.GetNode(assetId);
                if (assetTreeEntry != null && !assetTreeEntry.Valid())
                {
                    if (assetMapEntry != null)
                    {
                        throw new HttpException(404, string.Format("Asset {0} is invalid.", assetMapEntry.Url));
                    }
                    else
                    {
                        throw new HttpException(404, string.Format("Asset {0} is invalid.", assetId));
                    }
                }

                if (assetMapEntry != null && assetMapEntry.IsExternal)
                {
                    Response.Redirect(assetMapEntry.FilePath, true);
                }

                if (assetMapEntry == null)
                {
                    throw new HttpException(404, string.Format("Asset {0} not found.", assetId));
                }
                if (!assetMapEntry.Valid())
                {
                    throw new HttpException(404, string.Format("Asset {0} is invalid.", assetMapEntry.FilePath));
                }

                string   filePath = Uri.UnescapeDataString(assetMapEntry.FilePath);
                FileInfo file     = new FileInfo(filePath);
                string   mimeType = MimeMapping.GetMimeMapping(file.FullName);

                if (file.Length == 0)
                {
                    return(File(file.FullName, mimeType));
                }

                return(new RangeFilePathResult(mimeType, file.FullName, file.LastWriteTimeUtc, file.Length));
                //return base.File(file.FullName, mimeType);
            }
        }
Esempio n. 49
0
 public LoginCommand(string[] cmdArgs, IUserSession session)
     : base(cmdArgs, session)
 {
 }
Esempio n. 50
0
 public WsFederationRedirectEndSessionRequestValidator(EndSessionRequestValidator validator, IEnumerable <Client> clients, IHttpContextAccessor context, IdentityServerOptions options, ITokenValidator tokenValidator, IRedirectUriValidator uriValidator, IUserSession userSession, IClientStore clientStore, IMessageStore <EndSession> endSessionMessageStore, ILogger <WsFederationRedirectEndSessionRequestValidator> logger)
 {
     _validator = validator;
     _clients   = clients;
     _logger    = logger;
 }
Esempio n. 51
0
 public ChatController(ChatUserSessionRepository chatUserSessionRepository, ChatSessionRepository chatSessionRepository, ChatMessageRepository chatMessageRepository, IUserSession userSession)
 {
     ChatMessageRepository     = chatMessageRepository;
     ChatSessionRepository     = chatSessionRepository;
     ChatUserSessionRepository = chatUserSessionRepository;
     UserSession = userSession;
 }
Esempio n. 52
0
 /// <summary>
 /// Initialises new instance of <see cref="ComponentActionController"/>
 /// </summary>
 /// <param name="commonRepository"></param>
 public ComponentActionController(ICommonRepository commonRepository, IUserSession userSession)
 {
     this.commonRepository = commonRepository;
     this.userSession      = userSession;
 }
Esempio n. 53
0
        public async Task ExecuteAsync(HttpContext context)
        {
            _userSession = _userSession ?? context.RequestServices.GetRequiredService <IUserSession>();

            await ProcessResponseAsync(context);
        }
Esempio n. 54
0
 public AuthorizationConfig(IUserSession <User> userSession)
 {
     _userSession = userSession;
 }
Esempio n. 55
0
 /* We define a default value for TenantInfo. This is a hack. FinBuckle does not provide any method to init TenantInfo or define a default value when seeding the database (in DatabaseInitializer, HttpContext is not yet initialized). */
 public ApplicationDbContext(TenantInfo tenantInfo, DbContextOptions <ApplicationDbContext> options, IUserSession userSession)
     : base(tenantInfo ?? TenantStoreDbContext.DefaultTenant, options)
 {
     TenantNotSetMode   = TenantNotSetMode.Overwrite;
     TenantMismatchMode = TenantMismatchMode.Overwrite;
     _userSession       = userSession;
 }
Esempio n. 56
0
 public ExpenseRepository(IUserSession userSession)
 {
     this.userSession = userSession;
 }
 /// <summary>
 /// Constructs a new instance of this repository
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="messageBus"></param>
 public AuditEntryRepository(IPersistenceContext <AuditEntry> dbContext, IUserSession userSession, MessageBus messageBus = null) : base(dbContext, messageBus)
 {
     UserSession = userSession;
 }
Esempio n. 58
0
        public ApiLogService(IConfiguration configuration, ApplicationDbContext db, IMapper autoMapper, UserManager <ApplicationUser> userManager, IHttpContextAccessor httpContextAccessor, IUserSession userSession)
        {
            _db                  = db;
            _autoMapper          = autoMapper;
            _userManager         = userManager;
            _httpContextAccessor = httpContextAccessor;
            _userSession         = userSession;

            // Calling Log from the API Middlware results in a disposed ApplicationDBContext. This is here to build a DB Context for logging API Calls
            // If you have a better solution please let me know.
            _optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();
            if (Convert.ToBoolean(configuration["BlazorBoilerplate:UseSqlServer"] ?? "false"))
            {
                _optionsBuilder.UseSqlServer(configuration.GetConnectionString("DefaultConnection")); //SQL Server Database
            }
            else
            {
                _optionsBuilder.UseSqlite($"Filename={configuration.GetConnectionString("SqlLiteConnectionFileName")}");  // Sql Lite / file database
            }
        }
Esempio n. 59
0
 public AcceptInviteCommand(string[] cmdArgs, IUserSession session)
     : base(cmdArgs, session)
 {
 }
        /// <summary>
        /// Returns the most recent direct messages sent by the authenticating user.
        /// </summary>
        /// <param name="sinceId">Returns results with an ID greater than (that is, more recent than) the specified ID</param>
        /// <param name="maxId">Returns results with an ID less than (that is, older than) or equal to the specified ID</param>
        /// <param name="count">Specifies the number of direct messages to try and retrieve, up to a maximum of 200</param>
        /// <returns>(awaitable) IEnumerable of DirectMessages Sent by the session's authenticated user</returns>
        /// <remarks>ref: https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent </remarks>
        public async static Task <TwitterResponseCollection <DirectMessage> > GetDirectMessagesSent(this IUserSession session, long sinceId = 0, long maxId = 0, int count = 20)
        {
            var parameters = new TwitterParametersCollection();

            parameters.Create(include_entities: true, count: count, since_id: sinceId,
                              max_id: maxId, full_text: true);

            return(await session.GetAsync(TwitterApi.Resolve("/1.1/direct_messages/sent.json"), parameters)
                   .ContinueWith(c => c.MapToMany <DirectMessage>()));
        }