public ActionResult Details(int id)
        {
            var model   = new ProjectFormModel();
            var project = ProjectRepository.ProjectFetch(id);

            model.Title       = string.Format("Project {0}", project.Name);
            model.Project     = project;
            model.Notes       = NoteRepository.NoteFetchInfoList(id, SourceType.Project);
            model.Attachments = AttachmentRepository.AttachmentFetchInfoList(
                model.Notes.Select(row => row.NoteId).Distinct().ToArray(), SourceType.Note);
            model.Sprints           = SprintRepository.SprintFetchInfoList(project);
            model.Statuses          = StatusRepository.StatusFetchInfoList(id);
            model.Stories           = StoryRepository.StoryFetchInfoList(project, false);
            model.Users             = ProjectUserRepository.ProjectUserFetchInfoList(id);
            model.TimelineListModel = new TimelineListModel
            {
                Timelines    = TimelineRepository.TimelineFetchInfoList(project),
                SourceId     = project.SourceId,
                SourceTypeId = (int)project.SourceType
            };
            model.Actions.Add("Edit this project", Url.Action("Edit", new { id }), "primary");
            model.Actions.Add("Add a story", Url.Action("Create", "Story", new { projectId = id }));
            model.Actions.Add("Add a sprint", Url.Action("Create", "Sprint", new { projectId = id }));
            model.Actions.Add("Add an email", string.Empty);
            model.Actions.Add("Add a note", Url.Action("Create", "Note", new { sourceId = id, sourceTypeId = (int)SourceType.Project }));
            model.Actions.Add("Add a collaborator", Url.Action("Create", "ProjectUser", new { projectId = id }));
            model.Actions.Add("Add a status", Url.Action("Create", "Status", new { projectId = id }));

            return(this.View(model));
        }
        public void Story_Fetch_Info_List()
        {
            StoryTestHelper.StoryAdd();
            StoryTestHelper.StoryAdd();

            var storys = StoryRepository.StoryFetchInfoList(new StoryDataCriteria());

            Assert.IsTrue(storys.Count() > 1, "Row returned should be greater than one");
        }
Exemple #3
0
        public ActionResult Index()
        {
            var model    = new StoryIndexModel();
            var criteria = new StoryDataCriteria
            {
                IsArchived = false,
            };
            var stories = StoryRepository.StoryFetchInfoList(criteria);

            model.Stories = stories;

            return(this.View(model));
        }
        public ActionResult Details(int id)
        {
            var model  = new SprintFormModel();
            var sprint = SprintRepository.SprintFetch(id);

            model.Title       = string.Format("Sprint {0}", sprint.Name);
            model.Sprint      = sprint;
            model.Notes       = NoteRepository.NoteFetchInfoList(id, SourceType.Sprint);
            model.Attachments = AttachmentRepository.AttachmentFetchInfoList(
                model.Notes.Select(row => row.NoteId).Distinct().ToArray(), SourceType.Note);
            model.Statuses = StatusRepository.StatusFetchInfoList(sprint.ProjectId);
            model.Stories  = StoryRepository.StoryFetchInfoList(sprint);
            model.Users    = ProjectUserRepository.ProjectUserFetchInfoList(sprint.ProjectId);
            model.Actions.Add("Edit this sprint", Url.Action("Edit", new { id }), "primary");
            model.Actions.Add("Add a story", Url.Action("Create", "Story", new { projectId = sprint.ProjectId, sprintId = id }));
            model.Actions.Add("Add an email", string.Empty);
            model.Actions.Add("Add a note", Url.Action("Create", "Note", new { sourceId = id, sourceTypeId = (int)SourceType.Sprint }));

            return(this.View(model));
        }
        public ActionResult Index(
            int?userId,
            string userName)
        {
            var model    = new UserListModel();
            var projects = ProjectRepository.ProjectFetchInfoList();
            var users    = UserRepository.UserFetchInfoList(projects);

            model.Users = users;

            var stories = StoryRepository.StoryFetchInfoList(
                projects.Where(row => row.IsActive && !row.IsArchived).ToArray(), false);

            model.Stories = stories;

            var timelines = TimelineRepository.TimelineFetchInfoList(
                users.Select(row => row.UserId).Distinct().ToArray(), SourceType.User);

            model.Timelines = timelines;

            return(this.View(model));
        }
Exemple #6
0
        public ActionResult List(
            string createdDate,
            string description,
            string isArchived,
            string isCompleted,
            string isOpened,
            string modifiedDate,
            int?projectId,
            string projectName,
            int?statusId,
            string statusName,
            int?storyId,
            int?userId,
            string userName)
        {
            var model    = new StoryListModel();
            var criteria = new StoryDataCriteria
            {
                AssignedTo     = userId,
                AssignedToName = userName,
                CreatedDate    = CriteriaHelper.ToDateRangeCriteria(createdDate),
                Description    = description,
                IsArchived     = CriteriaHelper.ToBoolean(isArchived),
                IsCompleted    = CriteriaHelper.ToBoolean(isCompleted),
                IsOpened       = CriteriaHelper.ToBoolean(isOpened),
                ModifiedDate   = CriteriaHelper.ToDateRangeCriteria(modifiedDate),
                ProjectId      = CriteriaHelper.ToArray(projectId),
                ProjectName    = projectName,
                StoryId        = storyId,
                StatusId       = statusId,
                StatusName     = statusName
            };
            var stories = StoryRepository.StoryFetchInfoList(criteria);

            model.Stories = stories;

            return(this.View(model));
        }
        public ActionResult Index(
            string createdDate,
            string isActive,
            string isArchived,
            string modifiedDate,
            string projectName)
        {
            var model    = new ProjectListModel();
            var criteria =
                new ProjectDataCriteria
            {
                CreatedDate  = CriteriaHelper.ToDateRangeCriteria(createdDate),
                IsActive     = CriteriaHelper.ToBoolean(isActive),
                IsArchived   = CriteriaHelper.ToBoolean(isArchived),
                Name         = projectName,
                ModifiedDate = CriteriaHelper.ToDateRangeCriteria(modifiedDate)
            };
            var projects = ProjectRepository.ProjectFetchInfoList(criteria);

            model.Projects = projects;

            var stories = StoryRepository.StoryFetchInfoList(projects.ToArray(), false);

            model.Stories = stories;

            var timelines = TimelineRepository.TimelineFetchInfoList(
                projects.Select(row => row.ProjectId).Distinct().ToArray(), SourceType.Project);

            model.Timelines = timelines;

            var sprints = SprintRepository.SprintFetchInfoList(projects.ToArray(), false);

            model.Sprints = sprints;

            model.Actions.Add("Add a project", Url.Action("Create"), "primary");

            return(this.View(model));
        }
        public ActionResult Details(int id)
        {
            var model     = new UserFormModel();
            var user      = UserRepository.UserFetch(id);
            var startDate = DateTime.Now.AddDays(-48).ToStartOfWeek(Settings.StartDayOfWeek).Date;
            var endDate   = DateTime.Now.ToStartOfWeek(Settings.StartDayOfWeek).Date.AddDays(6);
            var hours     = HourRepository.HourFetchInfoList(user, startDate, endDate);

            model.User             = user;
            model.ProjectListModel =
                new ProjectListModel
            {
                Projects = ProjectRepository.ProjectFetchInfoList(user)
            };
            model.TimelineListModel =
                new TimelineListModel
            {
                Timelines    = TimelineRepository.TimelineFetchInfoList(user),
                SourceId     = model.User.SourceId,
                SourceTypeId = (int)model.User.SourceType,
                IsEditable   = false
            };
            model.CurrentWeekHourSummaryByDateListModel =
                new HourSummaryByDateListModel
            {
                User  = user,
                Hours = this.FetchHoursForWeek(
                    DateTime.Now.ToStartOfWeek(Settings.StartDayOfWeek),
                    hours)
            };
            model.TrailingWeeksHourSummaryByDateListModel =
                new HourSummaryByDateListModel
            {
                User  = user,
                Hours = this.FetchHoursForTrailingWeeks(
                    startDate,
                    endDate,
                    hours)
            };
            model.Stories = StoryRepository.StoryFetchInfoList(model.User, false);

            var weeks = WeekCollection.GetWeeks(DateTime.Now.Year);

            hours = HourRepository.HourFetchInfoList(
                user, weeks.Min(row => row.StartDate), weeks.Max(row => row.EndDate));
            var hourSummaries = new List <HourSummary>();

            hourSummaries.Add(new HourSummary {
                Name = "Week", Value = (double)hours.Where(row => row.Date >= weeks.StartDate.Date && row.Date <= weeks.StartDate.AddDays(6)).Sum(row => row.Duration), NormalValue = 25
            });
            hourSummaries.Add(new HourSummary {
                Name = "Year", Value = (double)hours.Sum(row => row.Duration), NormalValue = 1250
            });

            model.HourSummaryListModel =
                new HourSummaryListModel
            {
                User  = user,
                Hours = hourSummaries
            };

            return(this.View(model));
        }
        public static IEnumerable <FindResult> Find(string text)
        {
            var result = new List <FindResult>();

            // search hours
            var hours = HourRepository.HourFetchInfoList(new HourDataCriteria {
                Text = text
            });

            result.AddRange(hours.Select(hour => new FindResult
            {
                Id             = hour.HourId,
                Type           = "Hour",
                Name           = hour.Date.ToShortDateString(),
                Description    = hour.Notes,
                CreatedDate    = hour.CreatedDate,
                CreatedByName  = hour.CreatedByName,
                ModifiedDate   = hour.ModifiedDate,
                ModifiedByName = hour.ModifiedByName
            }));

            // search projects
            var projects = ProjectRepository.ProjectFetchInfoList(new ProjectDataCriteria {
                Text = text
            });

            result.AddRange(projects.Select(project => new FindResult
            {
                Id             = project.ProjectId,
                Type           = "Project",
                Name           = project.Name,
                Description    = project.Description,
                CreatedDate    = project.CreatedDate,
                CreatedByName  = project.CreatedByName,
                ModifiedDate   = project.ModifiedDate,
                ModifiedByName = project.ModifiedByName
            }));

            // search stories
            var stories = StoryRepository.StoryFetchInfoList(new StoryDataCriteria {
                Text = text
            });

            result.AddRange(stories.Select(story => new FindResult
            {
                Id             = story.StoryId,
                Type           = "Story",
                Name           = story.StoryId.ToString(),
                Description    = story.Description,
                CreatedDate    = story.CreatedDate,
                CreatedByName  = story.CreatedByName,
                ModifiedDate   = story.ModifiedDate,
                ModifiedByName = story.ModifiedByName
            }));

            // search users
            var users = UserRepository.UserFetchInfoList(new UserDataCriteria {
                Text = text
            });

            result.AddRange(users.Select(user => new FindResult
            {
                Id             = user.UserId,
                Type           = "User",
                Name           = user.Name,
                Description    = string.Empty,
                CreatedDate    = user.CreatedDate,
                CreatedByName  = user.Name,
                ModifiedDate   = user.ModifiedDate,
                ModifiedByName = user.Name
            }));

            return(result);
        }