Exemple #1
0
        // GET: CheckInOut
        public ActionResult Index()
        {
            if (!Globals.IS_ADMIN)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else if (!Globals.LOGIN_STATUS)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                CheckInOutVM model = new CheckInOutVM();

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

                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);
                    }

                    e.MembersForToday = LstAllMembersForRehearsalParts(e, get);
                }

                get.CloseConnection();

                return(View("Index", model));
            }
        }
        // GET: Callboard
        public ActionResult Index()
        {
            if (!Globals.LOGIN_STATUS)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                CallboardHomeVM model = new CallboardHomeVM();
                model.CurrentUser = Globals.LOGGED_IN_USER;

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

                model.LstAllCallboards = new List <Callboard>();

                foreach (Event e in model.CurrentUser.LstEvents)
                {
                    List <Callboard> callboards = get.GetCallboardsByEvent(e);
                    model.LstAllCallboards.AddRange(callboards);
                }

                if (model.LstAllCallboards != null)
                {
                    model.LstAllCallboards.Sort();
                }

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


                get.CloseConnection();

                return(View("CallboardHome", model));
            }
        }
        // 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"));
            }
        }
Exemple #4
0
        private static bool LoginUser(Users usr)
        {
            GetDAL getDAL = new GetDAL();

            getDAL.OpenConnection();

            usr.LstEvents          = getDAL.GetEventsByUser(usr.IntUserID);
            usr.LstEventsIsAdmin   = getDAL.GetAdminEventsByUser(usr.IntUserID);
            Globals.LOGIN_STATUS   = true;
            Globals.LOGGED_IN_USER = usr;

            if (Globals.ADMINS.Contains(usr))
            {
                Globals.IS_ADMIN = true;
            }

            getDAL.CloseConnection();

            return(true);
        }
        // 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));
            }
        }
Exemple #6
0
        // GET: Schedule
        public ActionResult Index()
        {
            if (!Globals.LOGIN_STATUS)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                ScheduleHomeVM model = new ScheduleHomeVM();
                GetDAL         get   = new GetDAL();
                get.OpenConnection();

                model.LstUpcomingRehearsals = get.GetUpcomingRehearsalsByUser(Globals.LOGGED_IN_USER);

                foreach (var r in model.LstUpcomingRehearsals)
                {
                    r.LstRehearsalParts = get.GetRehearsalPartsByRehearsal(r);
                    foreach (RehearsalPart rp in r.LstRehearsalParts)
                    {
                        rp.LstMembers = get.GetUsersByRehearsalPart(rp);
                    }
                }

                model.LstUserRehearsalParts        = get.GetUpcomingRehearsalPartsByUser(Globals.LOGGED_IN_USER);
                model.LstUnscheduledRehearsalParts = model.LstUserRehearsalParts.Where(x => x.DtmStartDateTime.Equals(null)).ToList();

                //foreach (var e in get.GetEventsByUser(Globals.LOGGED_IN_USER.IntUserID))
                //{
                //    get.CloseConnection();
                //    get.OpenConnection();
                //    model.LstUserRehearsalParts = model.LstUserRehearsalParts.Concat(get.GetRehearsalPartsByEvent(e)).ToList();
                //}
                //get.CloseConnection();
                //get.OpenConnection();
                //model.LstUpcomingRehearsalParts = get.GetUpcomingRehearsalPartsByUser(Globals.LOGGED_IN_USER);

                //model.LstUnscheduledRehearsalParts = model.LstUserRehearsalParts.Where(x => x.DtmStartDateTime.Equals(null)).ToList();

                //model.LstUpcomingRehearsalParts = model.LstUpcomingRehearsalParts.Except(model.LstUnscheduledRehearsalParts.ToList()).ToList();

                //model.LstUpcomingRehearsals = get.GetUpcomingRehearsalsByUser(Globals.LOGGED_IN_USER);

                //foreach (var r in model.LstUpcomingRehearsals)
                //{
                //    r.LstRehearsalParts = get.GetRehearsalPartsByRehearsal(r);
                //}

                //get.CloseConnection();
                //get.OpenConnection();
                model.LstAdminEvents = get.GetAdminEventsByUser(Globals.LOGGED_IN_USER.IntUserID);

                //foreach (RehearsalPart rp in model.LstUserRehearsalParts)
                //{
                //    rp.LstMembers = get.GetUsersByRehearsalPart(rp);
                //}
                //foreach (RehearsalPart rp in model.LstUpcomingRehearsalParts)
                //{
                //    rp.LstMembers = get.GetUsersByRehearsalPart(rp);
                //}
                get.CloseConnection();

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