public ActionResult GetSynchroReceivePoint(MGJH_SynchroReceivePointSearchModel model, int searchPage) { SearchDataWithPagedDatas <MGJH_SynchroReceivePointSearchModel, MGJH_SynchroReceivePointListModel> result = new SearchDataWithPagedDatas <MGJH_SynchroReceivePointSearchModel, MGJH_SynchroReceivePointListModel>(); result.SearchModel = model; result.PagedDatas = MGJH_TransportPointBLL.GetPagedSynchroReceivePoints(result.SearchModel, searchPage, this.PageSize); return(PartialView("_SynchroReceivePointPagedGrid", result)); }
public static AsiatekPagedList <MGJH_SynchroReceivePointListModel> GetPagedSynchroReceivePoints(MGJH_SynchroReceivePointSearchModel model, int searchPage, int pageSize) { List <SqlParameter> paras = new List <SqlParameter>() { new SqlParameter("@tableName", "dbo.MGJH_SynchroReceiveAddress sr "), new SqlParameter("@joinStr", @" LEFT JOIN dbo.MGJH_TransportPointSetting tp ON tp.SourceID=sr.ID "), new SqlParameter("@pageSize", pageSize), new SqlParameter("@currentPage", searchPage), new SqlParameter("@orderBy", "sr.ID DESC"), new SqlParameter("@showColumns", @"sr.ID ,sr.CustomerName ,sr.AddressName ,sr.AddressCode ,sr.AddressArea,tp.SourceID"), }; #region 筛选条件 string conditionStr = " 1=1 "; if (!string.IsNullOrWhiteSpace(model.AddressName)) { conditionStr += " AND sr.AddressName LIKE '%" + model.AddressName + "%'"; } if (!string.IsNullOrWhiteSpace(model.AddressCode)) { conditionStr += " AND sr.AddressCode LIKE '%" + model.AddressCode + "%'"; } if (!string.IsNullOrWhiteSpace(model.CustomerName)) { conditionStr += " AND sr.CustomerName LIKE '%" + model.CustomerName + "%'"; } if (!string.IsNullOrWhiteSpace(model.AddressArea)) { conditionStr += " AND sr.AddressArea LIKE '%" + model.AddressArea + "%'"; } if (model.IsSynchro != -1) //全部 { if (model.IsSynchro == 1) //已同步 { conditionStr += " AND tp.SourceID IS NOT NULL"; } else if (model.IsSynchro == 2) //未同步 { conditionStr += " AND tp.SourceID IS NULL"; } } if (!string.IsNullOrWhiteSpace(conditionStr)) { paras.Add(new SqlParameter("@conditionStr", conditionStr)); } #endregion paras.Add(new SqlParameter() { ParameterName = "@totalItemCount", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int }); paras.Add(new SqlParameter() { ParameterName = "@newCurrentPage", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int }); var rs = MSSQLHelper.ExecuteDataTable(CommandType.StoredProcedure, "Proc_GetPagedDatas", paras.ToArray()); List <MGJH_SynchroReceivePointListModel> list = ConvertToList <MGJH_SynchroReceivePointListModel> .Convert(rs); int totalItemCount = Convert.ToInt32(paras[paras.Count - 2].Value); int newCurrentPage = Convert.ToInt32(paras[paras.Count - 1].Value); return(list.ToPagedList(newCurrentPage, pageSize, totalItemCount)); }