Пример #1
0
        public ActionResult GetVehicleTypeInfo(VehicleTypeSearchModel model, int searchPage)
        {
            SearchDataWithPagedDatas <VehicleTypeSearchModel, VehicleTypeListModel> result =
                new SearchDataWithPagedDatas <VehicleTypeSearchModel, VehicleTypeListModel>();

            result.SearchModel = model;
            result.PagedDatas  = VehicleMaintainBLL.GetPagedVehicleType(model, searchPage, this.PageSize);
            return(PartialView("_VehicleTypesGrid", result));
        }
Пример #2
0
        public static AsiatekPagedList <VehicleTypeListModel> GetPagedVehicleType(VehicleTypeSearchModel model, int searchPage, int pageSize)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "VehicleTypes v"),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "v.Code"),
                new SqlParameter("@showColumns", @"v.Code ,v.Name,v.ParentCode"),
            };

            string conditionStr = " 1=1 ";

            if (!string.IsNullOrWhiteSpace(model.VehicleTCode))
            {
                conditionStr += " AND v.Code LIKE '%" + model.VehicleTCode + "%'";
            }
            if (!string.IsNullOrWhiteSpace(model.VehicleTName))
            {
                conditionStr += " AND v.Name LIKE '%" + model.VehicleTName + "%'";
            }
            if (!string.IsNullOrWhiteSpace(conditionStr))
            {
                paras.Add(new SqlParameter("@conditionStr", conditionStr));
            }

            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 <VehicleTypeListModel> list = ConvertToList <VehicleTypeListModel> .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));
        }