Esempio n. 1
0
        public JsonResult GenBWQEntities([FromBody] BWQEntityFilter filter)
        {
            if (ModelState.IsValid && filter != null)
            {
                IQueryable <BWQEntity> result = _context.BWQEntity
                                                .FromSql($"usp_GetBWQEntities_sel @countryName={filter.countryName}, @categoryName={filter.categoryName}, @batchName={filter.batchName}, @aging={filter.aging}, @appuser={filter.appUserID}")
                                                .Select(pg => new BWQEntity
                {
                    BWQEntitiesId = pg.BWQEntitiesId,
                    MMMEntityId   = pg.MMMEntityId,
                    EntityName    = pg.EntityName,
                    BatchCount    = pg.BatchCount,
                    OriginalCount = pg.OriginalCount,
                    BatchName     = pg.BatchName,
                    Priority      = pg.Priority,
                    CountryName   = pg.CountryName,
                    CategoryName  = pg.CategoryName,
                    StartDateUTC  = pg.StartDateUTC,
                    LockedBy      = pg.LockedBy,
                    LockedAt      = pg.LockedAt
                });

                return(Json(result.ToList()));
            }
            return(Json(""));
        }
Esempio n. 2
0
        public IEnumerable <BWQEntityData> FilterBWQEntities(BWQEntityFilter filter)
        {
            try
            {
                var result = _context.BWQEntityData
                             .AsNoTracking()
                             .FromSql("usp_GetBWQEntities_sel @countryName={0}, @categoryName={1}, @batchName={2}, @aging={3}, @appuser={4}",
                                      filter.CountryName,
                                      filter.CategoryName,
                                      filter.BatchName,
                                      filter.Aging,
                                      filter.AppUserID)
                             .Select(pg => new BWQEntityData
                {
                    BWQEntitiesId = pg.BWQEntitiesId,
                    MMMEntityId   = pg.MMMEntityId,
                    EntityName    = pg.EntityName,
                    BatchCount    = pg.BatchCount,
                    OriginalCount = pg.OriginalCount,
                    BatchName     = pg.BatchName,
                    Priority      = pg.Priority,
                    CountryName   = pg.CountryName,
                    CategoryName  = pg.CategoryName,
                    StartDateUTC  = pg.StartDateUTC,
                    LockedBy      = pg.LockedBy,
                    LockedAt      = pg.LockedAt
                });

                return(result);
            }
            catch (Exception ex)
            {
                // TODO Log this
                return(null);
            }
        }
Esempio n. 3
0
        public IActionResult FilterBWQEntities([FromBody] BWQEntityFilter filter)
        {
            IEnumerable <BWQEntityData> result = _repository.FilterBWQEntities(filter);

            return(Helper.CheckResult(result));
        }