Beispiel #1
0
        public ActionResult GetReceiveTransportPoint(MGJH_ReceiveTransportPointSearchModel model, int searchPage)
        {
            SearchDataWithPagedDatas <MGJH_ReceiveTransportPointSearchModel, MGJH_ReceiveTransportPointListModel> result = new SearchDataWithPagedDatas <MGJH_ReceiveTransportPointSearchModel, MGJH_ReceiveTransportPointListModel>();

            result.SearchModel = model;
            result.PagedDatas  = MGJH_TransportPointBLL.GetPagedReceiveTransportPoints(result.SearchModel, searchPage, this.PageSize);
            return(PartialView("_ReceiveTransportPointPagedGrid", result));
        }
Beispiel #2
0
        public static AsiatekPagedList <MGJH_ReceiveTransportPointListModel> GetPagedReceiveTransportPoints(MGJH_ReceiveTransportPointSearchModel model, int searchPage, int pageSize)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "dbo.MGJH_TransportPointSetting tp "),
                new SqlParameter("@joinStr", @" LEFT JOIN dbo.MGJH_TransportPointSetting tp2 ON tp2.ID=tp.SuperiorAddressID "),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "tp.CreateTime DESC"),
                new SqlParameter("@showColumns", @"tp.ID
      ,tp.SettingType
      ,tp.CustomerName
      ,tp.AddressName
      ,tp.AddressCode
      ,tp.AddressArea
      ,tp.SuperiorAddressID
      ,tp.IsUnloadPoint
      ,tp.EFType
      ,tp.EFInfo
      ,tp.UnloadTime/60 AS UnloadTime
      ,tp.UnloadTimeError/60 AS UnloadTimeError
      ,tp2.AddressName AS SuperiorAddressName"),
            };

            #region 筛选条件
            string conditionStr = " tp.SettingType=2";
            if (!string.IsNullOrWhiteSpace(model.AddressName))
            {
                conditionStr += " AND tp.AddressName LIKE '%" + model.AddressName + "%'";
            }
            if (!string.IsNullOrWhiteSpace(model.AddressCode))
            {
                conditionStr += " AND tp.AddressCode LIKE '%" + model.AddressCode + "%'";
            }
            if (!string.IsNullOrWhiteSpace(model.CustomerName))
            {
                conditionStr += " AND tp.CustomerName LIKE '%" + model.CustomerName + "%'";
            }
            if (!string.IsNullOrWhiteSpace(model.AddressArea))
            {
                conditionStr += " AND tp.AddressArea LIKE '%" + model.AddressArea + "%'";
            }
            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_ReceiveTransportPointListModel> list = ConvertToList <MGJH_ReceiveTransportPointListModel> .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));
        }