/// <summary> /// Metoda obsługuje dołączenie wolontariuszy do wydarzeń. /// Wywołuje metodę JoinToEvent. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Join_To_Event(object sender, EventArgs e) { db = new SQLDatabase(); db.Connect(); db.JoinToEvent(id_e, db.getId((string)Session["id"])); db.Disconnect(); }
/// <summary> /// A method that displays the invitations the user has received /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Session["id"] != null) { db = new SQLDatabase(); db.Connect(); list_invitations = db.ListInvitations(); html = new StringBuilder(); html.Append("<table border = '1' align='center'>"); html.Append("<tr>"); html.Append("<th>Data wysłania</th><th>Wysłane przez</th><th>Temat</th><th>Zawartość</th>"); html.Append("</tr>"); for (int i = 0; i < list_invitations.Count; i++) { if (list_invitations.ElementAt(i).id_receiver.Equals(db.getId((string)Session["id"]))) { html.Append("<tr>"); html.Append("<td>" + list_invitations.ElementAt(i).post_date + "</td>"); html.Append("<td>" + db.getNickname_id(list_invitations.ElementAt(i).id_sender) + "</td>"); html.Append("<td>" + list_invitations.ElementAt(i).title + "</td>"); html.Append("<td>" + list_invitations.ElementAt(i).content + "</td>"); html.Append("<td><a href=\"Details.aspx?id_e=" + list_invitations.ElementAt(i).id_event + "\">Szczegóły wydarzenia</a></td>"); html.Append("</tr>"); } } html.Append("</table>"); html.Append("<br/><br/>"); PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() }); db.Disconnect(); } }
/// <summary> /// Metoda obsługująca zgłaszanie wolontariusza do wykonania ogłoszenia potrzebującego. Wywołuję /// metodę AssignToAnnouncement, przesyła pobrane informacje z formularza wypełnionego /// przez użytkownika oraz numer wybranego ogłoszenia. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Zglos_Sie(object sender, EventArgs e) { db = new SQLDatabase(); db.Connect(); db.AssignToAnnouncement(id_a, db.getId((string)Session["id"]), from.Text, to.Text); db.Disconnect(); }
/// <summary> /// The method that supports the display of announcements and events that the logged-on user has added and /// the declarations he has declared his help and events he takes part in. /// The method also supports the option of resigning, editing and deleting announcements and events. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { db = new SQLDatabase(); db.Connect(); list_announcements = db.ListAnnouncements(); list_events = db.ListEvents(); dt = db.getMyActivities(db.getId((string)Session["id"])); dt_events = db.getMyActivitiesEvents(db.getId((string)Session["id"])); if (db.getType_User(db.getId((string)Session["id"])) == "volounteer") { display_assigned_announcements(); display_created_events(); display_joined_events(); } display_created_announcements(); db.Disconnect(); }
/// <summary> /// The method is responsible for handling the subsystem of adding advertisements. Retrieves information from the form entered by the user. /// Then it calls the InsertAnnouncement method by sending the previously retrieved information as method parameters. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Add_Announcement(object sender, EventArgs e) { db = new SQLDatabase(); db.Connect(); db.InsertAnnouncement(db.getId((string)Session["id"]), end_date.Value, one.Checked, subject.Value, content.Value); Response.Redirect("MyActivities.aspx"); db.Disconnect(); }
public void display_created_events() { html = new StringBuilder(); html.Append("<table border = '1' align='center'>"); html.Append("<tr>"); html.Append("<th>Data dodania</th><th>Data wydarzenia</th><th>Powiązane z ogłoszeniem potrzebującego</th><th>Temat</th>"); html.Append("</tr>"); for (int i = 0; i < list_events.Count; i++) { if (list_events.ElementAt(i).id_user.Equals(db.getId((string)Session["id"]))) { html.Append("<tr>"); html.Append("<td>" + list_events.ElementAt(i).post_date.ToString("yyyy-MM-dd") + "</td>"); html.Append("<td>" + list_events.ElementAt(i).due_date.ToString("yyyy-MM-dd") + "</td>"); if (list_events.ElementAt(i).id_announcement.Equals(null)) { html.Append("<td>Nie</td>"); } else { html.Append("<td>Tak</td>"); } html.Append("<td>" + list_events.ElementAt(i).title + "</td>"); html.Append("<td>"); html.Append("<a href=\"Modify.aspx?id_e=" + list_events.ElementAt(i).id + "&r=u\">Usuń </a>"); html.Append("<a href=\"EditEvent.aspx?id_e=" + list_events.ElementAt(i).id + "\">Edytuj </a>"); html.Append("<td>"); html.Append("<a href=\"Details.aspx?id_e=" + list_events.ElementAt(i).id + "\">Szczegóły</a>"); html.Append("</td>"); html.Append("</td>"); html.Append("</tr>"); } } html.Append("</table>"); PlaceHolder3.Controls.Add(new Literal { Text = html.ToString() }); }
/// <summary> /// A method that supports the subsystem to invite volunteers to the parish. Invokes the SendInvitation method. /// Parameters that are entered by the user are the subject and contents of the invitation, /// then are sent as parameters of the SendIvitation method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Send_Invitation(object sender, EventArgs e) { db = new SQLDatabase(); db.Connect(); if (Request.QueryString["id_u"] != null) { id_user = int.Parse(Request.QueryString["id_u"]); } if (Request.QueryString["id_e"] != null) { id_event = int.Parse(Request.QueryString["id_e"]); } db.SendInvitation(id_event, db.getId((string)Session["id"]), id_user, title.Value, content.Value); db.Disconnect(); }
/// <summary> /// The method responsible for handling the subsystem of adding events. Retrieves information from the form entered by the user. /// Then it calls the InsertEvents method to send the downloaded values as method parameters. /// The event can also be created on the basis of the announcement, the method checks if the announcement number is sent using QueryString. /// If so, the value of the advertisement number is sent. If number -1 is not sent. /// In the InsertEvents method there is further support for the value of the advertisement number. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Add_Event(object sender, EventArgs e) { SQLDatabase db = new SQLDatabase(); int id_a = -1;; if (Request.QueryString["id_a"] != null) { id_a = int.Parse(Request.QueryString["id_a"]); } db.Connect(); db.InstertEvents(id_a, db.getId((string)Session["id"]), due_date.Value, title.Value, content.Value); db.Disconnect(); Response.Redirect("Events.aspx"); }
/// <summary> /// This method is responsible for getting data from the database, putting them into a StringBuilder and appending them to the Events.aspx page. /// </summary> /// <param name="sender">Parameter containing references to the control that raised the event</param> /// <param name="e">Parameter responsible for storing event data</param> protected void Page_Load(object sender, EventArgs e) { html = new StringBuilder(); db = new SQLDatabase(); db.Connect(); list_events = db.ListEvents(); if (Session["id"] != null) { if (db.getType_User(db.getId((string)Session["id"])) == "volounteer" || db.getType_User(db.getId((string)Session["id"])) == "administrator") { add_event.Visible = true; } } html.Append("<table border = '1' align='center'>"); html.Append("<tr>"); html.Append("<th>Dodane przez</th><th>Data dodania</th><th>Data wydarzenia</th><th>Powiązane z ogłoszeniem potrzebującego</th><th>Temat</th>"); html.Append("</tr>"); for (int i = 0; i < list_events.Count; i++) { html.Append("<tr>"); html.Append("<td>" + db.getNickname_id(list_events.ElementAt(i).id_user) + "</td>"); html.Append("<td>" + list_events.ElementAt(i).post_date.ToString("yyyy-MM-dd") + "</td>"); html.Append("<td>" + list_events.ElementAt(i).due_date.ToString("yyyy-MM-dd") + "</td>"); if (list_events.ElementAt(i).id_announcement.Equals(null)) { html.Append("<td>Nie</td>"); } else { html.Append("<td>Tak</td>"); } html.Append("<td>" + list_events.ElementAt(i).title + "</td>"); html.Append("<td>"); html.Append("<a href=\"Details.aspx?id_e=" + list_events.ElementAt(i).id + "\">Szczegóły</a>"); html.Append("</td>"); html.Append("</tr>"); } html.Append("</table>"); html.Append("<br/><br/>"); PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() }); db.Disconnect(); }
protected void Page_Load(object sender, EventArgs e) { this.countMe(); DataSet tmpDs = new DataSet(); tmpDs.ReadXml(Server.MapPath("~/res/xml/counter.xml")); visitcounter.Text = tmpDs.Tables[0].Rows[0]["hitcounter"].ToString(); //CHECK COOKIES CONSENT if (Request.Cookies["CookieConsent"] != null) { cookieConsent.Visible = false; } if (Session["id"] == null) { login.Visible = true; logout.Visible = false; account.Visible = false; list_users.Visible = false; newsletter.Visible = false; my_activities.Visible = false; invitations.Visible = false; } else { db = new SQLDatabase(); db.Connect(); login.Visible = false; logout.Visible = true; account.Visible = true; reg.Visible = false; list_users.Visible = false; newsletter.Visible = false; my_activities.Visible = true; invitations.Visible = true; hello_user.Text = "Hello " + db.getNickname_email((string)Session["id"]); if (db.getType_User(db.getId((string)Session["id"])).Equals("administrator")) { list_users.Visible = true; newsletter.Visible = true; my_activities.Visible = false; invitations.Visible = false; } db.Disconnect(); } }
protected void Page_Load(object sender, EventArgs e) { db = new SQLDatabase(); html = new StringBuilder(); db.Connect(); list_users = db.ListUsers(); id = db.getId((string)Session["id"]); html.Append("<table border = '1' align='center'>"); for (int i = 0; i < list_users.Count; i++) { if (list_users.ElementAt(i).id.Equals(id)) { html.Append("<tr><td>Id</td> <td>" + list_users.ElementAt(i).id + "</td></tr>"); html.Append("<tr><td>Imię</td> <td>" + list_users.ElementAt(i).name + "</td></tr>"); html.Append("<tr><td>Nazwisko</td> <td>" + list_users.ElementAt(i).surname + "</td></tr>"); html.Append("<tr><td>Nickname</td> <td>" + list_users.ElementAt(i).nickname + "</td></tr>"); html.Append("<tr><td>E-mail</td> <td>" + list_users.ElementAt(i).email + "</td></tr>"); html.Append("<tr><td>Płeć</td> <td>" + list_users.ElementAt(i).sex + "</td></tr>"); html.Append("<tr><td>Telefon</td> <td>" + list_users.ElementAt(i).telephone + "</td></tr>"); html.Append("<tr><td>Data urodzenia</td> <td>" + list_users.ElementAt(i).birth_date.ToString("yyyy-MM-dd") + "</td></tr>"); html.Append("<tr><td>Typ użytkownika</td> <td>" + list_users.ElementAt(i).type + "</td></tr>"); html.Append("<tr><td>Pesel</td> <td>" + list_users.ElementAt(i).pesel + "</td></tr>"); email = list_users.ElementAt(i).email; pass = list_users.ElementAt(i).password; id_i = i; } } html.Append("</table>"); html.Append("<br/><br/>"); PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() }); db.Disconnect(); }
/// <summary> /// The method that supports the possibility of resignation from the performance of the announcement /// or from taking part in the event. /// It also supports deleting announcements or events that the logged-in user has created. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { db = new SQLDatabase(); db.Connect(); if (Request.QueryString["id_a"] != null) { id_a = int.Parse(Request.QueryString["id_a"]); } if (Request.QueryString["id_e"] != null) { id_e = int.Parse(Request.QueryString["id_e"]); } if (Request.QueryString["id_u"] != null) { id_u = int.Parse(Request.QueryString["id_u"]); } opcja = 0; if (Request.QueryString["r"] != null) { if (Request.QueryString["r"].Equals("z")) { opcja = 1; } if (Request.QueryString["r"].Equals("u")) { opcja = 2; } } if (opcja == 1) { if (Request.QueryString["id_a"] != null) { db.DeclineFromAnnouncement(id_a, db.getId((string)Session["id"])); } if (Request.QueryString["id_e"] != null) { db.DeclineFromEvent(id_e, db.getId((string)Session["id"])); } Response.Redirect("MyActivities.aspx"); } if (opcja == 2) { if (Request.QueryString["id_e"] != null) { if (Request.QueryString["id_u"] != null) { Send_Email(db.getEmail(id_u), db.getNickname_id(id_u), true, db.getTitleEvent(id_e)); } db.Delete_Users_Joined_Event(id_e); db.DeleteInvitation(id_e); db.DeleteEvent(id_e); } if (Request.QueryString["id_a"] != null) { if (Request.QueryString["id_u"] != null) { Send_Email(db.getEmail(id_u), db.getNickname_id(id_u), false, db.getTitleAnnouncement(id_a)); } List <int?> list_events_id = db.getIdEvents(id_a); for (int i = 0; i < list_events_id.Count; i++) { db.Delete_Users_Joined_Event((int)list_events_id.ElementAt(i)); db.DeleteInvitation((int)list_events_id.ElementAt(i)); } db.DeleteEvent_id_a(id_a); db.Delete_Users_Assigned_Announcement(id_a); db.DeleteAnnouncement(id_a); } if (Request.QueryString["id_u"] == null) { Response.Redirect("MyActivities.aspx"); } } db.Disconnect(); }
/// <summary> /// The method responsible for displaying the details of the selected event or announcement. /// The number of the selected advertisement or event is sent using QueryString. /// The method also displays an advertisement based on which the event was created (but it did not have to) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { typ = ""; if (Request.QueryString["id_a"] != null) { id_a = int.Parse(Request.QueryString["id_a"]); } if (Request.QueryString["id_e"] != null) { id_e = int.Parse(Request.QueryString["id_e"]); } wielorazowe = false; db = new SQLDatabase(); db.Connect(); list_announcements = db.ListAnnouncements(); list_events = db.ListEvents(); html = new StringBuilder(); if (Request.QueryString["id_a"] != null) { html.Append("<table border = '1' align='center'>"); html.Append("<tr>"); html.Append("<th>Dodane przez</th><th>Nickname</th><th>Data dodania</th><th>Do kiedy</th><th>Typ pomocy</th><th>Status</th><th>Temat</th><th>Zawartość</th>"); html.Append("</tr>"); for (int i = 0; i < list_announcements.Count; i++) { if (id_a == list_announcements.ElementAt(i).id) { typ = db.getType_User(list_announcements.ElementAt(i).id_user); html.Append("<tr>"); html.Append("<td>" + typ + "</td>"); html.Append("<td>" + db.getNickname_id(list_announcements.ElementAt(i).id_user) + "</td>"); html.Append("<td>" + list_announcements.ElementAt(i).post_date.ToString("yyyy-MM-dd") + "</td>"); html.Append("<td>"); if (list_announcements.ElementAt(i).type_help.Equals("Jednorazowa")) { html.Append("---"); } else { wielorazowe = true; html.Append(list_announcements.ElementAt(i).end_date); } html.Append("</td>"); html.Append("<td>" + list_announcements.ElementAt(i).type_help + "</td>"); html.Append("<td>" + list_announcements.ElementAt(i).current_status + "</td>"); html.Append("<td>" + list_announcements.ElementAt(i).title + "</td>"); html.Append("<td>" + list_announcements.ElementAt(i).content + "</td>"); if (db.getType_User(db.getId((string)Session["id"])).Equals("administrator")) { html.Append("<td><a href=\"Modify.aspx?id_a=" + list_announcements.ElementAt(i).id + "&id_u=" + list_announcements.ElementAt(i).id_user + "&r=u" + "\">Usuń</a></td>"); } html.Append("</tr>"); } } html.Append("</table>"); html.Append("<br/><br/>"); } if (Session["id"] != null && Request.QueryString["id_a"] != null) { if (db.getType_User(db.getId((string)Session["id"])) == "volounteer" && typ == "needy") { zglos.Visible = true; html.Append("Zgłoś się do pomocy!"); if (wielorazowe) { html.Append("Potrzebna jest pomoc przez kilka dni, określ godziny, które Ci pasują: "); from.Visible = true; to.Visible = true; } html.Append("Możesz również utworzyć wydarzenie dla tego ogłoszenia: "); create.Visible = true; } } if (Request.QueryString["id_e"] != null) { for (int i = 0; i < list_events.Count; i++) { if (id_e == list_events.ElementAt(i).id) { html.Append("</br>Szczegóły wydarzenia: </br>"); html.Append("<table border = '1' align='center'>"); html.Append("<tr>"); html.Append("<th>Utworzone przez</th><th>Data dodania</th><th>Data wydarzenia</th><th>Powiązanie z ogłoszeniem</th><th>Temat</th><th>Zawartość</th>"); html.Append("</tr>"); typ = db.getType_User(list_events.ElementAt(i).id_user); html.Append("<tr>"); html.Append("<td>" + db.getNickname_id(list_events.ElementAt(i).id_user) + "</td>"); html.Append("<td>" + list_events.ElementAt(i).post_date.ToString("yyyy-MM-dd") + "</td>"); html.Append("<td>" + list_events.ElementAt(i).due_date.ToString("yyyy-MM-dd") + "</td>"); if (list_events.ElementAt(i).id_announcement.Equals(null)) { html.Append("<td>Nie</td>"); } else { html.Append("<td>Tak</td>"); } html.Append("<td>" + list_events.ElementAt(i).title + "</td>"); html.Append("<td>" + list_events.ElementAt(i).content + "</td>"); if (db.getType_User(db.getId((string)Session["id"])).Equals("administrator")) { html.Append("<td><a href=\"Modify.aspx?id_e=" + list_events.ElementAt(i).id + "&id_u=" + list_events.ElementAt(i).id_user + "&r=u" + "\">Usuń</a></td>"); } html.Append("</tr>"); html.Append("</table>"); html.Append("<br/><br/>"); if (!list_events.ElementAt(i).id_announcement.Equals(null)) { int id_anno = db.getIdAnnouncement((int)list_events.ElementAt(i).id_announcement); html.Append("</br>Ogłoszenie, do którego zostało utworzone powyższe wydarzenie: </br>"); html.Append("<table border = '1'>"); html.Append("<tr>"); html.Append("<th>Utworzone przez</th><th>Data dodania</th><th>Do kiedy</th><th>Typ pomocy</th><th>Status</th><th>Temat</th><th>Zawartość</th>"); html.Append("</tr>"); html.Append("<tr>"); html.Append("<td>" + db.getNickname_id(list_announcements.ElementAt(id_anno).id_user) + "</td>"); html.Append("<td>" + list_announcements.ElementAt(id_anno).post_date.ToString("yyyy-MM-dd") + "</td>"); html.Append("<td>"); if (list_announcements.ElementAt(id_anno).type_help.Equals("Jednorazowa")) { html.Append("---"); } else { html.Append(list_announcements.ElementAt(id_anno).end_date); } html.Append("</td>"); html.Append("<td>" + list_announcements.ElementAt(id_anno).type_help + "</td>"); html.Append("<td>" + list_announcements.ElementAt(id_anno).current_status + "</td>"); html.Append("<td>" + list_announcements.ElementAt(id_anno).title + "</td>"); html.Append("<td>" + list_announcements.ElementAt(id_anno).content + "</td>"); html.Append("</tr>"); html.Append("</table>"); } } } } if (Session["id"] != null && Request.QueryString["id_e"] != null) { if (db.getType_User(db.getId((string)Session["id"])) == "volounteer") { html.Append("Możesz dołączyć do wydarzenia:"); join.Visible = true; html.Append("Możesz zaprosić innego wolontariusza do wzięcia udziału w tym wydarzeniu:"); select.Visible = true; } } PlaceHolder.Controls.Add(new Literal { Text = html.ToString() }); db.Disconnect(); }