public ActionResult List(
            string createdDate,
            string date,
            string isArchived,
            string modifiedDate,
            int?projectId,
            string projectName,
            int?sprintId,
            string sprintName,
            int?storyId,
            int?userId,
            string userName)
        {
            var model    = new HourListModel();
            var criteria =
                new HourDataCriteria
            {
                CreatedDate  = CriteriaHelper.ToDateRangeCriteria(createdDate),
                Date         = CriteriaHelper.ToDateRangeCriteria(date),
                IsArchived   = CriteriaHelper.ToBoolean(isArchived),
                ModifiedDate = CriteriaHelper.ToDateRangeCriteria(modifiedDate),
                ProjectId    = CriteriaHelper.ToArray(projectId),
                ProjectName  = projectName,
                SprintId     = sprintId,
                StoryId      = storyId,
                UserId       = userId,
                UserName     = userName
            };
            var hours = HourRepository.HourFetchInfoList(criteria);

            model.Hours = hours;

            return(this.View(model));
        }
示例#2
0
        public void Hour_Fetch_Info_List()
        {
            HourTestHelper.HourAdd();
            HourTestHelper.HourAdd();

            var hours = HourRepository.HourFetchInfoList(new HourDataCriteria());

            Assert.IsTrue(hours.Count() > 1, "Row returned should be greater than one");
        }
示例#3
0
        public ActionResult Details(int id)
        {
            var model = new StoryFormModel();
            var story = StoryRepository.StoryFetch(id);

            model.Title       = string.Format("Story {0}", story.Description);
            model.Story       = story;
            model.Notes       = NoteRepository.NoteFetchInfoList(id, SourceType.Story);
            model.Attachments = AttachmentRepository.AttachmentFetchInfoList(
                model.Notes.Select(row => row.NoteId).Distinct().ToArray(), SourceType.Note);
            model.Hours    = HourRepository.HourFetchInfoList(story);
            model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId);
            model.Actions.Add("Edit this story", Url.Action("Edit", new { id }), "primary");
            model.Actions.Add("Add an hour", Url.Action("Create", "Hour", new { storyId = 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.Story }));

            return(this.View(model));
        }
        public ActionResult Index(int?year, int?userId)
        {
            var model    = new HourIndexModel();
            var projects = ProjectRepository.ProjectFetchInfoList();

            model.UserId = userId ?? ((IBusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;

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

            model.Weeks = weeks;

            var criteria =
                new HourDataCriteria
            {
                Date   = CriteriaHelper.ToDateRangeCriteria(weeks.StartDate, weeks.EndDate),
                UserId = model.UserId
            };

            var hours = HourRepository.HourFetchInfoList(criteria);

            model.Hours = hours;

            model.Year = year ?? DateTime.Now.Year;

            var years = new List <int>();

            for (var currentYear = year ?? DateTime.Now.Year; currentYear <= DateTime.Now.Year; currentYear++)
            {
                years.Add(currentYear);
            }

            model.Years = years;

            var users = UserRepository.UserFetchInfoList(projects);

            model.Users = users;

            return(this.View(model));
        }
        public ActionResult Index()
        {
            var model = new HomeIndexModel();
            var user  = UserRepository.UserFetch();

            model.User             = user;
            model.StartDate        = DateTime.Now.AddDays(-48).ToStartOfWeek(Settings.StartDayOfWeek).Date;
            model.EndDate          = DateTime.Now.ToStartOfWeek(Settings.StartDayOfWeek).Date.AddDays(6);
            model.Hours            = HourRepository.HourFetchInfoList(user, model.StartDate, model.EndDate);
            model.ProjectListModel =
                new ProjectListModel
            {
                Projects = ProjectRepository.ProjectFetchInfoList()
            };
            model.FeedListModel =
                new FeedListModel
            {
                Feeds = FeedRepository.FeedFetchInfoList(20)
            };
            model.TimelineListModel =
                new TimelineListModel
            {
                Timelines    = TimelineRepository.TimelineFetchInfoList(model.User),
                SourceId     = model.User.SourceId,
                SourceTypeId = (int)model.User.SourceType
            };
            model.CurrentWeekHourSummaryByDateListModel =
                new HourSummaryByDateListModel
            {
                User  = user,
                Hours = this.FetchHoursForWeek(
                    DateTime.Now.ToStartOfWeek(Settings.StartDayOfWeek),
                    model.Hours)
            };
            model.TrailingWeeksHourSummaryByDateListModel =
                new HourSummaryByDateListModel
            {
                User  = user,
                Hours = this.FetchHoursForTrailingWeeks(
                    model.StartDate,
                    model.EndDate,
                    model.Hours)
            };


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

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