protected void btnSearch_Click(object sender, EventArgs e) { DFISYS.BO.SearchHelper objhelp = new DFISYS.BO.SearchHelper(); string keyword = txtKeyword.Text.Trim().Replace("'", ""); string[] strKeys = keyword.Split(" ".ToCharArray()); string strKey = objhelp.getAndCond("News_Title,News_Source", strKeys); string strCat = cboCategory.SelectedValue; string strAndCat = ""; if (strCat != "0") { CategoryRow objCat = CategoryHelper.getCatInfoAsCategoryRow(Convert.ToInt32(strCat)); if (objCat.Cat_ParentID == 0) { strCat = CategoryHelper.GetChildCatIdByCatParentId(Convert.ToInt32(strCat)); if (strCat.Trim() != "") { strCat += "," + cboCategory.SelectedValue; } else { strCat = cboCategory.SelectedValue; } } strAndCat = " AND Category.Cat_ID IN (" + strCat + ")"; } objListNewsSource.SelectParameters[0].DefaultValue = " News_Status=3 AND " + strKey + strAndCat; }
protected void btnSearch_Click(object sender, EventArgs e) { // Reset cac gia tri cua Filter txtFromDate.Text = ""; txtToDate.Text = ""; // ddlChuyenmuc.SelectedValue = "0"; // Session.Remove("ddlChuyenmuc"); Session.Remove("txtFromDate"); Session.Remove("txtToDate"); // End Reset DFISYS.BO.SearchHelper objhelp = new DFISYS.BO.SearchHelper(); string strcpmode = Request.QueryString["cpmode"].ToString(); string strKeyword = txtKeyword.Text.Trim().Replace("'", " "); strKeyword = strKeyword.Replace('"', ' '); string[] strKeys = strKeyword.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); string strWhere = objhelp.getAndCond("News_Title", strKeys); if (strWhere.Trim() != "") { strWhere = " And " + strWhere; } string strCat = ddlChuyenmuc.SelectedValue; if (strCat == "0") { strCat = CategoryHelper.Treebuild(ddlChuyenmuc); } excutive(strcpmode, strCat, strWhere); // Luu cac gia tri TimKiem Session["txtKeyword"] = txtKeyword.Text.Trim(); grdListNews.SelectedIndex = -1; grdListNews.PageIndex = 0; }