protected void Page_Load(object sender, EventArgs e) { Username_Label.Text = HttpContext.Current.Session["user_name"].ToString(); if (CarsUtility.PullWebRequest(string.Format("CheckChatUpdates.php?id={0}", HttpContext.Current.Session["user_id"].ToString())) == "MESSAGES AVAILABLE") { CHAT_MARKER.Visible = true; } else { CHAT_MARKER.Visible = false; } }
protected void REGISTER_REGISTRIEREN_BUTTON_Click(object sender, EventArgs e) { string EMail = REGISTER_EMAIL_INPUT.Text; string Password = REGISTER_PASSWORT_INPUT.Text; string Username = REGISTER_NAME_INPUT.Text; if (REGISTER_PASSWORT_INPUT.Text.Length < 6) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Passwort ist zu kurz!"; return; } if (REGISTER_PASSWORT_INPUT.Text != REGISTER_PASSWORDBESTÄTIGEN_INPUT.Text) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Passwörter sind nicht identisch!"; return; } if (REGISTER_AGB_GELESEN_CHECKBOX.Checked == false) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Sie müssen den AGB zustimmen!"; return; } string text = CarsUtility.PullWebRequest(string.Format("register.php?email={0}& password={1}&user={2}", EMail, Password, Username)); if (text != "Query successfull") { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = text; return; } text = CarsUtility.PullWebRequest(string.Format("login.php?email={0}& password={1}", EMail, Password)); HttpContext.Current.Session["user_id"] = int.Parse(text.Split('|')[0]); HttpContext.Current.Session["user_name"] = text.Split('|')[1]; //falls Test erfolgreich Response.Redirect("Hauptmenü"); }
protected void LOGIN_LOGIN_BUTTON_Click(object sender, EventArgs e) { string EMail = LOGIN_EMAIL_INPUT.Text; string Password = LOGIN_PASSWORD_INPUT.Text; //Test Login string text = CarsUtility.PullWebRequest(string.Format("login.php?email={0}& password={1}", EMail, Password)); if (text == "query error") { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Logindaten sind falsch!"; return; } HttpContext.Current.Session["user_id"] = int.Parse(text.Split('|')[0]); HttpContext.Current.Session["user_name"] = text.Split('|')[1]; //falls Test erfolgreich Response.Redirect("Hauptmenü"); }
protected void Page_Load(object sender, EventArgs e) { Username_Label.Text = HttpContext.Current.Session["user_name"].ToString(); CARS.Website.SearchFilter s = HttpContext.Current.Session["search_filter"] as CARS.Website.SearchFilter; if (CarsUtility.PullWebRequest(string.Format("CheckChatUpdates.php?id={0}", HttpContext.Current.Session["user_id"].ToString())) == "MESSAGES AVAILABLE") { CHAT_MARKER.Visible = true; } else { CHAT_MARKER.Visible = false; } string text = CarsUtility.PullWebRequest(string.Format("getSeats.php?id={0}", HttpContext.Current.Session["user_id"])); string[] entrys = text.Split(';'); foreach (string entry_ in entrys) { string entry = entry_.Replace("<br>", ""); if (string.IsNullOrEmpty(entry)) { continue; } if (!s.DoesFilterFit(entry)) { continue; } if (entry.Split('|')[2] != HttpContext.Current.Session["user_id"].ToString()) { TableRow entryPanel = new TableRow(); /*TableCell id = new TableCell(); * id.Text = entry.Split('|')[0]; * entryPanel.Controls.Add(id); * */ /* * * TableCell userid = new TableCell(); * userid.Text = entry.Split('|')[2]; * entryPanel.Controls.Add(userid);*/ TableCell start = new TableCell(); start.Text = entry.Split('|')[4]; entryPanel.Controls.Add(start); TableCell end = new TableCell(); end.Text = entry.Split('|')[5]; entryPanel.Controls.Add(end); TableCell departure = new TableCell(); departure.Text = entry.Split('|')[6].Substring(0, 16); entryPanel.Controls.Add(departure); TableCell name = new TableCell(); name.Text = entry.Split('|')[3]; entryPanel.Controls.Add(name); Button profileButton = new Button(); profileButton.CssClass = "profileButton"; profileButton.Text = entry.Split('|')[3]; profileButton.Click += delegate { HttpContext.Current.Session["view_user"] = entry.Split('|')[2]; Response.Redirect("User"); }; name.Controls.Add(profileButton); TableCell rating = new TableCell(); float r = float.Parse(entry.Split('|')[8].Replace(',', '.'), CultureInfo.InvariantCulture); if (r == 0) { rating.Text = "n.a."; } else { for (int i = 0; i < 5; i++) { Panel star_bot = new Panel(); star_bot.CssClass = "RATING_STAR"; rating.Controls.Add(star_bot); Panel star_top = new Panel(); star_top.CssClass = "fullStar"; if (i == Math.Floor(r)) { star_top.Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", ((1 - (r % 1f)) * 100f).ToString().Replace(',', '.'))); } else { if (i < r) { star_top.Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", 0)); } else { star_top.Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", 100)); } } star_bot.Controls.Add(star_top); } } entryPanel.Controls.Add(rating); TableCell count = new TableCell(); count.Text = entry.Split('|')[1]; entryPanel.Controls.Add(count); TableCell controls1 = new TableCell(); entryPanel.Controls.Add(controls1); TableCell controls2 = new TableCell(); entryPanel.Controls.Add(controls2); Button c = new Button(); c.Click += delegate { System.Diagnostics.Debug.WriteLine("Click: " + entry.Split('|')[7]); if (entry.Split('|')[7] == "-1") { HttpContext.Current.Session["reloadchat"] = CarsUtility.PullWebRequest(string.Format("createChat.php?id={0}&user={1}", HttpContext.Current.Session["user_id"], entry.Split('|')[2])); } else { HttpContext.Current.Session["reloadchat"] = entry.Split('|')[7]; } Response.Redirect("Chat"); }; c.Text = "Chat"; controls1.Controls.Add(c); Button f = new Button(); f.Click += delegate { CarsUtility.PullWebRequest(string.Format("takeSeat.php?ride={1}&user={0}", HttpContext.Current.Session["user_id"], entry.Split('|')[0])); Response.Redirect("AlleFahrten"); }; f.Text = "Buchen"; controls2.Controls.Add(f); Table1.Rows.Add(entryPanel); } //Fahrt buchen } }
protected void Page_Load(object sender, EventArgs e) { Username_Label.Text = HttpContext.Current.Session["user_name"].ToString(); if (CarsUtility.PullWebRequest(string.Format("CheckChatUpdates.php?id={0}", HttpContext.Current.Session["user_id"].ToString())) == "MESSAGES AVAILABLE") { CHAT_MARKER.Visible = true; } else { CHAT_MARKER.Visible = false; } //http://carpool.bplaced.net/Carpool/myCommitment.php?user=5 string text = CarsUtility.PullWebRequest(string.Format("myCommitment.php?user={0}", HttpContext.Current.Session["user_id"])); string[] entrys = text.Split('$'); foreach (string entry_ in entrys) { string entry = entry_.Replace("<br>", ""); if (string.IsNullOrEmpty(entry)) { continue; } string info = entry.Split('§')[0]; Panel entryPanel = new Panel(); entryPanel.CssClass = "panel"; MEINEFAHRTEN_PANEL.Controls.Add(entryPanel); Panel head = new Panel(); head.CssClass = "head"; entryPanel.Controls.Add(head); Panel bot = new Panel(); bot.CssClass = "bot"; entryPanel.Controls.Add(bot); Label Start = new Label(); Start.Text = info.Split('|')[1]; Start.CssClass = "start"; head.Controls.Add(Start); Label End = new Label(); End.Text = info.Split('|')[2]; End.CssClass = "end"; head.Controls.Add(End); Label Time = new Label(); Time.Text = info.Split('|')[3].Substring(0, 16); Time.CssClass = "time"; head.Controls.Add(Time); Button b1 = new Button(); b1.Text = "x"; b1.CssClass = "button"; //b.Click += new EventHandler(RejectSeat); b1.Click += delegate { CarsUtility.PullWebRequest(string.Format("rejectRide.php?id={0}", info.Split('|')[0])); Response.Redirect("MeineFahrten"); }; head.Controls.Add(b1); string[] passengers = entry.Split('§')[1].Split(';'); foreach (string passenger_ in passengers) { string passenger = passenger_.Replace("<br>", ""); if (!string.IsNullOrEmpty(passenger)) { Panel p = new Panel(); p.CssClass = "p"; bot.Controls.Add(p); /*Label id = new Label(); * id.Text = passenger.Split('|')[0]; * p.Controls.Add(id); * * Label userid = new Label(); * userid.Text = passenger.Split('|')[1]; * p.Controls.Add(userid);*/ Label name = new Label(); name.Text = passenger.Split('|')[2]; name.CssClass = "name"; p.Controls.Add(name); Button profileButton = new Button(); profileButton.CssClass = "profileButton"; profileButton.Text = passenger.Split('|')[2]; profileButton.Click += delegate { HttpContext.Current.Session["view_user"] = passenger.Split('|')[1]; Response.Redirect("User"); }; name.Controls.Add(profileButton); /*Label rating = new Label(); * rating.Text = (passenger.Split('|')[4] == "") ? "n. a." : passenger.Split('|')[4]; * p.Controls.Add(rating); * rating.CssClass = "rating";*/ /*Button r = new Button(); * r.Text = "Rate"; * r.CssClass = "button"; * //b.Click += new EventHandler(RejectSeat); * r.Click += delegate * { * CarsUtility.command = "rejectRide"; * CarsUtility.ratingUserID = entry.Split('|')[0]; * CarsUtility.user = entry.Split('|')[1]; * Response.Redirect("Rating"); * * }; * p.Controls.Add(r);*/ Button b = new Button(); b.Text = "x"; b.CssClass = "button2"; //b.Click += new EventHandler(RejectSeat); b.Click += delegate { CarsUtility.PullWebRequest(string.Format("rejectSeat.php?id={0}", passenger.Split('|')[0])); Response.Redirect("MeineFahrten"); }; p.Controls.Add(b); Button c = new Button(); c.Click += delegate { if (passenger.Split('|')[4] == "-1") { HttpContext.Current.Session["reloadchat"] = CarsUtility.PullWebRequest(string.Format("createChat.php?id={0}&user={1}", HttpContext.Current.Session["user_id"], passenger.Split('|')[1])); } else { HttpContext.Current.Session["reloadchat"] = passenger.Split('|')[4]; } Response.Redirect("Chat"); }; c.Text = "Chat"; c.CssClass = "button3"; p.Controls.Add(c); } } } }
protected void FAHERTERSTELLEN_BUTTON_Click(object sender, EventArgs e) { DateTime date; DateTime.TryParse(UHRZEIT_ABFAHRT_CALENDER.Text, out date); string Year = date.Year.ToString(); string Month = date.Month.ToString(); string Day = date.Day.ToString(); string Hour = UHRZEIT_ABFAHRTSZEIT_STUNDE_INPUT.Text.Split(':')[0]; string Minute = UHRZEIT_ABFAHRTSZEIT_STUNDE_INPUT.Text.Split(':')[1]; string Start = TextBox1.Text; string End = ZIELORT_INPUT.Text; string Places = FREIESITZPLÄTZE_INPUT.Text; if (string.IsNullOrEmpty(Year)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wähle ein Jahr aus."; return; } if (string.IsNullOrEmpty(Month)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wähle einen Monat aus."; return; } if (string.IsNullOrEmpty(Day)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wähle einen Tag aus."; return; } if (string.IsNullOrEmpty(Hour)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wähle eine Zeit aus."; return; } if (string.IsNullOrEmpty(Places)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wählen Sie die Anzahl der Sitsplätze aus."; return; } if (string.IsNullOrEmpty(Start)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wählen Sie einen Startort aus."; return; } if (string.IsNullOrEmpty(End)) { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = "Wählen Sie ein Ziel aus."; return; } //offerSeat.php?user=5&count=4&start=Ettenb%C3%BCttel&end=Sassenburg&time=2019-08-09%2000:00:00 string text = CarsUtility.PullWebRequest(string.Format("offerSeat.php?user={0}&count={1}&start={2}&end={3}&time={4}-{5}-{6} {7}:{8}:00", HttpContext.Current.Session["user_id"], Places, Start, End, Year, Month, Day, Hour, Minute)); if (text != "Query successfull") { ERROR_PANEL.Visible = true; ERROR_TEXT.Text = text; return; } Response.Redirect("MeineFahrten"); }