protected void MARKER_UPDATE_Tick(object sender, EventArgs e) { if (MarkerActive() == false && CarsUtility.PullWebRequest(string.Format("CheckChatUpdates.php?id={0}", HttpContext.Current.Session["user_id"])) == "MESSAGES AVAILABLE") { ReloadPage(); } }
public Chat_Info(string chat) { chat_id = chat.Split('|')[0]; chat_name = chat.Split('|')[1]; chat_createdat = chat.Split('|')[2]; last_update = chat.Split('|')[3]; unreadmessages = chat.Split('|')[4]; if (chat_name == "") { string users_string = CarsUtility.PullWebRequest(string.Format("viewChatUser.php?id={0}", chat_id)).Replace("<br>", ""); chat_name = ""; foreach (string user in users_string.Split(';')) { if (string.IsNullOrWhiteSpace(user)) { continue; } Chat_User userObj = new Chat_User(user); if (userObj.chat_user_id.ToString() != HttpContext.Current.Session["user_id"].ToString()) { chat_name += userObj.chat_user_name + " "; } users.Add(userObj); } } }
protected void SEND_Click(object sender, EventArgs e) { string id = HttpContext.Current.Session["ratingUserID"].ToString(); CarsUtility.PullWebRequest(string.Format("rateUser.php?user={0}&author={1}&rating={2}&text={3}", HttpContext.Current.Session["user"].ToString(), HttpContext.Current.Session["user_id"], HttpContext.Current.Session["rating"].ToString(), COMMENT.Text)); CarsUtility.PullWebRequest(string.Format(HttpContext.Current.Session["command"].ToString() + ".php?id={0}", id)); Response.Redirect("Hauptmenü"); //Send Feedback }
protected void Send_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(Message_IF.Text)) { CarsUtility.PullWebRequest(string.Format("sendMessage.php?text={0}&author={1}&chat={2}", Message_IF.Text, HttpContext.Current.Session["user_id"], HttpContext.Current.Session["chat_id"])); } Message_IF.Text = ""; ShowChat(HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info); Message_IF.Text = ""; }
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 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; } if (HttpContext.Current.Session["view_user"].ToString() != "") { FORM_PANEL.Visible = false; } else { FORM_PANEL.Visible = true; } string text = CarsUtility.PullWebRequest(string.Format("viewUser.php?id={0}", (HttpContext.Current.Session["view_user"].ToString() == "") ? HttpContext.Current.Session["user_id"].ToString() : HttpContext.Current.Session["view_user"].ToString())); if (text == "NO DATA AVAILABLE") { //http://carpool.bplaced.net/Carpool/uploadImages.php Username_Text.Text = "Noch keine Rezensionen vorhanden"; Panel[] rateButtons_ = new Panel[] { RATE1_Full, RATE2_Full, RATE3_Full, RATE4_Full, RATE5_Full }; //RATE5_Full.Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", rating)); for (int i = 0; i < 5; i++) { rateButtons_[i].Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", 100)); } return; } HttpContext.Current.Session["view_user"] = ""; string[] entrys = text.Split('$'); string user = entrys[0]; Username_Text.Text = user.Split('|')[2]; float rating = float.Parse(user.Split('|')[0].Replace(',', '.'), CultureInfo.InvariantCulture); //rating = (float)Math.Round(rating); System.Diagnostics.Debug.WriteLine(rating); Panel[] rateButtons = new Panel[] { RATE1_Full, RATE2_Full, RATE3_Full, RATE4_Full, RATE5_Full }; //RATE5_Full.Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", rating)); for (int i = 0; i < 5; i++) { if (i == Math.Floor(rating)) { rateButtons[i].Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", ((1 - (rating % 1f)) * 100f).ToString().Replace(',', '.'))); } else { if (i < rating) { rateButtons[i].Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", 0)); } else { rateButtons[i].Attributes.Add("style", string.Format("clip-path:inset(0px {0}% 0px 0px);", 100)); } } } //RATE1_Full.CssClass = "RATING_STAR active"; //RATE2.CssClass = (rating > 1) ? "RATING_STAR active" : "RATING_STAR"; //RATE3.CssClass = (rating > 2) ? "RATING_STAR active" : "RATING_STAR"; //RATE4.CssClass = (rating > 3) ? "RATING_STAR active" : "RATING_STAR"; //RATE5.CssClass = (rating > 4) ? "RATING_STAR active" : "RATING_STAR"; foreach (string entry_ in entrys[1].Split(';')) { string entry = entry_.Replace("<br>", ""); if (string.IsNullOrEmpty(entry)) { continue; } Panel review = new Panel(); review.CssClass = "review_Panel"; Rating_Panel.Controls.Add(review); Panel starPanel = new Panel(); starPanel.CssClass = "Star_Panel"; review.Controls.Add(starPanel); for (int i = 0; i < 5; i++) { Panel img = new Panel(); img.CssClass = (i < int.Parse(entry.Split('|')[1]))?"Star full":"Star"; starPanel.Controls.Add(img); } Label username = new Label(); username.Text = entry.Split('|')[4]; username.CssClass = "review_Name"; review.Controls.Add(username); Label reviewText = new Label(); reviewText.Text = entry.Split('|')[2]; reviewText.CssClass = "review_Text"; review.Controls.Add(reviewText); } }
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; } string text = CarsUtility.PullWebRequest(string.Format("mySeats.php?user={0}", HttpContext.Current.Session["user_id"])); string[] entrys = text.Split(';'); bool rate = false; bool pending = false; foreach (string entry_ in entrys) { string entry = entry_.Replace("<br>", ""); if (string.IsNullOrEmpty(entry)) { continue; } if (DateTime.Now > DateTime.Parse(entry.Split('|')[6])) { if (!rate) { //Rate Label rate = true; Label RateLabel = new Label(); RateLabel.Text = "Bewerte diese Fahrten:"; RateLabel.CssClass = "Big_Label"; MEINEMITFAHRTEN_PANEL.Controls.Add(RateLabel); } Panel entryPanel = new Panel(); entryPanel.CssClass = "Panel"; MEINEMITFAHRTEN_PANEL.Controls.Add(entryPanel); Button b = new Button(); b.Text = "Bewerten"; b.CssClass = "button"; //b.Click += new EventHandler(RejectSeat); b.Click += delegate { HttpContext.Current.Session["command"] = "rejectSeat"; HttpContext.Current.Session["ratingUserID"] = entry.Split('|')[0]; HttpContext.Current.Session["user"] = entry.Split('|')[2]; Response.Redirect("Rating"); }; entryPanel.Controls.Add(b); Button c = new Button(); c.Click += delegate { if (entry.Split('|')[8] == "-1") { HttpContext.Current.Session["reloadchat"] = CarsUtility.PullWebRequest(string.Format("createChat.php?id={0}&user={1}", HttpContext.Current.Session["user_id"], entry.Split('|')[8])); } else { HttpContext.Current.Session["reloadchat"] = entry.Split('|')[8]; } Response.Redirect("Chat"); }; c.Text = "Chat"; c.CssClass = "button"; entryPanel.Controls.Add(c); Label Start = new Label(); Start.Text = entry.Split('|')[4]; Start.CssClass = "Start_Label"; entryPanel.Controls.Add(Start); Label End = new Label(); End.Text = entry.Split('|')[5]; End.CssClass = "End_Label"; entryPanel.Controls.Add(End); Label Time = new Label(); Time.Text = entry.Split('|')[6].Substring(0, 16); Time.CssClass = "Time_Label"; entryPanel.Controls.Add(Time); Label UserName = new Label(); UserName.Text = entry.Split('|')[7]; UserName.CssClass = "UserName_Label"; entryPanel.Controls.Add(UserName); Button profileButton = new Button(); profileButton.CssClass = "profileButton"; profileButton.Text = entry.Split('|')[7]; profileButton.Click += delegate { HttpContext.Current.Session["view_user"] = entry.Split('|')[2]; Response.Redirect("User"); }; UserName.Controls.Add(profileButton); } else { if (!pending) { //Rate Label pending = true; Label RateLabel = new Label(); RateLabel.Text = "Die nächsten Fahrten:"; RateLabel.CssClass = "Big_Label"; MEINEMITFAHRTEN_PANEL.Controls.Add(RateLabel); } Panel entryPanel = new Panel(); entryPanel.CssClass = "Panel"; MEINEMITFAHRTEN_PANEL.Controls.Add(entryPanel); Button b = new Button(); b.Text = "x"; b.CssClass = "button"; //b.Click += new EventHandler(RejectSeat); b.Click += delegate { CarsUtility.PullWebRequest(string.Format("rejectSeat.php?id={0}", entry.Split('|')[0])); Response.Redirect("MeineMitfahrten"); }; entryPanel.Controls.Add(b); Label Start = new Label(); Start.Text = entry.Split('|')[4]; Start.CssClass = "Start_Label"; entryPanel.Controls.Add(Start); Label End = new Label(); End.Text = entry.Split('|')[5]; End.CssClass = "End_Label"; entryPanel.Controls.Add(End); Label Time = new Label(); Time.Text = entry.Split('|')[6].Substring(0, 16); Time.CssClass = "Time_Label"; entryPanel.Controls.Add(Time); Label UserName = new Label(); UserName.Text = entry.Split('|')[7]; UserName.CssClass = "UserName_Label"; entryPanel.Controls.Add(UserName); Button profileButton = new Button(); profileButton.CssClass = "profileButton"; profileButton.Text = entry.Split('|')[7]; profileButton.Click += delegate { HttpContext.Current.Session["view_user"] = entry.Split('|')[2]; Response.Redirect("User"); }; UserName.Controls.Add(profileButton); } } }
public void ShowChat(Chat_Info c) { System.Timers.Timer t = new System.Timers.Timer(); t.Interval = 5000; t.Elapsed += delegate { string last_change = CarsUtility.PullWebRequest(string.Format("lastChatupdate.php?id={0}", c.chat_id)).Replace("<br>", ""); if ((HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info).last_update != last_change) { HttpContext.Current.Session["reloadchat"] = (HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info).chat_id; ShowChat(HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info); } }; t.Enabled = false; string chat_history = CarsUtility.PullWebRequest(string.Format("viewChat.php?id={0}&user={1}", (HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info).chat_id, HttpContext.Current.Session["user_id"])).Replace("<br>", ""); System.Diagnostics.Debug.WriteLine(chat_history); (HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info).history.Clear(); System.Diagnostics.Debug.WriteLine("history cleared"); foreach (string message in chat_history.Split(';')) { if (string.IsNullOrWhiteSpace(message)) { continue; } (HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info).history.Add(new Chat_Info.Message(message)); } DateTime lastMessage = DateTime.MinValue; foreach (Chat_Info.Message m in (HttpContext.Current.Session["currentCI"] as CARS.Website.Chat.Chat_Info).history) { DateTime messageTime = DateTime.Parse(m.time); if (messageTime.Date != lastMessage.Date) { lastMessage = messageTime; Panel date = new Panel(); date.CssClass = "Date"; History.Controls.Add(date); Label d = new Label(); d.CssClass = "DateLabel"; //Weniger als 5 Tage if (new TimeSpan(DateTime.Now.Ticks - messageTime.Ticks).Days < 5) { string[] days = new string[] { "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" }; d.Text = days[((int)messageTime.DayOfWeek)]; } else { string[] months = new string[] { "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" }; string a = "0" + messageTime.Date.Day; string b = "0" + messageTime.Date.Month; d.Text = a.Substring(a.Length - 3, 2) + ". " + months[messageTime.Date.Month - 1]; } date.Controls.Add(d); } System.Diagnostics.Debug.WriteLine("instance message : " + m.message); Panel message = new Panel(); message.CssClass = "msg_panel " + ((m.user_id == HttpContext.Current.Session["user_id"].ToString()) ? "me" : "somebody"); History.Controls.Add(message); Label time = new Label(); time.CssClass = "TimeLabel"; time.Text = m.time.Substring(10, 6); message.Controls.Add(time); Label user = new Label(); user.CssClass = "UserLabel"; user.Text = c.GetUserName(m.user_id); message.Controls.Add(user); Label message_text = new Label(); message_text.CssClass = "MessageLabel"; message_text.Text = m.message; message.Controls.Add(message_text); } }
protected void Page_Load(object sender, EventArgs e) { Username_Label.Text = HttpContext.Current.Session["user_name"].ToString(); string chats = CarsUtility.PullWebRequest(string.Format("viewChats.php?id={0}", HttpContext.Current.Session["user_id"])); chats = chats.Replace("<br>", ""); info.Clear(); foreach (string chat in chats.Split(';')) { if (string.IsNullOrEmpty(chat)) { continue; } info.Add(new Chat_Info(chat)); } foreach (Chat_Info ci in info) { Panel chat_list_panel = new Panel(); chat_list_panel.CssClass = "chatoption_con"; List.Controls.Add(chat_list_panel); Button chatoption = new Button(); chatoption.Text = (ci.unreadmessages != "0")? "(" + ci.unreadmessages + ") " + ci.chat_name : ci.chat_name; chatoption.CssClass += " chatoption"; chatoption.Click += delegate { HttpContext.Current.Session["chat_id"] = ci.chat_id; HttpContext.Current.Session["currentCI"] = ci; foreach (Panel p in List.Controls) { Button b = p.Controls[0] as Button; b.CssClass = b.CssClass.Replace("active_chat", ""); } chatoption.CssClass += " active_chat"; ShowChat(ci); }; if (HttpContext.Current.Session["reloadchat"].ToString() == ci.chat_id) { chatoption.CssClass += " active_chat"; HttpContext.Current.Session["reloadchat"] = ""; HttpContext.Current.Session["chat_id"] = ci.chat_id; HttpContext.Current.Session["currentCI"] = ci; ShowChat(ci); } chat_list_panel.Controls.Add(chatoption); } }