public override IEmailRecipients GetRecipients()
 {
     return(new EmailRecipientsWithPermission(
                Organization,
                ActionsRequiringPermissions.ManageAccount,
                replyTo: new[] { RequestingUser.ToMailAddress() }));
 }
Пример #2
0
        public static void AddDummyUserIfRequired(Funq.Container container)
        {
            // create a dummy user
            var fac = container.Resolve <IDbConnectionFactory> ();

            using (var db = fac.OpenDbConnection()) {
                if (db.FirstOrDefault <DBUser> (u => u.Username == "dummy") == null)
                {
                    var user = new DBUser();
                    user.Username = "******";
                    user.CreateCryptoFields("foobar123");
                    user.FirstName                 = "John Dummy";
                    user.LastName                  = "Doe";
                    user.AdditionalData            = "Dummy user that is created when in development mode";
                    user.IsActivated               = true;
                    user.IsVerified                = true;
                    user.Manifest.LastSyncRevision = 0;
                    user.EmailAddress              = "*****@*****.**";
                    db.Insert <DBUser> (user);
                    // insert some sample notes
                    var f   = container.Resolve <DbStorageFactory> ();
                    var key = user.GetPlaintextMasterKey("foobar123");
                    var r   = new RequestingUser {
                        Username            = "******",
                        EncryptionMasterKey = key.ToHexString()
                    };
                    // populate with note test cases taken from Tomdroid
                    // these notes will fail Tomboy...
                    using (var storage = f.GetDbStorage(r)) {
                        var sample_notes = new DiskStorage("../../../sample_notes/");
                        sample_notes.GetNotes().Values.ToList().ForEach(n => storage.SaveNote(n));
                    }
                }
            }
        }
        public async void SendNotification(List <Bet> betinvolved, string notificationType)
        {
            foreach (var item in betinvolved)
            {
                var userId    = item.UserId;
                var usrername = await _accountService.GetusernamebyUserId(userId);

                var h = await _conser.getHconnectionId(usrername);

                var l = await _conser.getLconnectionId(usrername);

                RequestingUser RUser = new RequestingUser()
                {
                    Username = usrername,
                };
                await _OfferService.AddNotification(item, notificationType, RUser);

                if (h[0] != "")
                {
                    foreach (var item2 in h)
                    {
                        await _BetSystemHub.Clients.Client(item2).SendAsync("newMatchedBet", item);
                    }
                }
                if (l[0] != "")
                {
                    foreach (var item2 in l)
                    {
                        await _LiveGameHub.Clients.Client(item2).SendAsync("newMatchedBet", item);
                    }
                }
            }
        }
Пример #4
0
        public async Task AddNotification(Bet bets, string type, RequestingUser user)
        {
            Notification newNotification = new Notification();

            newNotification.Date     = DateTime.Now;
            newNotification.UserName = user.Username;
            newNotification.UserId   = bets.UserId;
            if (type == "MatchingBet")
            {
                newNotification.Title   = "Bet Matched";
                newNotification.Type    = bets.Side + "MatchingBet";
                newNotification.Details = "New Bet Matched with odds of " + bets.Odds + " and Stake of" + bets.InStake;
                newNotification.Amount  = bets.InStake.ToString();
            }
            if (type == "New Bet Accepted and waiting for matching")
            {
                newNotification.Title   = "New Bet";
                newNotification.Type    = bets.Side + " Bet";
                newNotification.Details = "New Bet Accepted with odds of " + bets.Odds + " and Stake of" + bets.RemainingStake;
                newNotification.Amount  = bets.RemainingStake.ToString();
            }
            var userid = bets.UserId;

            newNotification.NotificationReceivers = new List <NotificationReceiver>();

            newNotification.NotificationReceivers.Add(new NotificationReceiver
            {
                IsDeleted  = false,
                ReceiverId = userid,
            });
            await _notif.InsertOneAsync(newNotification);
        }
        public async Task <IHttpActionResult> GetRequestingUserByNumMec(int numMec)
        {
            RequestingUser user = await _dbContext.RequestingUsers.Where(x => x.NumMec == numMec).FirstOrDefaultAsync();

            if (user == null)
            {
                return(NotFound());
            }

            return(Ok(user));
        }
Пример #6
0
        public void ReadWriteManifest()
        {
            var data_backend    = RainyTestServer.Container.Resolve <IDataBackend> ();
            var requesting_user = new RequestingUser {
                Username = RainyTestServer.TEST_USER, EncryptionMasterKey = "deadbeefaffedeadbeef0ffe"
            };

            var server_id = Guid.NewGuid().ToString();

            using (var repo = data_backend.GetNoteRepository(requesting_user)) {
                repo.Manifest.LastSyncRevision = 123;
                repo.Manifest.ServerId         = server_id;
            }

            // check the manifest got saved
            using (var repo = data_backend.GetNoteRepository(requesting_user)) {
                Assert.AreEqual(123, repo.Manifest.LastSyncRevision);
                Assert.AreEqual(server_id, repo.Manifest.ServerId);
            }
        }
Пример #7
0
 public bool Equals(PermissionLookup other) =>
 Message.Equals(other.Message) &&
 RequestingUser.Equals(other.RequestingUser) &&
 RepositoryName.Equals(other.RepositoryName) &&
 RequestId.Equals(other.RequestId);