public JsonResult DisplayProduct(DataSourceRequest command, List<StandardOrderItems> items,int ProductId,string SearchProduct)
{
SearchProduct = SearchProduct.Trim() == "Search".Trim() ? "" : SearchProduct;
var productDtls = _productService.GetRelatedProductByIds(ProductId, SearchProduct, command.Page - 1, command.PageSize);
var gridModel = new DataSourceResult();
gridModel.Data = productDtls.Select(p =>
{
var relatedProductConversions = _productService.GetProductById(p.ProductId2);
string pictureUrl = relatedProductConversions.ProductPictures.FirstOrDefault() == null ? string.Empty : _pictureService.GetPictureUrl(relatedProductConversions.ProductPictures.FirstOrDefault().Picture);
pictureUrl = setPictureUrl(pictureUrl);
Category category = _categoryService.GetCategoryById(relatedProductConversions.ProductCategories.FirstOrDefault().CategoryId);
return new ProductSliderModel
{
ProductConversionId = p.Id,
ProductId = p.ProductId2,
ProductName = relatedProductConversions.Name,
PictureUrl = pictureUrl,
ProductDescription = string.Join(" , ", _productService.GetProductById(p.ProductId2).ProductCategories.Select(m => m.Category.Name).ToList())
};
}).ToList();
gridModel.Total = productDtls.TotalCount;
return Json(gridModel, JsonRequestBehavior.AllowGet);
}
-------------------------------------------------------------------------------------------------------
Search = Search.Trim() == "Search".Trim() ? "" : Search;
var data = _summaryService.GetAllSummary(command.Page - 1, command.PageSize, Search, Convert.ToDateTime(StartDate), Convert.ToDateTime(EndDate), WarehouseId);
var gridModel = new DataSourceResult();
gridModel.Data = data.Select(m =>
{
List<RepackagingUserMapping> lstumap= _repackagingService.GetAllRepackagingUserMapping().Where(v=>v.RepackaingId== _repackagingService.GetAllRepackaging().SingleOrDefault(t=>t.WarehouseId==m.WarehouseId).Id).ToList();
return new Summary
{
Id = m.WarehouseId,
Warehouse = m.Warehouse,
LineItemsNo = m.LineItemsNo,
Sid = m.Sid,
AssignedTo =string.Join(",", _cycleCountService.GetWarehoueEmployees(0, int.MaxValue).ToList().Where(v => lstumap.Select(h => h.UserId).ToArray().Contains(v.Id)).Select(p => p.SystemName)),
Status = m.Status,
};
}
);
gridModel.Total = data.TotalCount;
return Json(gridModel, JsonRequestBehavior.AllowGet);
{
SearchProduct = SearchProduct.Trim() == "Search".Trim() ? "" : SearchProduct;
var productDtls = _productService.GetRelatedProductByIds(ProductId, SearchProduct, command.Page - 1, command.PageSize);
var gridModel = new DataSourceResult();
gridModel.Data = productDtls.Select(p =>
{
var relatedProductConversions = _productService.GetProductById(p.ProductId2);
string pictureUrl = relatedProductConversions.ProductPictures.FirstOrDefault() == null ? string.Empty : _pictureService.GetPictureUrl(relatedProductConversions.ProductPictures.FirstOrDefault().Picture);
pictureUrl = setPictureUrl(pictureUrl);
Category category = _categoryService.GetCategoryById(relatedProductConversions.ProductCategories.FirstOrDefault().CategoryId);
return new ProductSliderModel
{
ProductConversionId = p.Id,
ProductId = p.ProductId2,
ProductName = relatedProductConversions.Name,
PictureUrl = pictureUrl,
ProductDescription = string.Join(" , ", _productService.GetProductById(p.ProductId2).ProductCategories.Select(m => m.Category.Name).ToList())
};
}).ToList();
gridModel.Total = productDtls.TotalCount;
return Json(gridModel, JsonRequestBehavior.AllowGet);
}
-------------------------------------------------------------------------------------------------------
Search = Search.Trim() == "Search".Trim() ? "" : Search;
var data = _summaryService.GetAllSummary(command.Page - 1, command.PageSize, Search, Convert.ToDateTime(StartDate), Convert.ToDateTime(EndDate), WarehouseId);
var gridModel = new DataSourceResult();
gridModel.Data = data.Select(m =>
{
List<RepackagingUserMapping> lstumap= _repackagingService.GetAllRepackagingUserMapping().Where(v=>v.RepackaingId== _repackagingService.GetAllRepackaging().SingleOrDefault(t=>t.WarehouseId==m.WarehouseId).Id).ToList();
return new Summary
{
Id = m.WarehouseId,
Warehouse = m.Warehouse,
LineItemsNo = m.LineItemsNo,
Sid = m.Sid,
AssignedTo =string.Join(",", _cycleCountService.GetWarehoueEmployees(0, int.MaxValue).ToList().Where(v => lstumap.Select(h => h.UserId).ToArray().Contains(v.Id)).Select(p => p.SystemName)),
Status = m.Status,
};
}
);
gridModel.Total = data.TotalCount;
return Json(gridModel, JsonRequestBehavior.AllowGet);
No comments:
Post a Comment