Beispiel #1
0
        public async void ProductSummaryDetails()
        {
            // Arrange
            this.QuarryDbContext.Yards.AddRange(
                new YardEntity()
            {
                YardId = 1, YardName = "Central Yard", QuarryId = 1, CompanyId = 1, DeletedInd = false
            },
                new YardEntity()
            {
                YardId = 2, YardName = "NDB Central Yard", QuarryId = 2, CompanyId = 1, DeletedInd = false
            });

            await this.SaveChangesAsync(this.QuarryDbContext);

            await this.StockGetArrange();

            ProductSummarySearchModel model = new ProductSummarySearchModel()
            {
                QuarryIds = new int[] { 1 }, ProductTypeIds = new int[] { 1 }, MaterialColourIds = new int[] { 1 }
            };

            // Act
            AjaxModel <List <StockModel> > ajaxModel = await this.Controller.ProductSummaryDetails(model);

            // Assert
            this.StockGetAssert(ajaxModel.Model);
        }
Beispiel #2
0
        public async Task <List <StockModel> > ProductSummaryDetails(ProductSummarySearchModel search)
        {
            // getting the yardid and then calling the stockget
            YardEntity yard = await(from yd in this.DbContext.Yards where yd.QuarryId == search.QuarryIds[0] select yd).SingleAsync();

            return(await this.StockGet(yard.YardId, search.ProductTypeIds[0], search.MaterialColourIds[0], search.StartDate, search.EndDate));
        }
Beispiel #3
0
        public async void ProductSummarySearch()
        {
            // Arrange
            await this.ProductSummaryArrange();

            ProductSummarySearchModel model = new ProductSummarySearchModel() { QuarryIds = new int[] { 1, 2 }, ProductTypeIds = new int[] { 1, 2 }, MaterialColourIds = new int[] { 1, 2 } };

            // Act
            AjaxModel<List<ProductSummaryModel>> ajaxModel = await this.Controller.ProductSummarySearch(model);

            // Assert
            this.ProductSummaryAssert(ajaxModel.Model);
        }
Beispiel #4
0
        public async Task <List <ProductSummaryModel> > ProductSummarySearch(ProductSummarySearchModel search)
        {
            string quarryIds         = search.QuarryIds == null || search.QuarryIds.Length == 0 ? null : string.Join(",", search.QuarryIds);
            string productTypeIds    = search.ProductTypeIds == null || search.ProductTypeIds.Length == 0 ? null : string.Join(",", search.ProductTypeIds);
            string materialColourIds = search.MaterialColourIds == null || search.MaterialColourIds.Length == 0 ? null : string.Join(",", search.MaterialColourIds);

            return(await this.DbContext.FromSql <ProductSummaryEntity>(
                       "quarry.ProductSummaryGet @CompanyId = {0}, @QuarryIds = {1}, @ProductTypeIds = {2}, @MaterialColourIds = {3}, @StartDate = {4}, @EndDate = {5}",
                       this.AppContext.CompanyId,
                       quarryIds,
                       productTypeIds,
                       materialColourIds,
                       search.StartDate,
                       search.EndDate)
                   .Select(m => Mapper.Map <ProductSummaryEntity, ProductSummaryModel>(m)).ToListAsync());
        }
Beispiel #5
0
        public async void ProductSummarySearch()
        {
            // Arrange
            await this.ProductSummaryArrange();

            ProductSummarySearchModel model = new ProductSummarySearchModel()
            {
                QuarryIds = new int[] { 1, 2 }, ProductTypeIds = new int[] { 1, 2 }, MaterialColourIds = new int[] { 1, 2 }
            };

            // Act
            AjaxModel <List <ProductSummaryModel> > ajaxModel = await this.Controller.ProductSummarySearch(model);

            // Assert
            this.ProductSummaryAssert(ajaxModel.Model);
        }
Beispiel #6
0
 public async Task <List <StockModel> > ProductSummaryDetails(ProductSummarySearchModel search)
 {
     return(await this.quarryRepository.ProductSummaryDetails(search));
 }
Beispiel #7
0
 public async Task <List <ProductSummaryModel> > ProductSummarySearch(ProductSummarySearchModel search)
 {
     return(await this.quarryRepository.ProductSummarySearch(search));
 }
 public async Task <AjaxModel <List <StockModel> > > ProductSummaryDetails([FromBody] ProductSummarySearchModel search)
 {
     return(await AjaxHelper.GetAsync(m => this.domain.ProductSummaryDetails(search)));
 }
Beispiel #9
0
        public async void ProductSummaryDetails()
        {
            // Arrange
            this.QuarryDbContext.Yards.AddRange(
                    new YardEntity() { YardId = 1, YardName = "Central Yard", QuarryId = 1, CompanyId = 1, DeletedInd = false },
                    new YardEntity() { YardId = 2, YardName = "NDB Central Yard", QuarryId = 2, CompanyId = 1, DeletedInd = false });

            await this.SaveChangesAsync(this.QuarryDbContext);
            await this.StockGetArrange();

            ProductSummarySearchModel model = new ProductSummarySearchModel() { QuarryIds = new int[] { 1 }, ProductTypeIds = new int[] { 1 }, MaterialColourIds = new int[] { 1 } };

            // Act
            AjaxModel<List<StockModel>> ajaxModel = await this.Controller.ProductSummaryDetails(model);

            // Assert
            this.StockGetAssert(ajaxModel.Model);
        }