public virtual SearchViewGrid SearchUsers(GridConditions gridConditions, SearchViewFilterConditions filterConditions, SearchViewFilterOperands filterOperands)
        {
            var grid = new SearchViewGrid();
            var dt   = this.reportRepository.GetUserExperienceSearchDetails(gridConditions, filterConditions, filterOperands);

            if (dt.Count > 1)
            {
                var searchUsers = dt[0];
                grid.Data = (from DataRow d in searchUsers.Rows
                             select new UserExperienceSearchUserInfo
                {
                    Index = d.Field <int>("RowNumber"),
                    CaseArtifactId = d.Field <int>("CaseArtifactID"),
                    AuditId = d.Field <long?>("LastAuditID").GetValueOrDefault(0),
                    SearchArtifactId = d.Field <int>("SearchArtifactId"),
                    Search = d.Field <string>("Search"),
                    UserArtifactId = d.Field <int>("UserArtifactID"),
                    User = d.Field <string>("User"),
                    TotalRunTime = d.Field <Int64?>("TotalRunTime").GetValueOrDefault(0),
                    AverageRunTime = d.Field <int?>("AverageRunTime").GetValueOrDefault(0),
                    TotalRuns = d.Field <int?>("TotalRuns").GetValueOrDefault(0),
                    PercentLongRunning = d.Field <int?>("PercentLongRunning").GetValueOrDefault(0),
                    IsComplex = d.Field <bool?>("IsComplex").GetValueOrDefault(false),
                    SummaryDayHour = d.Field <DateTime>("SummaryDayHour"),
                    QoSHourID = d.Field <Int64?>("QoSHourID").GetValueOrDefault(0),
                    IsActiveWeeklySample = d.Field <bool>("IsActiveArrivalRateSample")
                }).AsQueryable();

                var resultInfo = dt[1];
                grid.Count = resultInfo.Rows.Count > 0 ? resultInfo.Rows[0].Field <int?>("FilteredCount").GetValueOrDefault(0) : 0;
            }

            return(grid);
        }
Example #2
0
        public void GetUserExperienceSearchDetails(SearchViewColumns sortColumn)
        {
            //Arrange
            var gridConditions   = new GridConditions();
            var filterConditions = new SearchViewFilterConditions();
            var filterOperands   = new SearchViewFilterOperands();

            //Grid conditions
            gridConditions.SortColumn     = sortColumn.ToString();
            gridConditions.SortDirection  = "ASC";
            gridConditions.TimezoneOffset = 0;
            gridConditions.StartRow       = 1;
            gridConditions.EndRow         = 25;

            //Filter conditions
            filterConditions.Search = "";
            filterConditions.User   = "";

            //Filter operands
            filterOperands.PercentLongRunning = FilterOperand.Equals;
            filterOperands.TotalRunTime       = FilterOperand.Equals;
            filterOperands.AverageRunTime     = FilterOperand.Equals;
            filterOperands.TotalRuns          = FilterOperand.Equals;
            filterOperands.QoSHourID          = FilterOperand.Equals;

            //Page-level filters
            gridConditions.StartDate = DateTime.Now.AddYears(-1);
            gridConditions.EndDate   = DateTime.Now.AddDays(1);

            //Act
            var result = this.reportRepository.GetUserExperienceSearchDetails(gridConditions, filterConditions, filterOperands);

            //Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.Not.Empty);
        }
 public UserExperienceSearchViewModel()
 {
     GridConditions   = new GridConditions();
     FilterConditions = new SearchViewFilterConditions();
     FilterOperands   = new SearchViewFilterOperands();
 }