Beispiel #1
0
        public void Denied(ApplicationUser subscriber)
        {
            AlertModels alert = new AlertModels();

            alert.AlertMessage     = "This is an automated message. Your application was denied. If you wish to apply for a different position please return to your profile to begin a new application.";
            alert.AspNetUsersId    = subscriber.Id;
            alert.AspNetSenderName = "Team Server";
            alert.DateSent         = DateTime.Today.ToString("MM-dd-yyyy");
            context.Alerts.Add(alert);
            context.SaveChanges();
        }
Beispiel #2
0
        public void Accepted(ApplicationUser player)
        {
            AlertModels alert = new AlertModels();

            alert.AlertMessage     = "This is an automated message. Your application has been accept. Welcome to the team!";
            alert.AspNetUsersId    = player.Id;
            alert.AspNetSenderName = "Team Server";
            alert.DateSent         = DateTime.Today.ToString("MM-dd-yyyy");
            context.Alerts.Add(alert);
            context.SaveChanges();
        }
Beispiel #3
0
        public void RemoveAlert(ApplicationUser player)
        {
            AlertModels alert = new AlertModels();

            alert.AlertMessage     = "This is an automated message. You have been removed from the team.";
            alert.AspNetUsersId    = player.Id;
            alert.AspNetSenderName = "Team Server";
            alert.DateSent         = DateTime.Today.ToString("MM-dd-yyyy");
            context.Alerts.Add(alert);
            context.SaveChanges();
        }
Beispiel #4
0
        // GET: Alerts
        public ActionResult Index()
        {
            var userName = User.Identity.GetUserName();
            var user     = context.Users.Where(x => x.UserName == userName).First();

            AlertModels alerts = new AlertModels();

            alerts.Alerts      = context.Alerts.Where(x => x.AspNetUsersId == user.Id).ToList();
            alerts.AspNetUsers = user;

            return(View(alerts));
        }
Beispiel #5
0
        public void AlertNewEvent(GameScheduleModels model)
        {
            AlertModels alert = new AlertModels();
            var         users = db.Users.Select(x => x).ToList();

            foreach (var user in users)
            {
                alert.AlertMessage  = $"There is an event {model.EventName} on {model.GameDate}.";
                alert.GameDate      = model.GameDate;
                alert.DateSent      = DateTime.Today.ToString("MM-dd-yyyy");
                alert.Received      = false;
                alert.AspNetUsersId = user.Id;
                db.Alerts.Add(alert);
                db.SaveChanges();
            }
        }
        public ActionResult Index(AlertModels message)
        {
            var      userName   = User.Identity.GetUserName();
            var      user       = context.Users.Where(x => x.UserName == userName).First();
            var      senderName = user.FirstName + " " + user.LastName;
            var      team       = context.Users.Where(x => x.Role == "Coach" || x.Role == "Player").ToList();
            DateTime time       = DateTime.Today;
            var      sentDate   = time;

            foreach (var member in team)
            {
                AlertModels messages = new AlertModels();
                messages.AspNetUsersId    = member.Id;
                messages.AspNetSenderName = senderName;
                messages.AlertMessage     = message.AlertMessage;
                messages.DateSent         = time.ToString("MM-dd-yyyy");
                context.Alerts.Add(messages);
                context.SaveChanges();
            }

            return(RedirectToAction("SentMessage", "Messages"));
        }
Beispiel #7
0
        public void IsNotInjured(ApplicationUser player)
        {
            List <TrackingModels> userIds = context.Trackings.Where(x => x.PlayerId == player.Id).ToList();
            var listOfUsers = GetUserList(userIds);

            if (listOfUsers.Count == 0)
            {
                //No users are tracking.
            }
            else
            {
                foreach (var user in listOfUsers)
                {
                    AlertModels alert = new AlertModels();
                    alert.AlertMessage     = $"This is an automated message. {player.FirstName} {player.LastName} is not injured anymore.";
                    alert.AspNetUsersId    = user.Id.ToString();
                    alert.AspNetSenderName = "Team Server";
                    alert.DateSent         = DateTime.Today.ToString("MM-dd-yyyy");
                    context.Alerts.Add(alert);
                    context.SaveChanges();
                }
            }
        }
Beispiel #8
0
        public void AlertDelete(GameScheduleModels model)
        {
            AlertModels alert = new AlertModels();
            var         users = db.Users.Select(x => x).ToList();

            if (model.GameDate < DateTime.Today)
            {
                //ignore delete.
            }
            else
            {
                foreach (var user in users)
                {
                    alert.AlertMessage  = $"The event {model.EventName} on {model.GameDate} has been deleted.";
                    alert.GameDate      = model.GameDate;
                    alert.DateSent      = DateTime.Today.ToString("MM-dd-yyyy");
                    alert.Received      = false;
                    alert.AspNetUsersId = user.Id;
                    db.Alerts.Add(alert);
                    db.SaveChanges();
                }
            }
        }