Beispiel #1
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            switch (HiddenFieldSearchType.Value)
            {
            case "1":
            {
                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchUsername(TextBoxUsername.Text);

                if (dt.Rows.Count == 0)
                {
                    PanelUsername.Visible = false;
                    PanelResult.Visible   = false;
                    LabelMessage.Visible  = true;
                    LabelMessage.Text     = "No record found!";
                }
                else
                {
                    RepeaterUsername.DataSource = dt;
                    RepeaterUsername.DataBind();

                    LabelMessage.Visible  = false;
                    PanelUsername.Visible = true;
                    PanelResult.Visible   = false;
                }
                break;
            }

            case "2":
            {
                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchHashtag(TextBoxTag.Text, Convert.ToInt32(HiddenFieldLocationId.Value));

                if (dt.Rows.Count == 0)
                {
                    PanelResult.Visible  = false;
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "No record found!";
                }
                else
                {
                    RepeaterResult.DataSource = dt;
                    RepeaterResult.DataBind();

                    LabelMessage.Visible  = false;
                    PanelUsername.Visible = false;
                    PanelResult.Visible   = true;
                }
                break;
            }

            case "3":
            {
                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchType(Convert.ToInt32(HiddenFieldTypeId.Value), Convert.ToInt32(HiddenFieldLocationId.Value));

                if (dt.Rows.Count == 0)
                {
                    PanelResult.Visible  = false;
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "No record found!";
                }
                else
                {
                    RepeaterResult.DataSource = dt;
                    RepeaterResult.DataBind();

                    LabelMessage.Visible  = false;
                    PanelUsername.Visible = false;
                    PanelResult.Visible   = true;
                }
                break;
            }
            }
        }
Beispiel #2
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            switch (HiddenFieldSearchType.Value)
            {
            case "1":     //username
            {
                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchUsername(TextBoxUsername.Text);

                if (dt.Rows.Count == 0)
                {
                    PanelUsername.Visible         = false;
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "0";
                }
                else
                {
                    RepeaterUsername.DataSource = dt;
                    RepeaterUsername.DataBind();

                    PanelUsername.Visible         = true;
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "1";
                }
                break;
            }

            case "2":     //hashtag
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchHashtag(TextBoxTag.Text, locationId);

                if (dt.Rows.Count == 0)
                {
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "0";
                }
                else
                {
                    RepeaterResult.DataSource = dt;
                    RepeaterResult.DataBind();

                    PanelUsername.Visible         = false;
                    PanelResult.Visible           = true;
                    HiddenFieldSearchStatus.Value = "1";
                }
                break;
            }

            case "3":     //type
            {
                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                Classes.Search s  = new Classes.Search();
                DataTable      dt = s.searchType(Convert.ToInt32(HiddenFieldTypeId.Value), locationId);

                if (dt.Rows.Count == 0)
                {
                    PanelResult.Visible           = false;
                    HiddenFieldSearchStatus.Value = "0";
                }
                else
                {
                    RepeaterResult.DataSource = dt;
                    RepeaterResult.DataBind();

                    PanelUsername.Visible         = false;
                    PanelResult.Visible           = true;
                    HiddenFieldSearchStatus.Value = "1";
                }
                break;
            }
            }
        }