Ejemplo n.º 1
0
        public ProductComplianceListModel FindProductComplianceListModel(int productId,
                                                                         int index           = 0,
                                                                         int pageNo          = 1,
                                                                         int pageSize        = Int32.MaxValue,
                                                                         string search       = "",
                                                                         string sortColumn   = "",
                                                                         SortOrder sortOrder = SortOrder.Asc)
        {
            var model = new ProductComplianceListModel();

            model.GridIndex = index;
            var allItems = db.FindProductCompliances(productId, sortColumn, sortOrder)
                           .Where(pc => string.IsNullOrEmpty(search) ||
                                  (pc.LOVItem_ComplianceCategory != null && pc.LOVItem_ComplianceCategory.ItemText.ToLower().Contains(search.ToLower())) ||
                                  (pc.LOVItem_Market != null && pc.LOVItem_Market.ItemText.ToLower().Contains(search.ToLower()))
                                  );

            model.TotalRecords = allItems.Count();
            foreach (var item in allItems.Skip((pageNo - 1) * pageSize)
                     .Take(pageSize))
            {
                model.Items.Add(MapToModel(item));
            }

            return(model);
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int index, int id)
        {
            var model = new ProductComplianceListModel();

            model.GridIndex = index;

            try {
                ProductService.DeleteProductCompliance(id);
            } catch (Exception e1) {
                model.Error.SetError(e1);
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }