예제 #1
0
        public ActionResult GetPlateColorsInfo(VehicleMaintainSearchModels model, int searchPage)
        {
            SearchDataWithPagedDatas <VehicleMaintainSearchModels, VehicleMaintainListModels> result =
                new SearchDataWithPagedDatas <VehicleMaintainSearchModels, VehicleMaintainListModels>();

            result.SearchModel = model;
            result.PagedDatas  = VehicleMaintainBLL.GetPagedPlateColors(model, searchPage, this.PageSize);
            return(PartialView("_PlateColorGrid", result));
        }
예제 #2
0
        public static AsiatekPagedList <VehicleMaintainListModels> GetPagedPlateColors(VehicleMaintainSearchModels model, int searchPage, int pageSize)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "PlateColors p"),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "p.Code"),
                new SqlParameter("@showColumns", @"p.Code ,p.Name"),
            };

            string conditionStr = " 1=1 ";

            if (!string.IsNullOrWhiteSpace(model.PlateCode))
            {
                conditionStr += " AND p.Code LIKE '%" + model.PlateCode + "%'";
            }
            if (!string.IsNullOrWhiteSpace(model.PlateName))
            {
                conditionStr += " AND p.Name LIKE '%" + model.PlateName + "%'";
            }
            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 <VehicleMaintainListModels> list = ConvertToList <VehicleMaintainListModels> .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));
        }