public ActionResult List() { if (DataMemory.CurrentUser == null) { return(Redirect("/admin/dang-xuat")); } var request = new SearchColorWarehouseRequest() { CurrentPage = 1, Start = 1, End = ConfigInfo.RecordOnPage }; return(View("~/Areas/Admin/Views/ColorWarehouse/List.cshtml", SearchColorWarehouse(request))); }
public DataSet Search(SearchColorWarehouseRequest model, ref int pTotal) { try { var spParameter = new SqlParameter[3]; #region Set param var parameter = new SqlParameter("@P_START", SqlDbType.VarChar) { Direction = ParameterDirection.Input, Value = model.Start }; spParameter[0] = parameter; parameter = new SqlParameter("@P_END", SqlDbType.VarChar) { Direction = ParameterDirection.Input, Value = model.End }; spParameter[1] = parameter; parameter = new SqlParameter("@P_TOTAL", SqlDbType.Int) { Direction = ParameterDirection.Output, Value = -1 }; spParameter[2] = parameter; #endregion var ds = SqlHelper.ExecuteDataset(ConfigInfo.ConnectString, CommandType.StoredProcedure, "PROC_COLOR_SEARCH", spParameter); pTotal = Convert.ToInt32(spParameter[2].Value); return(ds); } catch (Exception ex) { Logger.Log.Error(ex.ToString()); return(new DataSet()); } }
public ActionResult ColorWarehouse() { var request = new SearchColorWarehouseRequest() { Start = 1, End = 1000 }; var total = 0; var ds = _colorWarehouseDa.Search(request, ref total); List <ColorWarehouse> lst = CBO <ColorWarehouse> .FillCollectionFromDataSet(ds); var listColorWarehouse = new ListColorWarehouse() { Collection = lst }; return(View(listColorWarehouse)); }
private ListColorWarehouse SearchColorWarehouse(SearchColorWarehouseRequest request) { var total = 0; var ds = _colorWarehouseDa.Search(request, ref total); //var lstNew = CBO.Fill2ListFromDataSet<Project>(ds, typeof(Project)); var lstNew = CBO <ColorWarehouse> .FillCollectionFromDataSet(ds); var totalPage = Math.Ceiling((decimal)total / ConfigInfo.RecordOnPage); var paging = HtmlControllHelpers.WritePaging(totalPage, request.CurrentPage, total, ConfigInfo.RecordOnPage, "bản ghi"); var listNews = new ListColorWarehouse() { Start = request.Start, Collection = lstNew, Paging = paging, TotalRecord = total, TotalPage = totalPage, CurrentPage = request.CurrentPage }; return(listNews); }
public ActionResult Search(SearchColorWarehouseRequest request) { return(PartialView("~/Areas/Admin/Views/ColorWarehouse/_listColor.cshtml", SearchColorWarehouse(request))); }