Exemplo n.º 1
0
        private ChangesetSearchOptions ReadOptionsValueFromUI()
        {
            var options = new ChangesetSearchOptions
            {
                ProjectSourcePath = txtSource.Text.Trim(),
                TopN              = Int32.MaxValue,
                SearchKeyword     = txtSearchText.Text.Trim(),
                Committer         = lstUsers.Text,
                SearchCommentType = (Consts.SearchCommentType)Enum.Parse(typeof(Consts.SearchCommentType), cboSearchType.SelectedValue.ToString()),
                StartDate         = startDate.SelectedDate
            };

            //End date should have time till the end of the day
            if (endDate.SelectedDate.HasValue)
            {
                options.EndDate = DateExtensions.GetEndOfDay(endDate.SelectedDate.Value);
            }

            if (chkToday.IsChecked.HasValue && chkToday.IsChecked.Value)
            {
                options.StartDate = DateExtensions.GetStartOfDay(DateTime.Now);
                options.EndDate   = DateExtensions.GetEndOfDay(DateTime.Now);
            }
            else if (chkWeek.IsChecked.HasValue && chkWeek.IsChecked.Value)
            {
                options.StartDate = DateExtensions.GetStartOfDay(DateTime.Now.AddDays(-7));
                options.EndDate   = DateExtensions.GetEndOfDay(DateTime.Now);
            }
            else if (chkMonth.IsChecked.HasValue && chkMonth.IsChecked.Value)
            {
                options.StartDate = DateExtensions.GetStartOfDay(DateTime.Now.AddDays(-30));
                options.EndDate   = DateExtensions.GetEndOfDay(DateTime.Now);
            }

            return(options);
        }