public ActionResult GetReceiverMailInfo(ReceiverMailInfoSearchModel model, int searchPage)
        {
            SearchDataWithPagedDatas <ReceiverMailInfoSearchModel, ReceiverMailInfoListModel> result =
                new SearchDataWithPagedDatas <ReceiverMailInfoSearchModel, ReceiverMailInfoListModel>();

            result.SearchModel = model;
            result.PagedDatas  = ReceiverMailInfoBLL.GetPagedReceiverMailInfo(model, searchPage, this.PageSize);
            return(PartialView("_ReceiverMailInfoPagedGrid", result));
        }
Exemple #2
0
        public static AsiatekPagedList <ReceiverMailInfoListModel> GetPagedReceiverMailInfo(ReceiverMailInfoSearchModel model, int searchPage, int pageSize)
        {
            string joinStr = string.Empty;


            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@tableName", "ReceiverMailInfo rmi"),
                new SqlParameter("@joinStr", joinStr),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@currentPage", searchPage),
                new SqlParameter("@orderBy", "rmi.CreateTime desc"),
                new SqlParameter("@showColumns", @"rmi.ID ,rmi.Email,rmi.Name,rmi.Remark,rmi.Status"),
            };
            string conditionStr = " 1=1 ";//不查询删除

            if (!string.IsNullOrWhiteSpace(model.Email))
            {
                conditionStr += (string.Format(" and rmi.Email like '%{0}%'", model.Email.Trim()));
            }
            if (!string.IsNullOrWhiteSpace(model.Name))
            {
                conditionStr += (string.Format(" and rmi.Name like '%{0}%'", model.Name.Trim()));
            }
            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 <ReceiverMailInfoListModel> list = ConvertToList <ReceiverMailInfoListModel> .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));
        }