示例#1
0
        public async Task <MaterialsWithMarkerResult> GetMaterialWithtTestsAsync(MaterialsWithMarkerRequestArgs args)
        {
            var result = new MaterialsWithMarkerResult();

            DbContext.CommandTimeout = 2 * 60; //time out is set to 2 minutes
            var data = await DbContext.ExecuteDataSetAsync(DataConstants.PR_RDT_GET_MATERIAL_WITH_TESTS, CommandType.StoredProcedure, args1 =>
            {
                args1.Add("@TestID", args.TestID);
                args1.Add("@Page", args.PageNumber);
                args1.Add("@PageSize", args.PageSize);
                args1.Add("@Filter", args.ToFilterString());
            });

            if (data.Tables.Count == 2)
            {
                var table0 = data.Tables[0];
                if (table0.Columns.Contains("TotalRows"))
                {
                    if (table0.Rows.Count > 0)
                    {
                        result.Total = table0.Rows[0]["TotalRows"].ToInt32();
                    }
                    table0.Columns.Remove("TotalRows");
                }
                result.Data = new
                {
                    Columns = data.Tables[1],
                    Data    = table0
                };
            }
            return(result);
        }
示例#2
0
        public async Task <IHttpActionResult> MarkerWithMaterialS2S([FromUri] MaterialsWithMarkerRequestArgs args)
        {
            if (args == null)
            {
                return(InvalidRequest("Invlid paremeter."));
            }
            var resp = await _s2SService.MarkerWithMaterialS2SAsync(args);

            return(Ok(resp));
        }
示例#3
0
        public async Task <IHttpActionResult> GetDataWithMarkers([FromUri] MaterialsWithMarkerRequestArgs args)
        {
            if (args == null)
            {
                return(InvalidRequest("Please provide required parameters."));
            }

            var resp = await _cNTService.GetDataWithMarkersAsync(args);

            return(Ok(resp));
        }
示例#4
0
 public Task <MaterialsWithMarkerResult> GetDataWithMarkersAsync(MaterialsWithMarkerRequestArgs args)
 {
     return(_cNTRepository.GetDataWithMarkersAsync(args));
 }
示例#5
0
        public DeterminationServiceUnitTests()
        {
            builder = new ContainerBuilder();
            builder.RegisterModule <AutofacModule>();
            IEnumerable <DeterminationResult> determinationlists = new List <DeterminationResult>()
            {
                new DeterminationResult {
                    DeterminationID = 1, DeterminationName = "Test1", DeterminationAlias = "T1", ColumnLabel = "Col1"
                },
                new DeterminationResult {
                    DeterminationID = 2, DeterminationName = "Test2", DeterminationAlias = "T2", ColumnLabel = "Col2"
                }
            };

            determinationRequestArgs = new DeterminationRequestArgs
            {
                CropCode   = "TO",
                TestID     = 1,
                TestTypeID = 1
            };

            dataWithMarkerRequestArgs = new Entities.Args.DataWithMarkerRequestArgs
            {
                TestID     = 1,
                PageNumber = 1,
                PageSize   = 100
            };

            materialsWithMarkerRequestArgs = new Entities.Args.MaterialsWithMarkerRequestArgs
            {
                TestID     = 1,
                PageNumber = 1,
                PageSize   = 100
            };
            externalDeterminationRequestArgs = new Entities.Args.ExternalDeterminationRequestArgs
            {
                CropCode   = "TO",
                TestTypeID = 1
            };

            var dataWithMarker = new DataWithMarkerResult
            {
                Data  = new DataTable(),
                Total = 5
            };
            var materialWithMarker = new MaterialsWithMarkerResult
            {
                Total = 5,
                Data  = new DataTable()
            };

            var determinationRepo = A.Fake <IDeterminationRepository>();

            A.CallTo(() => determinationRepo.GetDeterminationsAsync(determinationRequestArgs)).Returns(determinationlists);
            A.CallTo(() => determinationRepo.GetDataWithDeterminationsAsync(dataWithMarkerRequestArgs)).Returns(dataWithMarker);
            A.CallTo(() => determinationRepo.GetMaterialsWithDeterminationsAsync(materialsWithMarkerRequestArgs)).Returns(materialWithMarker);
            A.CallTo(() => determinationRepo.GetDeterminationsForExternalTestsAsync(externalDeterminationRequestArgs)).Returns(determinationlists);
            A.CallTo(() => determinationRepo.GetMaterialsWithDeterminationsForExternalTestAsync(materialsWithMarkerRequestArgs)).Returns(materialWithMarker);

            builder.RegisterInstance(determinationRepo).As <IDeterminationRepository>().SingleInstance();

            var container = builder.Build();

            _determinationService = container.Resolve <IDeterminationService>();
        }
示例#6
0
 public async Task <MaterialsWithMarkerResult> GetMaterialWithTestsAsync(MaterialsWithMarkerRequestArgs args)
 {
     return(await rdtRepository.GetMaterialWithtTestsAsync(args));
 }
示例#7
0
        public async Task <IHttpActionResult> GetMaterialsWithDeterminationsForExternalTest([FromBody] MaterialsWithMarkerRequestArgs args)
        {
            var determminations = await determinationService.GetMaterialsWithDeterminationsForExternalTestAsync(args);

            return(Ok(determminations));
        }
示例#8
0
        public async Task <MaterialsWithMarkerResult> GetMaterialsWithDeterminationsForExternalTestAsync(MaterialsWithMarkerRequestArgs request)
        {
            var result = new MaterialsWithMarkerResult();
            //DbContext.CommandTimeout = 2 * 60; //time out is set to 2 minutes
            var data = await DbContext.ExecuteDataSetAsync(DataConstants.PR_GET_MATERIAL_WITH_MARKER_FOR_EXTERNAL_TEST, CommandType.StoredProcedure, args =>
            {
                args.Add("@TestID", request.TestID);
                //args.Add("@UserID", userContext.GetContext().FullName);
                args.Add("@Page", request.PageNumber);
                args.Add("@PageSize", request.PageSize);
                args.Add("@Filter", request.ToFilterString());
            });

            if (data.Tables.Count == 2)
            {
                var table0 = data.Tables[0];
                if (table0.Columns.Contains("TotalRows"))
                {
                    if (table0.Rows.Count > 0)
                    {
                        result.Total = table0.Rows[0]["TotalRows"].ToInt32();
                    }
                    table0.Columns.Remove("TotalRows");
                }
                result.Data = new
                {
                    Columns = data.Tables[1],
                    Data    = table0
                };
            }
            return(result);
        }
示例#9
0
 public async Task <MaterialsWithMarkerResult> GetMaterialsWithDeterminationsForExternalTestAsync(MaterialsWithMarkerRequestArgs request)
 {
     request.Validate();
     return(await repository.GetMaterialsWithDeterminationsForExternalTestAsync(request));
 }
示例#10
0
        public async Task <IHttpActionResult> Getmaterialwithtests([FromBody] MaterialsWithMarkerRequestArgs args)
        {
            var ds = await _rdtService.GetMaterialWithTestsAsync(args);

            return(Ok(ds));
        }