protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { if (!IsPostBack) { ListBox1.Items.Clear(); ListBox2.Items.Clear(); ListBox3.Items.Clear(); ListBox1.Width = 100; ListBox1.Height = 60; ListBox2.Width = 150; ListBox3.Width = 150; user = new User_Class(); user = user.getUser(userCookie.Value); user.getFriends(); int i = 0; ListItem l = new ListItem(); while (i < user.Friends.Count) { l = new ListItem(); l.Text = user.Friends[i].Nick; l.Value = i.ToString(); ListBox2.Items.Add(l); i++; } ListItem o = new ListItem("Public", "0"); ListItem p = new ListItem("Private", "1"); ListBox1.Items.Add(o); ListBox1.Items.Add(p); } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { Image1.ImageUrl = usuario_sesion.Image_url; Label1.Text = usuario_sesion.Nick; Label2.Text = usuario_sesion.Name; Label3.Text = usuario_sesion.Surname; Label4.Text = usuario_sesion.Email; Label5.Text = usuario_sesion.Gender.ToString(); Label6.Text = usuario_sesion.Entry_date; Label7.Text = usuario_sesion.Birth_date; } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { CompareValidator pass = new CompareValidator(); pass.ID = "CorrectPasswordCompare"; pass.ValueToCompare = usuario_sesion.Pass; pass.ControlToValidate = "CurrentPassword"; pass.CssClass = "failureNotification"; pass.ErrorMessage = "*</br>The passwords is not correct."; CurrentPasswordRequired.Controls.Add(pass); } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { usuario_sesion.deleteFriend(int.Parse(Request.QueryString["id"])); Response.Redirect("../Asp_forms/Friends.aspx"); } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void newEvent(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); myUser.getFriends(); Events_Class events = new Events_Class(); //events.Date = TextBoxDate.Text; //TextBoxDate.Text = "disabled"; events.Date = Calendar1.SelectedDate.ToString(); events.Location = TextBoxLocation.Text; events.Description = TextBoxDescription.Text; int indice = 0; events.Users.Add(myUser); foreach (ListItem li in ListBox2.Items) { indice = Int32.Parse(li.Value); events.Users.Add(myUser.Friends[indice]); } events.addEvent(); Response.Redirect("Events.aspx", true); }
protected void Page_Load(object sender, EventArgs e) { //When the page reloads keeps the cursor on the same position Page.MaintainScrollPositionOnPostBack = true; HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { if (!IsPostBack) { User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); Events_Class events = new Events_Class(); myUser.getFriends(); ListBox1.Items.Clear(); ListBox1.Width = 100; ListBox2.Width = 100; int i = 0; ListItem l = new ListItem(); while (i < myUser.Friends.Count) { l = new ListItem(); l.Text = myUser.Friends[i].Name; l.Value = i.ToString(); ListBox1.Items.Add(l); i++; } } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { Panel p = new Panel(); Panel psub = new Panel(); Label t = new Label(); Label a = new Label(); Note_CAD notaTemp = new Note_CAD(); List<Note_Class> notes = new List<Note_Class>(); User_Class user = new User_Class(); notes = notaTemp.notesOpen(); int i = notes.Count() - 1; int j = i-12; while (i >= 0 && i > j) { p = new Panel(); t = new Label(); a = new Label(); psub = new Panel(); string id = notes[i].Id.ToString(); psub.CssClass = "default_panel"; psub.HorizontalAlign = HorizontalAlign.Right; p.ID = "p" + id; p.CssClass = "postitnotes"; t.ID = "t" + id; a.Text = "a" + id; t.Text = notes[i].Text.ToString() + "<BR>"; a.Text = user.getUser(notes[i].Author).Nick; a.CssClass = "noteauthor"; psub.Controls.Add(a); p.Controls.Add(t); p.Controls.Add(psub); Panel1.Controls.Add(p); i--; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { List<Category_Class> lista = new List<Category_Class>(); Category_Class category = new Category_Class(); if (Request.QueryString["cadena"] != null) lista = filterCategories(Request.QueryString["cadena"], category.Categories()); else lista = category.Categories(); if (lista.Count() == 0) { Label label = new Label(); label.ID = "LabelX"; label.Text = "<h2> No categories found! </h2>"; Panel2.Controls.Add(label); } for (int j = 0; j < lista.Count(); j++) { Panel2.Controls.Add(createNotesButton(lista.ElementAt(j).Id, lista.ElementAt(j).Nombre)); } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { String s; s = Request.QueryString["ID"]; if (s != null) { int id = Int32.Parse(s); Note_Class note = new Note_Class(); note.Id = id; if (note.deleteNote()) Response.Redirect("..//Asp_forms/Notes.aspx"); else { Label l = new Label(); l.Text = "An error has occurred, please try again later."; Panel1.Controls.Add(l); } } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; if (userCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { Party_Class party = new Party_Class(); List<Party_Class> partyList = new List<Party_Class>(); User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); partyList = party.userGroups(myUser.Id); HyperLink link = new HyperLink(); Panel p = new Panel(); int i = partyList.Count() - 1; while(i>=0) { string id = partyList[i].Id.ToString(); link = new HyperLink(); link.CssClass = "button white"; link.Width=300; link.Height = 30; p = new Panel(); link.ID = "link" + id; p.ID = "panel" + id; link.Text = partyList[i].Name; link.NavigateUrl = "~/Asp_forms/Groups_Notes.aspx?ID=" + id; p.Controls.Add(link); Panel2.Controls.Add(p); i--; } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { String s; s = Request.QueryString["ID"]; if (s != null) { int id = Int32.Parse(s); User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); Events_Class events = new Events_Class(); events = events.getEvent(id); events.addUser(myUser); Label1.Text = events.ToString(); Response.Redirect("..//Asp_forms/Events.aspx"); } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Change_Pass(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); usuario_sesion.Pass = NewPassword.Text; usuario_sesion.changePass(NewPassword.Text); passCookie.Expires = DateTime.Now.AddMonths(-1); Response.Cookies.Add(userCookie); passCookie.Value = NewPassword.Text; passCookie.Expires = DateTime.Now.AddMonths(1); Response.Cookies.Add(passCookie); Response.Redirect("./ChangePasswordSuccess.aspx"); }
protected void Search(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); Events_Class events = new Events_Class(); List<Events_Class> eventsList = new List<Events_Class>(); eventsList = events.searchEvents(TextBox1.Text, myUser.Id); int totalEvents = eventsList.Count(); int counter = 0; Panel p = new Panel(); Label t = new Label(); HyperLink le = new HyperLink(); while (counter < totalEvents) { string id = eventsList[counter].Id.ToString(); p = new Panel(); t = new Label(); le = new HyperLink(); p.ID = "panel" + id; t.ID = "t" + id; le.ID = "le" + id; t.Text = eventsList[counter].ToString()+ "<BR>"; le.Text = "ADD"; le.NavigateUrl = "~/Asp_forms/AddToEvents.aspx?ID=" + eventsList[counter].Id; p.Controls.Add(t); p.Controls.Add(le); Panel2.Controls.Add(p); counter++; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { if (!usuario_sesion.isFriend(int.Parse(Request.QueryString["id"]))) { Response.Redirect("../Asp_forms/Friends.aspx?all=yes"); } User_Class usuario_friend = new User_Class(); usuario_friend = usuario_friend.getUser(int.Parse(Request.QueryString["id"])); Image1.ImageUrl = usuario_friend.Image_url; Label1.Text = usuario_friend.Nick; Label2.Text = usuario_friend.Name; Label3.Text = usuario_friend.Surname; Label4.Text = usuario_friend.Email; Label5.Text = usuario_friend.Gender.ToString(); Label6.Text = usuario_friend.Entry_date; Label7.Text = usuario_friend.Birth_date; } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { String s; s = Request.QueryString["ID"]; if (s != null) { int id = Int32.Parse(s); note.Id = id; note = note.getNote(id); Label2.Text = note.Text; } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; if (userCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { if (!IsPostBack) { ListBox1.Items.Clear(); ListBox1.Width = 150; ListBox1.Height = 200; ListBox2.Width = 150; ListBox2.Height = 200; user = new User_Class(); user = user.getUser(userCookie.Value); user.getFriends(); int i = 0; ListItem l = new ListItem(); while (i < user.Friends.Count) { l = new ListItem(); l.Text = user.Friends[i].Nick; l.Value = i.ToString(); ListBox1.Items.Add(l); i++; } } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { if (usuario_sesion.addFriend(int.Parse(Request.QueryString["id"]))) { LabelHecho.Text = "<h2> User Added </h2>"; System.Threading.Thread.Sleep(5000); Response.Redirect("../Asp_forms/Friends.aspx"); } else { LabelHecho.Text = "<h2> Fail Adding User </h2>"; System.Threading.Thread.Sleep(5000); Response.Redirect("../Asp_forms/Friends.aspx"); } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void ChangeData(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (Email.Text != "") usuario_sesion.Email = Email.Text; if (Name.Text != "") usuario_sesion.Name = Name.Text; if (Surname.Text != "") usuario_sesion.Surname = Surname.Text; if (RadioButtonList1.Items[0].Selected) usuario_sesion.Gender = 'F'; else if(RadioButtonList1.Items[1].Selected) usuario_sesion.Gender = 'M'; if (ImageUrl.Text != "") usuario_sesion.Image_url = ImageUrl.Text; userCookie = new HttpCookie("UserID", usuario_sesion.Nick); userCookie.Expires = DateTime.Now.AddMonths(1); Response.Cookies.Add(userCookie); if(usuario_sesion.updateUser()) Label1.Text = "Done!"; }
protected void Create_Note(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; if (userCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { string s = Request.QueryString["ID"]; if (s != null) { Party_Class party = new Party_Class(); party.Id = Int32.Parse(s); User_Class user = new User_Class(); user = user.getUser(userCookie.Value); Note_Class note = new Note_Class(); note.Text = DescripcionNota.Text; note.Date = DateTime.Now.ToShortDateString(); if (party.addNote(note, user.Id)) { Page.MaintainScrollPositionOnPostBack = true; Response.Redirect("~/Asp_forms/Groups_Notes.aspx?ID=" + party.Id); } else Label2.Text = "An error has occurred"; } } /* Create note with the button 'New Note' */ }
protected void SendGroup(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; user = new User_Class(); user = user.getUser(userCookie.Value); user.getFriends(); Party_Class newParty = new Party_Class(); newParty.Name = TextBox1.Text; Label3.Text = ListBox2.Items.Count.ToString(); int indice=0; newParty.Users.Add(user); foreach (ListItem li in ListBox2.Items) { indice = Int32.Parse(li.Value); newParty.Users.Add(user.Friends[indice]); } if (ListBox2.Items.Count == 0 || TextBox1.Text == "") { Label3.Text = "Add users and set Name."; } else { if (newParty.createParty()) Response.Redirect("..//Asp_forms/Groups.aspx"); else Label3.Text = "error"; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { } else { User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); if (myUser.Pass == passCookie.Value) { Label1.Text = "Welcome " + myUser.Nick; UserLabel.Visible = false; UserName.Visible = false; PasswordLabel.Visible = false; Password.Visible = false; Button1.Visible = false; Button3.Visible = false; Button2.Visible = true; } else { Response.Redirect("../Account/Login.aspx"); } } if (!IsPostBack) { if (ViewState["RefUrl"] != null) ViewState["RefUrl"] = Request.UrlReferrer.ToString(); } }
protected void Login_Click(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie != null || passCookie != null) { if (userCookie != null) { userCookie.Expires = DateTime.Now.AddMonths(-1); Response.Cookies.Add(userCookie); } else { passCookie.Expires = DateTime.Now.AddMonths(-1); Response.Cookies.Add(passCookie); } } else { ViewState["RefUrl"] = "..//Default.aspx"; } User_Class myUser = new User_Class(); User_Class myUser2 = new User_Class(); myUser.Nick = UserName.Text; myUser.Pass = Password.Text; object refUrl = ViewState["RefUrl"]; if (myUser.existeUsuario(myUser.Nick)) { myUser2 = myUser.getUser(myUser.Nick); if (myUser.Pass == myUser2.Pass) { userCookie = new HttpCookie("UserID", myUser.Nick); passCookie = new HttpCookie("UserPass", myUser.Pass); userCookie.Expires = DateTime.Now.AddMonths(1); passCookie.Expires = DateTime.Now.AddMonths(1); Response.Cookies.Add(userCookie); Response.Cookies.Add(passCookie); if (refUrl != null) { Response.Redirect((string)refUrl); } } else { Label1.Text = "Contraseña incorrecta"; } } else { Label1.Text = "No existe el usuario"; } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { Panel p = new Panel(); Label t = new Label(); Label f = new Label(); Image ie = new Image(); ie.ImageUrl = "../Images/editButton.png"; ImageButton imgbuttone = new ImageButton(); ImageButton imgbuttonb = new ImageButton(); User_Class userNote = new User_Class(); Label a = new Label(); Panel psub = new Panel(); Note_CAD notaTemp = new Note_CAD(); List<Note_Class> notes = new List<Note_Class>(); User_Class userTemp = new User_Class(); userTemp = userTemp.getUser(userCookie.Value); notes = notaTemp.notesUser(userTemp.Id); int i = notes.Count() - 1; while (i >= 0) { p = new Panel(); psub = new Panel(); t = new Label(); f = new Label(); a = new Label(); userNote = new User_Class(); imgbuttone = new ImageButton(); imgbuttonb = new ImageButton(); imgbuttone.ImageUrl = "../Images/editButton.png"; imgbuttone.PostBackUrl = "~/Asp_forms/Editnotes.aspx?ID=" + notes[i].Id.ToString(); imgbuttone.Width = 30; imgbuttone.ToolTip = "Edit"; imgbuttonb.ImageUrl = "../Images/deleteButton.png"; imgbuttonb.PostBackUrl = "~/Asp_forms/Deletenote.aspx?ID=" + notes[i].Id.ToString(); imgbuttonb.Width = 30; imgbuttonb.ToolTip = "Delete"; psub.CssClass = "default_panel"; psub.HorizontalAlign = HorizontalAlign.Right; a.Text = "<br/>" +userNote.getUser(notes[i].Author).Nick; a.CssClass = "noteauthor"; psub.Controls.Add(imgbuttonb); psub.Controls.Add(imgbuttone); psub.Controls.Add(a); string id = notes[i].Id.ToString(); p.ID = "p" + id; if (notes[i].Type == 'O') p.CssClass = "postitnotes"; else if (notes[i].Type == 'P') p.CssClass = "postitnotespink"; t.ID = "t" + id; f.ID = "f" + id; t.Text = notes[i].Text.ToString() + "<BR>"; p.Controls.Add(t); p.Controls.Add(f); p.Controls.Add(psub); Panel1.Controls.Add(p); i--; } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { User_Class myUser = new User_Class(); myUser = myUser.getUser(userCookie.Value); Events_Class events = new Events_Class(); List<Events_Class> eventsList = new List<Events_Class>(); eventsList = events.userEvents(myUser.Id); int totalEvents = eventsList.Count(); int counter = 0; Panel p = new Panel(); Label t = new Label(); HyperLink le = new HyperLink(); Panel header = new Panel(); Panel content = new Panel(); Panel footer = new Panel(); Panel cal = new Panel(); Panel textcontent = new Panel(); Label texto2 = new Label(); while (counter < totalEvents) { string id = eventsList[counter].Id.ToString(); p = new Panel(); t = new Label(); Label t2 = new Label(); Label t3 = new Label(); le = new HyperLink(); ImageButton removeButton = new ImageButton(); p.ID = "panel" + id; t.ID = "t" + id; le.ID = "le" + id; t3.Text = "<BR><BR>" + eventsList[counter].Date.ToString(); t2.Text = "<BR>" + eventsList[counter].Description.ToString() + "<BR><BR>"; t.Text = eventsList[counter].Location.ToString() + "<BR>"; t.CssClass = "cal_location"; t2.CssClass = "cal_description"; t3.CssClass = "cal_date"; removeButton.ToolTip = "Remove"; removeButton.ImageUrl = "../Images/deleteButton.png"; removeButton.PostBackUrl = "~/Asp_forms/RemoveUserFromEvents.aspx?ID=" + eventsList[counter].Id; removeButton.Width = 20; header = new Panel(); content = new Panel(); footer = new Panel(); cal = new Panel(); textcontent = new Panel(); texto2 = new Label(); header.ID = "header" + id; content.ID = "content" + id; footer.ID = "footer" + id; cal.ID = "cal" + id; footer.CssClass = "calfooter"; header.CssClass = "calheader"; header.HorizontalAlign = HorizontalAlign.Center; content.CssClass = "calcontent"; textcontent.CssClass = "caldefault"; cal.CssClass = "cal"; content.BackColor = System.Drawing.Color.White; header.Height = 82; header.Width = 300; footer.Height = 50; header.Controls.Add(t3); textcontent.Controls.Add(t); textcontent.Controls.Add(t2); textcontent.Controls.Add(le); textcontent.Controls.Add(removeButton); content.Controls.Add(textcontent); cal.Controls.Add(header); cal.Controls.Add(content); cal.Controls.Add(footer); cal.Width = 300; Panel2.Controls.Add(cal); counter++; } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Login_Master(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie != null) { userCookie.Expires = DateTime.Now.AddMonths(-1); Response.Cookies.Add(userCookie); } if (passCookie != null) { passCookie.Expires = DateTime.Now.AddMonths(-1); Response.Cookies.Add(passCookie); } User_Class myUser = new User_Class(); User_Class myUser2 = new User_Class(); myUser.Nick = UserName.Text; myUser.Pass = Password.Text; object refUrl = ViewState["RefUrl"]; if (myUser.existeUsuario(myUser.Nick)) { myUser2 = myUser.getUser(myUser.Nick); if (myUser.Pass == myUser2.Pass) { userCookie = new HttpCookie("UserID", myUser2.Nick); passCookie = new HttpCookie("UserPass", myUser2.Pass); userCookie.Expires = DateTime.Now.AddMonths(1); passCookie.Expires = DateTime.Now.AddMonths(1); Response.Cookies.Add(userCookie); Response.Cookies.Add(passCookie); Label1.Text = "Welcome " + myUser.Nick; UserLabel.Visible = false; UserName.Visible = false; PasswordLabel.Visible = false; Password.Visible = false; Button1.Visible = false; Button3.Visible = false; Button2.Visible = true; if (HttpContext.Current.Request.Url.LocalPath == "/default.aspx" || HttpContext.Current.Request.Url.LocalPath == "/Default.aspx" || HttpContext.Current.Request.Url.LocalPath == "/About.aspx") { Response.Redirect("/Default.aspx"); } else { Response.Redirect("../Default.aspx"); } } else { Label1.Text = "Contraseña incorrecta"; } } else { Label1.Text = "No existe el usuario"; } }
protected void Send(object sender, EventArgs e) { HttpCookie userCookie; userCookie = Request.Cookies["UserID"]; user = new User_Class(); user = user.getUser(userCookie.Value); user.getFriends(); Note_Class note = new Note_Class(); note.Text = TextBox1.Text; note.Date = DateTime.Now.ToShortDateString(); foreach (ListItem li in ListBox1.Items) { if (li.Selected == true) { if (Int32.Parse(li.Value) == 0) { note.Type = 'O'; } else if (Int32.Parse(li.Value) == 1) { note.Type = 'P'; } } } Category_Class category = new Category_Class(); if (TextBox2.Text != null && TextBox2.Text != "") { category.Nombre = TextBox2.Text; note.Category = category.getCategoryId(); } else note.Category = -1; List<User_Class> users = new List<User_Class>(); int indice = 0; foreach (ListItem li in ListBox2.Items) { indice = Int32.Parse(li.Value); users.Add(user.Friends[indice]); } if (note.Type!=' ' && note.addNote(user.Id, users)) Response.Redirect("../Asp_forms/Notes.aspx"); else Label4.Text = "An error has occurred"; }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { String s; s = Request.QueryString["ID"]; User_Class user = new User_Class(); int uid = -1; if (s != null || s == "") { uid = Int32.Parse(s); user=user.getUser(uid); Name.Text = user.Name + " "+ user.Surname + " |"; Nick.Text = user.Nick; HyperLink3.NavigateUrl = "~//Asp_forms/UserTable.aspx/?ID=" + uid.ToString(); HyperLink3.Text = user.Nick; Page.Title = user.Nick; } else Response.Redirect("~//Asp_forms/Friends.aspx"); Panel p = new Panel(); Label t = new Label(); Label f = new Label(); Label a = new Label(); Panel psub = new Panel(); Note_Class note=new Note_Class(); user.Notes=note.getNotesUserOpen(uid); foreach(Note_Class personalnote in user.Notes) { p = new Panel(); psub = new Panel(); t = new Label(); f = new Label(); a = new Label(); psub.CssClass = "default_panel"; psub.HorizontalAlign = HorizontalAlign.Right; string id = personalnote.Id.ToString(); p.ID = "p" + id; if (personalnote.Type == 'O') p.CssClass = "postitnotes"; else if (personalnote.Type == 'P') p.CssClass = "postitnotespink"; t.ID = "t" + id; f.ID = "f" + id; t.Text = personalnote.Text.ToString() + "<BR>"; a.Text = "<br/>" + user.getUser(personalnote.Author).Nick; a.CssClass = "noteauthor"; psub.Controls.Add(a); p.Controls.Add(t); p.Controls.Add(f); p.Controls.Add(psub); Panel1.Controls.Add(p); } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { if (Request.QueryString["all"] == "yes") RadioButtonList1.Items[1].Selected = true; else RadioButtonList1.Items[0].Selected = true; if (RadioButtonList1.Text == "Only my friends") { List<User_Class> lista = new List<User_Class>(); usuario_sesion.getFriends(); if (Request.QueryString["cadena"] != null) { lista = filterFriends(Request.QueryString["cadena"], usuario_sesion.Friends); } else { lista = usuario_sesion.Friends; } if (lista.Count() == 0) { Label label = new Label(); label.Attributes.Add("style", "float:center; margin-left:50px;"); label.ID = "LabelX"; label.Text = "<h2> No friends found! </h2>"; Panel2.Controls.Add(label); } HyperLink link = new HyperLink(); for (int j = 0; j < lista.Count(); j++) { link=new HyperLink(); link.Text=lista.ElementAt(j).Name; link.NavigateUrl="~//Asp_forms/UserTable.aspx/?ID="+lista.ElementAt(j).Id.ToString(); link.Attributes.Add("style", "clear:both; margin-left:50px;"); Panel p = createPanel(); Panel2.Controls.Add(p); p.Controls.Add(createImage(lista.ElementAt(j).Image_url)); p.Controls.Add(link); p.Controls.Add(createPrfButton(lista.ElementAt(j).Id)); p.Controls.Add(createDelButton(lista.ElementAt(j).Id)); } } else if (RadioButtonList1.Text == "All Users") { List<User_Class> lista = new List<User_Class>(); if (Request.QueryString["cadena"] != null) { lista = filterFriends(Request.QueryString["cadena"], usuario_sesion.getAllUser()); } else { lista = usuario_sesion.getAllUser(); } HyperLink link = new HyperLink(); for (int j = 0; j < lista.Count(); j++) { link = new HyperLink(); link.Text = lista.ElementAt(j).Name; link.NavigateUrl = "~//Asp_forms/UserTable.aspx/?ID=" + lista.ElementAt(j).Id.ToString(); link.Attributes.Add("style", "clear:both; margin-left:50px;"); Panel p = createPanel(); Panel2.Controls.Add(p); p.Controls.Add(createImage(lista.ElementAt(j).Image_url)); p.Controls.Add(link); if (usuario_sesion.isFriend(lista.ElementAt(j).Id)) { p.Controls.Add(createPrfButton(lista.ElementAt(j).Id)); } if (!usuario_sesion.isFriend(lista.ElementAt(j).Id)) { p.Controls.Add(createAddButton(lista.ElementAt(j).Id)); } else { p.Controls.Add(createDelButton(lista.ElementAt(j).Id)); } } } } else { Response.Redirect("../Account/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie userCookie; HttpCookie passCookie; userCookie = Request.Cookies["UserID"]; passCookie = Request.Cookies["UserPass"]; if (userCookie == null || passCookie == null) { Response.Redirect("../Account/Login.aspx"); } else { User_Class usuario_sesion = new User_Class(); usuario_sesion = usuario_sesion.getUser(userCookie.Value); if (usuario_sesion.Pass == passCookie.Value) { int categoryid = int.Parse(Request.QueryString["id"]); Category_Class category = new Category_Class(); category = category.getCategoria(categoryid); CategoryLabel.Text = category.Nombre + " Notes"; Panel p = new Panel(); Label t = new Label(); Label f = new Label(); Image ie = new Image(); ie.ImageUrl = "../Images/editButton.png"; ImageButton imgbuttone = new ImageButton(); ImageButton imgbuttonb = new ImageButton(); Panel psub = new Panel(); Note_CAD notaTemp = new Note_CAD(); List<Note_Class> notes = new List<Note_Class>(); User_Class userTemp = new User_Class(); userTemp = userTemp.getUser(userCookie.Value); notes = notaTemp.notesCategory(userTemp.Id, category.Id); int i = notes.Count() - 1; if (notes.Count() == 0) { noCategories.Text = "No " + category.Nombre + " notes found. Start creating one up here!"; } else { while (i >= 0) { p = new Panel(); psub = new Panel(); t = new Label(); f = new Label(); imgbuttone = new ImageButton(); imgbuttonb = new ImageButton(); imgbuttone.ImageUrl = "../Images/editButton.png"; imgbuttone.PostBackUrl = "~/Asp_forms/Editnotes.aspx?ID=" + notes[i].Id.ToString(); imgbuttone.Width = 30; imgbuttone.ToolTip = "Edit"; imgbuttonb.ImageUrl = "../Images/deleteButton.png"; imgbuttonb.PostBackUrl = "~/Asp_forms/Deletenote.aspx?ID=" + notes[i].Id.ToString(); imgbuttonb.Width = 30; imgbuttonb.ToolTip = "Delete"; psub.CssClass = "default_panel"; psub.HorizontalAlign = HorizontalAlign.Right; psub.Controls.Add(imgbuttonb); psub.Controls.Add(imgbuttone); string id = notes[i].Id.ToString(); p.ID = "p" + id; p.CssClass = "postitnotes"; t.ID = "t" + id; f.ID = "f" + id; t.Text = notes[i].Text.ToString() + "<BR>"; p.Controls.Add(t); p.Controls.Add(f); p.Controls.Add(psub); Panelnota.Controls.Add(p); i--; } } } else { Response.Redirect("../Account/Login.aspx"); } } }