public ActionResult GetTerminalManufacturerInfo(TerminalManufacturerSearchModel model, int searchPage)
        {
            SearchDataWithPagedDatas <TerminalManufacturerSearchModel, TerminalManufacturerListModel> result = new SearchDataWithPagedDatas <TerminalManufacturerSearchModel, TerminalManufacturerListModel>();

            result.SearchModel = model;
            result.PagedDatas  = TerminalManufacturerBLL.GetPagedTerminalManufacturers(result.SearchModel, searchPage, this.PageSize);
            return(PartialView("_TerminalManufacturerPagedGrid", result));
        }
Ejemplo n.º 2
0
        public static AsiatekPagedList <TerminalManufacturerListModel> GetPagedTerminalManufacturers(TerminalManufacturerSearchModel model, int searchPage, int pageSize)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "TerminalManufacturer"),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "ID"),
                new SqlParameter("@showColumns", "ID,ManufacturerName,ManufacturerCode,Nationality"),
            };

            if (!string.IsNullOrWhiteSpace(model.ManufacturerName))
            {
                paras.Add(new SqlParameter("@conditionStr", "ManufacturerName LIKE '%" + model.ManufacturerName + "%'"));
            }

            paras.Add(new SqlParameter()
            {
                ParameterName = "@totalItemCount",
                Direction     = ParameterDirection.Output,
                SqlDbType     = SqlDbType.Int
            });
            paras.Add(new SqlParameter()
            {
                ParameterName = "@newCurrentPage",
                Direction     = ParameterDirection.Output,
                SqlDbType     = SqlDbType.Int
            });
            List <TerminalManufacturerListModel> list = ConvertToList <TerminalManufacturerListModel> .Convert(MSSQLHelper.ExecuteDataTable(CommandType.StoredProcedure, "Proc_GetPagedDatas", paras.ToArray()));

            int totalItemCount = Convert.ToInt32(paras[paras.Count - 2].Value);
            int newCurrentPage = Convert.ToInt32(paras[paras.Count - 1].Value);

            return(list.ToPagedList(newCurrentPage, pageSize, totalItemCount));
        }