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>); }
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(); }
public UploadAvatarPresenter() { _userSession =new UserSession(); _profileRepository = new ProfileRepository(); _redirector = new Redirector(); _alertService = new AlertService(); }
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) { }
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; }
public AlertService() { _userSession = new UserSession(); _alertRepository = new AlertRepository(); _webContext = new WebContext(); alert = new Alert(); }
public SessionQueryContext(IUserSession session) { if (session == null) throw new ArgumentNullException("session"); this.session = session; }
public CommentsPresenter() { _commentRepository = new CommentRepository(); _webContext = new WebContext(); _userSession = new UserSession(); _alertService = new AlertService(); }
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); }
public GrantManager(IUserSession session) { Session = session; context = new SessionQueryContext(session); privCache = new MemoryCache(16, 256, 10); }
public ReadMessagePresenter() { _webContext = new WebContext(); _userSession = new UserSession(); _redirector = new Redirector(); _messageRepository = new SPKTCore.Core.DataAccess.Impl.MessageRepository(); }
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; }
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(); }
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(); }
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; } }
public TableQueryInfo(IUserSession session, TableInfo tableInfo, ObjectName tableName, ObjectName aliasName) { Session = session; TableInfo = tableInfo; TableName = tableName; AliasName = aliasName; }
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); } }
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 + " <" + _account.Email + ">"); 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); } } } }
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 + " <" + _account.Email + ">"); 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(); }
/// <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); }
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; }
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; }
public Handler(IUserSession userSession) => _userSession = userSession;
public Handler(IMailer mailer, UserManager <User> userManager, IUserSession <User> userSession) { _mailer = mailer; _userManager = userManager; _userSession = userSession; }
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; }
public void LogInfo(IUserSession userSession, object sender, DateTime timeStamp, string message, object command) { _logger.InfoFormat("{0}: {1}", sender.GetType().Name, message); }
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) { }
public PreUpdateModificationTrackingHook(IUserSession session, IDateTime dateTime) { _session = session ?? throw new ArgumentNullException(nameof(session)); _dateTime = dateTime ?? throw new ArgumentNullException(nameof(dateTime)); }
public AddTeamToCommand(string[] cmdArgs, IUserSession session) : base(cmdArgs, session) { }
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); }
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); } }
public LoginCommand(string[] cmdArgs, IUserSession session) : base(cmdArgs, session) { }
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; }
public ChatController(ChatUserSessionRepository chatUserSessionRepository, ChatSessionRepository chatSessionRepository, ChatMessageRepository chatMessageRepository, IUserSession userSession) { ChatMessageRepository = chatMessageRepository; ChatSessionRepository = chatSessionRepository; ChatUserSessionRepository = chatUserSessionRepository; UserSession = userSession; }
/// <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; }
public async Task ExecuteAsync(HttpContext context) { _userSession = _userSession ?? context.RequestServices.GetRequiredService <IUserSession>(); await ProcessResponseAsync(context); }
public AuthorizationConfig(IUserSession <User> userSession) { _userSession = userSession; }
/* 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; }
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; }
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 } }
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>())); }