This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var envIds = new List<int> {5}; | |
DateTime fromDate = DateTime.Now.AddDays(-7).Date; | |
DateTime toDate = DateTime.Now.Date.AddDays(1).AddSeconds(-1); | |
var results = DataAccess.ImportingSystemTestResultRepository.All | |
.Include(tr => tr.ImportingSystemTestRunTime) | |
.Include(tr => tr.ImportingSystemTestQueue) | |
.Include(tr => tr.ImportingSystemTest) | |
.Include(tr => tr.ImportingSystem) | |
.Include(tr => tr.Environment) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create view tmp.vwImportingSystemTestResult | |
AS | |
SELECT TR.ImportingSystemTestResultId, TR.EnteredTimestamp, TR.RunTimestamp, TR.ImportingSystemTestId, TR.ImportingSystemId, TR.EnvironmentId, TR.RequesterId, TR.ImportingSystemTestExecutionStatusId, | |
TR.ResultFilename, Q.RequestId, DurationMs, | |
T.TestName, ImpSys.ImportingSystemName, E.Name, U.Username | |
FROM dbo.ImportingSystemTestResult TR | |
JOIN dbo.ImportingSystemTestRunTime TRT ON TRT.ImportingSystemTestResultId = TR.ImportingSystemTestResultId | |
JOIN dbo.ImportingSystemTestQueue Q ON Q.ImportingSystemTestQueueId = TR.ImportingSystemTestQueueId | |
-- names joins | |
JOIN dbo.ImportingSystemTest T ON T.ImportingSystemTestId = TR.ImportingSystemTestId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var results = DataAccess.VwImportingSystemTestResultRepository.AllNoTracking | |
.Where(x => envIds.Contains(x.EnvironmentId)) | |
.Where(x => x.EnteredTimestamp >= fromDate && x.EnteredTimestamp <= toDate) | |
.Take(500) | |
.ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImportingSystemTestResultOutputServiceModel | |
{ | |
public int ModelIndex { get; set; } | |
public int ImportingSystemTestResultId { get; set; } | |
public DateTime EnteredTimestamp { get; set; } | |
public DateTime RunTimestamp { get; set; } | |
public int ImportingSystemTestId { get; set; } | |
public int ImportingSystemId { get; set; } | |
public int RequesterId { get; set; } | |
public int ImportingSystemTestExecutionStatusId { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IQueryable<ImportingSystemTestResult> GetFilteredTestsResultsQuery(ImportingSystemTestResultSearchFilterServiceModel filters) | |
{ | |
var dbModels = DataAccess.ImportingSystemTestResultRepository.AllNoTracking; | |
if (!filters.EnvironmentList.IsEmpty()) | |
dbModels = dbModels.Where(tr => filters.EnvironmentList.Contains(tr.EnvironmentId)); | |
if (!filters.ImportingSystemList.IsEmpty()) | |
dbModels = dbModels.Where(tr => filters.ImportingSystemList.Contains(tr.ImportingSystemId)); | |
// other filters come here | |
return dbModels; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImportingSystemTestResultViewModel | |
{ | |
// used internally to provide indexing if model is within a list of models | |
public int ModelIndex { get; set; } | |
public int ImportingSystemTestResultId { get; set; } | |
public DateTime EnteredTimestamp { get; set; } | |
public string EnteredTimestampStr => EnteredTimestamp.GetDateTimeDefaultString(); | |
public DateTime RunTimestamp { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var serviceModel = ImportingSystemTestResultService.GetFilteredTestsResults(filters); | |
var viewModel = MappingService.MapListWithTotalCountModels< | |
ImportingSystemTestResultOutputServiceModel, | |
ImportingSystemTestResultViewModel, | |
ListWithTotalCountServiceModel<ImportingSystemTestResultOutputServiceModel>, | |
ListWithTotalCountViewModel<ImportingSystemTestResultViewModel>> | |
(serviceModel, MappingConfig.Mapper); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using AutoMapper; | |
using Common.Web; | |
using MdwAutomaticTesting.Models; | |
namespace MdwAutomaticTesting.Services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void RegisterCommandCancelOnToken(CancellationTokenSource cts, TdCommand command) | |
{ | |
if (cts == null) | |
return; | |
var innerCommand = command; | |
cts.Token.Register(() => | |
{ | |
try |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IRepository<T> : IRepository | |
where T : BaseModel, new() | |
{ | |
/// <summary> | |
/// specifies if current repository is cached | |
/// </summary> | |
bool IsCached { get; } | |
/// <summary> | |
/// gets all non-tracked items as IQueryable reference |
OlderNewer