internal static RecoveryObjectivesViewFilterOperands PopulateRecoveryObjectivesFilterOperands( List <KeyValuePair <string, string> > queryParams) { var filterOperands = new RecoveryObjectivesViewFilterOperands(); System.Enum.TryParse <FilterOperand>(queryParams.FirstOrDefault(k => k.Key == "sOperand_2").Value, out filterOperands.RPOScore); System.Enum.TryParse <FilterOperand>(queryParams.FirstOrDefault(k => k.Key == "sOperand_3").Value, out filterOperands.RTOScore); System.Enum.TryParse <FilterOperand>(queryParams.FirstOrDefault(k => k.Key == "sOperand_4").Value, out filterOperands.PotentialDataLossMinutes); System.Enum.TryParse <FilterOperand>(queryParams.FirstOrDefault(k => k.Key == "sOperand_5").Value, out filterOperands.EstimatedTimeToRecoverHours); return(filterOperands); }
/// <summary> /// Retrieves data for the Recovery Objectives View /// </summary> /// <param name="gridConditions"></param> /// <param name="filterConditions"></param> /// <returns></returns> public DataTableCollection GetRecoveryObjectivesDetails(GridConditions gridConditions, RecoveryObjectivesViewFilterConditions filterConditions, RecoveryObjectivesViewFilterOperands filterOperands) { using (var conn = (SqlConnection)this.connectionFactory.GetEddsPerformanceConnection()) { using (var command = new SqlCommand()) { var parameters = new SqlParameter[] { //Grid conditions new SqlParameter { ParameterName = "@SortColumn", DbType = DbType.String, Value = gridConditions.SortColumn }, new SqlParameter { ParameterName = "@SortDirection", DbType = DbType.String, Value = gridConditions.SortDirection }, new SqlParameter { ParameterName = "@StartRow", DbType = DbType.Int32, Value = gridConditions.StartRow }, new SqlParameter { ParameterName = "@EndRow", DbType = DbType.Int32, Value = gridConditions.EndRow }, //Filter conditions new SqlParameter { ParameterName = "@Server", DbType = DbType.String, Value = filterConditions.Server }, new SqlParameter { ParameterName = "@DBName", DbType = DbType.String, Value = filterConditions.DatabaseName }, new SqlParameter { ParameterName = "@RPOScore", DbType = DbType.Int32, Value = filterConditions.RPOScore }, new SqlParameter { ParameterName = "@RTOScore", DbType = DbType.Int32, Value = filterConditions.RTOScore }, new SqlParameter { ParameterName = "@PotentialDataLossMinutes", DbType = DbType.Int32, Value = filterConditions.PotentialDataLossMinutes }, new SqlParameter { ParameterName = "@EstimatedTimeToRecoverHours", DbType = DbType.Int32, Value = filterConditions.EstimatedTimeToRecoverHours }, //Filter operands new SqlParameter { ParameterName = "@RPOScoreOperand", DbType = DbType.String, Value = filterOperands.RPOScore.GetSqlOperation() }, new SqlParameter { ParameterName = "@RTOScoreOperand", DbType = DbType.String, Value = filterOperands.RTOScore.GetSqlOperation() }, new SqlParameter { ParameterName = "@PotentialDataLossMinutesOperand", DbType = DbType.String, Value = filterOperands.PotentialDataLossMinutes.GetSqlOperation() }, new SqlParameter { ParameterName = "@EstimatedTimeToRecoverHoursOperand", DbType = DbType.String, Value = filterOperands.EstimatedTimeToRecoverHours.GetSqlOperation() } }; var data = SqlHelper.ExecuteDataset(conn, CommandType.StoredProcedure, "eddsdbo.QoS_RecoveryObjectivesReport", parameters); return(data.Tables); } } }
public virtual RecoveryObjectivesViewGrid RecoveryObjectivesSummary(GridConditions gridConditions, RecoveryObjectivesViewFilterConditions filterConditions, RecoveryObjectivesViewFilterOperands filterOperands) { var grid = new RecoveryObjectivesViewGrid(); var dt = this.reportRepository.GetRecoveryObjectivesDetails(gridConditions, filterConditions, filterOperands); if (dt.Count > 1) { var searchUsers = dt[0]; grid.Data = (from DataRow d in searchUsers.Rows select new RecoveryObjectivesInfo { Index = d.Field <int>("RowNumber"), ServerId = d.Field <int?>("ServerId").GetValueOrDefault(0), ServerName = d.Field <string>("ServerName"), DatabaseName = d.Field <string>("DBName"), RPOScore = d.Field <int?>("RPOScore").GetValueOrDefault(100), RTOScore = d.Field <int?>("RTOScore").GetValueOrDefault(100), PotentialDataLossMinutes = d.Field <int?>("PotentialDataLossMinutes").GetValueOrDefault(0), EstimatedTimeToRecoverHours = d.Field <int?>("EstimatedTimeToRecoverHours").GetValueOrDefault(0) }).AsQueryable(); var resultInfo = dt[1]; grid.Count = resultInfo.Rows.Count > 0 ? resultInfo.Rows[0].Field <int?>("FilteredCount").GetValueOrDefault(0) : 0; } return(grid); }
public RecoveryObjectivesViewModel() { GridConditions = new GridConditions(); FilterConditions = new RecoveryObjectivesViewFilterConditions(); FilterOperands = new RecoveryObjectivesViewFilterOperands(); }