Esempio n. 1
0
        public ActionResult Index()
        {
            try
            {
                if (SessionData.UserRole == UserRoles.Employee)
                {
                    Attendance attendance = AttendancesLogic.GetLastSignByUserId(SessionData.UserId);
                    if (attendance == null)
                    {
                        DateTime serverTime = DateTimeHelper.Today();
                        if (serverTime.Hour >= 12)
                        {
                            return(RedirectToAction("Index", "Employees"));
                        }
                        else
                        {
                            return(RedirectToAction("UserSign", "Attendances"));
                        }
                    }
                    List <StandUpMeetingDetails> model = StandUpMeetingsLogic.GetTodayStandUpMeeting(SessionData.UserId);
                    if (model.Count == 0)
                    {
                        return(RedirectToAction("Create", "StandUpMeet"));
                    }
                    return(RedirectToAction("Index", "Employees"));
                }
                else
                {
                    HomeIndexModel model = new HomeIndexModel();
                    model.Projects = ProjectsLogic.GetProjectlist();

                    List <Sprint> sprints = SprintsLogic.GetAllSprints();
                    model.PreviousSprint = sprints.FindLast(a => a.PreviousSprint);
                    model.CurrentSprint  = sprints.Find(a => a.CurrentSprint);
                    model.FutureSprint   = sprints.Find(a => a.FutureSprint);

                    model.CanCreateSprint = !sprints.Any(a => a.FutureSprint);
                    return(View(model));
                }
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Projects/GetProjectlist",
                });
                return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
            }
        }
        public ActionResult Index(int?sprintId)
        {
            List <Sprint> sprints = SprintsLogic.GetAllSprints();

            if (sprintId == null && StoriesFilterSession == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (StoriesFilterSession == null && sprints.Count > 0)
            {
                StoriesFilterSession         = new StoriesFilter();
                StoriesFilterSession.Sprints = new SprintModel()
                {
                    Current  = sprints.Find(a => a.CurrentSprint),
                    Future   = sprints.FindAll(a => a.FutureSprint),
                    Previous = sprints.FindAll(a => a.PreviousSprint)
                };
            }
            StoriesFilterSession.sprintId = sprintId.Value;

            return(View(StoriesFilterSession));
        }