Exemplo n.º 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            DateTime?FromDate      = dteFromDate.SelectedDateChristian;
            DateTime?ToDate        = dteToDate.SelectedDateChristian;
            string   strFromNewsNo = txtFromNewsno.Text;
            string   strToNewsNo   = txtToNewsNo.Text;
            string   Keyword       = txtKeyword.Text;

            int SearchType = 0;

            for (int i = 0; i < chkListSearchType.Items.Count; i++)
            {
                if (chkListSearchType.Items[i].Selected)
                {
                    SearchType += Convert.ToInt32(chkListSearchType.Items[0].Value);
                }
            }
            BOLNews            NewsBOL       = new BOLNews();
            IQueryable <vNews> SearchResults = NewsBOL.Search(FromDate, ToDate, strFromNewsNo, strToNewsNo, Keyword, SearchType, null);

            rptSelectedNews.DataSource = SearchResults.Take(10);
            rptSelectedNews.DataBind();

            if (rptSelectedNews.Items.Count > 0)
            {
                pnlSelectedNews.Visible = true;
                msgBox.MessageTextMode  = AKP.Web.Controls.Common.MessageMode.OK;
                msgBox.Text             = SearchResults.Count() + " خبر پیدا شد.";
                if (SearchResults.Count() > 10)
                {
                    msgBox.Text += "10 خبر آخر نمایش داده میشوند.";
                }
            }
            else
            {
                pnlSelectedNews.Visible = false;
                msgBox.MessageTextMode  = AKP.Web.Controls.Common.MessageMode.Warning;
                msgBox.Text             = "هیج خبری با این مشخصات وجود ندارد.";
            }
        }
Exemplo n.º 2
0
        private void FilterItems()
        {
            DateTime?FromDate      = dteFromDate.SelectedDateChristian;
            DateTime?ToDate        = dteFromDate.SelectedDateChristian;
            string   strFromNewsNo = txtFromNewsno.Text;
            string   strToNewsNo   = txtToNewsNo.Text;
            string   Keyword       = txtKeyword.Text;

            int SearchType = 0;

            for (int i = 0; i < chkListSearchType.Items.Count; i++)
            {
                if (chkListSearchType.Items[i].Selected)
                {
                    SearchType += Convert.ToInt32(chkListSearchType.Items[0].Value);
                }
            }
            BOLNews NewsBOL = new BOLNews();

            rptLatestNews.DataSource = NewsBOL.Search(FromDate, ToDate, strFromNewsNo, strToNewsNo, Keyword, SearchType, null);
            rptLatestNews.DataBind();
            ViewState["ItemFiltered"] = true;
        }