protected void ButtonSubmit_OnClick(object sender, EventArgs e) { var app = new App(TextBoxUrl.Text); var disiredDays = app.GetAllAvailableDays(); //Saves the url in session so list of movies will be listed after back click Session["url"] = TextBoxUrl.Text; RepeaterResult.DataSource = ListOfMovies; RepeaterResult.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (TextBoxUrl.Text != "") { var url = (string)Session["url"] ?? TextBoxUrl.Text; //var listOfMovies = _app.GetListOfMovies(_desiredDays); var app = new App(url); _desiredDays = app.GetAllAvailableDays(); } //Reload list of movies if (Session["url"] != null) { RepeaterResult.DataSource = ListOfMovies; RepeaterResult.DataBind(); } //Will run if user has pressed a link check availability in resturang if (HttpContext.Current.Request.QueryString.HasKeys()) { var app = new App(Session["url"].ToString()); var availableDinnerTime = app.IsDinnerTimeAvailable(ListOfMovies); if (availableDinnerTime.Any()) { //Movie name Session["name"] = Request.QueryString["name"]; //List of Dinner objects Cache["dinner"] = availableDinnerTime; Response.Redirect("ResultAvailable.aspx"); } else { Response.Redirect("ResultNotAvailable.aspx"); } } }
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; } } }
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; } } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Search"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Search"); } } if (!IsPostBack) { Classes.UserInfo ui = new Classes.UserInfo(); LabelLocation.Text = ui.getUserLocationInfoByUserId(UserId); string keyword = ""; try { keyword = Page.RouteData.Values["Keyword"].ToString(); } catch { } finally { } if (keyword.Length > 0) { int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"])); Classes.Search s = new Classes.Search(); DataTable dt = s.searchHashtag(keyword, locationId); TextBoxTag.Text = keyword; HiddenFieldSearchType.Value = "2"; 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"; } } } }