Ejemplo n.º 1
0
        // GET: Profile
        public ActionResult Index(bool IsInvalidAttempt = false)
        {
            if (!Globals.LOGIN_STATUS)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                ProfileHomeVM model = new ProfileHomeVM();
                model.CurrentUser              = Globals.LOGGED_IN_USER;
                model.EditedUserProfile        = model.CurrentUser;
                model.IsInvalidPasswordAttempt = IsInvalidAttempt;

                GetDAL get = new GetDAL();
                get.OpenConnection();
                model.LstAllEvents = get.GetAllEvents();

                var equalityComparer = new EventEqualityComparer();

                IEnumerable <Event> difference = model.LstAllEvents.Except(model.CurrentUser.LstEvents, equalityComparer);
                model.LstEventsToJoin = difference.ToList();

                get.CloseConnection();

                return(View("ProfileHome", model));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Login(bool isInvalidPasswordAttempt = false)
        {
            LoginVM model = new LoginVM();

            model.IsInvalidPasswordAttempt = isInvalidPasswordAttempt;

            GetDAL get = new GetDAL();

            get.OpenConnection();
            model.LstAllEvents = get.GetAllEvents();
            get.CloseConnection();

            return(View("Login", model));
        }
Ejemplo n.º 3
0
        // GET: Admin
        public ActionResult Index()
        {
            if (Globals.IS_ADMIN)
            {
                AdminHomeVM model = new AdminHomeVM();

                GetDAL get = new GetDAL();
                get.OpenConnection();

                model.LstAllGroups   = get.GetAllGroups();
                model.LstAllEvents   = get.GetAllEvents();
                model.LstAdminEvents = get.GetAdminEventsByUser(Globals.LOGGED_IN_USER.IntUserID);
                foreach (Event e in model.LstAdminEvents)
                {
                    e.LstRehearsalParts = get.GetRehearsalPartsByEvent(e);
                    foreach (RehearsalPart rp in e.LstRehearsalParts)
                    {
                        rp.LstMembers = get.GetUsersByRehearsalPart(rp);
                        if (rp.DtmStartDateTime.Equals(DateTime.MinValue))
                        {
                            rp.DtmStartDateTime = null;
                        }
                        if (rp.DtmEndDateTime.Equals(DateTime.MinValue))
                        {
                            rp.DtmEndDateTime = null;
                        }
                    }
                }
                model.LstAllTypes = get.GetAllTypes();

                model.LstAllUsersForAdminEvents = get.GetAllUsersForAdminEvents(model.LstAdminEvents);
                get.CloseConnection();
                get.OpenConnection();
                foreach (Users u in model.LstAllUsersForAdminEvents)
                {
                    u.LstConflicts = get.GetConflictsByUser(u).OrderBy(x => x.DtmStartDateTime).ToList();
                }

                get.CloseConnection();

                return(View("AdminHome", model));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 4
0
        // GET: Tasks
        public ActionResult Index()
        {
            if (!Globals.LOGIN_STATUS)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                TasksHomeVM model = new TasksHomeVM();
                model.CurrentUser = Globals.LOGGED_IN_USER;

                var taskEqualityComparer = new TaskEqualityComparer();

                GetDAL get = new GetDAL();
                get.OpenConnection();

                model.TasksUnfinishedNotYetDueForUser = get.GetUnfinishedTasksDueAfter(model.CurrentUser, DateTime.Now);

                model.FinishedTasks = get.GetFinishedTasks(model.CurrentUser);

                IEnumerable <Task> difference = get.GetTasksByAssignedToUser(model.CurrentUser).Except(model.TasksUnfinishedNotYetDueForUser, taskEqualityComparer).Except(model.FinishedTasks, taskEqualityComparer);

                model.TasksOverDueForUser = difference.ToList();

                model.TasksAssignedByUser = get.GetTasksByAssignedByUser(model.CurrentUser);

                model.LstAllEvents   = get.GetAllEvents();
                model.LstAdminEvents = get.GetAdminEventsByUser(model.CurrentUser.IntUserID);

                if (model.LstAdminEvents.Any())
                {
                    model.LstAllUsersForAdminEvents = get.GetAllUsersForAdminEvents(model.LstAdminEvents);
                }

                get.CloseConnection();

                return(View("TasksHome", model));
            }
        }