/// <summary> /// 获取查询结果 /// </summary> public DataTable GetSearchList(XCLShouCang.Model.Custom.WebTypeSearch searchModel, int top) { searchModel.TypeName = string.Format("%{0}%", searchModel.TypeName).ToUpper(); searchModel.TypeURL = string.Format("%{0}%", searchModel.TypeURL).ToUpper(); DataSet ds = null; DataTable dt = null; StringBuilder strSql = new StringBuilder(); strSql.Append(" select "); if (top > 0) { strSql.AppendFormat(" top {0} ", top); } strSql.Append(" WebTypeID,TypeName,TypeURL,IsFolder from WebType where isdel=0 and FK_UserID=@FK_UserID and (Upper(TypeName) like @typeName or Upper(TypeURL) like @typeURL) "); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@FK_UserID", SqlDbType.BigInt, 8), new SqlParameter("@typeName", SqlDbType.VarChar, 500), new SqlParameter("@typeURL", SqlDbType.VarChar, 500) }; parameters[0].Value = searchModel.FK_UserID; parameters[1].Value = searchModel.TypeName; parameters[2].Value = searchModel.TypeURL; ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (null != ds && ds.Tables.Count > 0) { dt = ds.Tables[0]; } return(dt); }
public JsonResult GetSearchJsonResult(string keyWord) { List <XCLShouCang.Model.Custom.WebTypeSearch> resultLst = null; keyWord = keyWord.Trim(); if (!string.IsNullOrEmpty(keyWord)) { XCLShouCang.Model.Custom.WebTypeSearch searchModel = new XCLShouCang.Model.Custom.WebTypeSearch(); searchModel.FK_UserID = base.CurrentUserModel.UserID; searchModel.TypeName = keyWord; searchModel.TypeURL = keyWord; XCLShouCang.BLL.WebType bll = new XCLShouCang.BLL.WebType(); resultLst = bll.GetSearchList(searchModel, 8); } if (null == resultLst) { resultLst = new List <XCLShouCang.Model.Custom.WebTypeSearch>(); } return(Json(resultLst, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取查询结果 /// </summary> public List <XCLShouCang.Model.Custom.WebTypeSearch> GetSearchList(XCLShouCang.Model.Custom.WebTypeSearch searchModel, int top) { List <XCLShouCang.Model.Custom.WebTypeSearch> lst = null; DataTable dt = dal.GetSearchList(searchModel, top); if (null != dt && dt.Rows.Count > 0) { lst = new List <Model.Custom.WebTypeSearch>(); for (int i = 0; i < dt.Rows.Count; i++) { lst.Add(new Model.Custom.WebTypeSearch() { IsFolder = Convert.ToInt32(dt.Rows[i]["IsFolder"] ?? "0"), TypeName = dt.Rows[i]["TypeName"].ToString(), TypeURL = dt.Rows[i]["TypeURL"].ToString(), WebTypeID = Convert.ToInt64(dt.Rows[i]["WebTypeID"].ToString()) }); } } return(lst); }