Example #1
0
        public void CreateTaskForAccount(Account account)
        {
            var bus = RabbitHutch.CreateBus(rabbitConnectionString);

            using (_unitOfWorkFactory.Create())
            {
                bus.Publish(new PlayerInfoRequest { PlayerId = account.PlayerId });
            }

            bus.Dispose();
        }
        public IEnumerable<StatisticItemData> GetGraphicData(Account account, Func<StatisticalData, double> getPropertyValue,
            DateTime startDate, DateTime endDate)
        {
            var statistics = Query
                .For<IEnumerable<StatisticalData>>()
                .With(new StatisticSearchPeriodCriterion(account.PlayerId, startDate, endDate));

            return statistics != null
                ? statistics.Select(x => new StatisticItemData(x.Date, getPropertyValue(x)))
                : Enumerable.Empty<StatisticItemData>();
        }
Example #3
0
        public void LogIn(Account account)
        {
            var accountEntry = new AccountEntry(account);

            var authTicket = new FormsAuthenticationTicket(1,
                account.Name,
                DateTime.Now,
                DateTime.Now.Add(FormsAuthentication.Timeout),
                true,
                accountEntry.Serialize());

            var encryptedTicket = FormsAuthentication.Encrypt(authTicket);

            var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
            {
                Expires = DateTime.Now.Add(FormsAuthentication.Timeout),
            };

            HttpContext.Current.Response.Cookies.Add(authCookie);
            var identity = new CustomIdentity(accountEntry, authTicket.Name);
            HttpContext.Current.User = new GenericPrincipal(identity, null);
        }