protected void gv_usertickets_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("CancelInvitation")) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } else { string sID = cookie["UserID"].ToString(); int id = int.Parse(sID); DataSet ds = (DataSet)Session["ticketTable"]; DataTable dt = ds.Tables[0]; int i = int.Parse(e.CommandArgument.ToString()); string sinvitationid = dt.Rows[i]["InvitationID"].ToString(); int invitationid = int.Parse(sinvitationid); WS_UserProfile up = new WS_UserProfile(); string msg = up.CancelInvite(invitationid); Response.Write(msg); Response.Redirect("UserInvitationDetails.aspx"); //if (msg == "Invitation Has Been Canceled") // Response.Write(msg); // //string sprice = dt.Rows[i]["Price"].ToString(); // //int price = int.Parse(sprice); //else // Response.Write } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie != null) { MultiViewlog.SetActiveView(viewlogout); MultiViewlog.Visible = true; string sID = cookie["UserID"].ToString(); int id = int.Parse(sID); WS_UserProfile us = new WS_UserProfile(); string fname = us.RetrieveFirstName(id); lbl_mpage_fname.Text = fname; string lname = us.RetrieveFLastName(id); lbl_mpage_lname.Text = lname; DateTime dt = DateTime.Now; string sdt = dt.ToString(); lbl_mpage_datenow.Text = sdt; } else { MultiViewlog.SetActiveView(view_login); MultiViewlog.Visible = true; } } }
protected void btn_changepass_Click(object sender, EventArgs e) { string msg; HttpCookie cookie = Request.Cookies["Details"]; string sID = cookie["UserID"].ToString(); int id = int.Parse(sID); WS_UserProfile us = new WS_UserProfile(); string oldpass = us.UserPassword(id); string newpass1 = txt_newpass.Text; string newpass2 = txt_passconfirmation.Text; if (txt_oldpass.Text == oldpass) { if (newpass1 == newpass2) { us.NewPassword(id, newpass1); msg = "Password changed"; } else { msg = " Change Failed. Wrong password confirmation"; } } else { msg = "Change failed. old password is wrong"; } Response.Write(msg); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } else { string sID = cookie["UserID"].ToString(); int id = int.Parse(sID); WS_UserProfile up = new WS_UserProfile(); int userid = up.RetrieveUserID(id); lbl_useridprivateprofile2.Text = userid.ToString(); string firstname = up.RetrieveFirstName(id); lbl_fnameprivateprofile2.Text = firstname; string lname = up.RetrieveFLastName(id); lbl_lnameprivateprofile2.Text = lname; int age = up.RetrieveAge(id); lbl_ageprivateprofile2.Text = age.ToString(); string country = up.RetrieveCountry(id); lbl_countryprivateprofile2.Text = country; string gender = up.RetrieveGender(id); lbl_genderprivateprofile2.Text = gender; string email = up.RetrieveEmail(id); lbl_emailprivateprofile2.Text = email; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } else { string sID = cookie["UserID"].ToString(); int id = int.Parse(sID); WS_UserProfile up = new WS_UserProfile(); DataTable dt = up.UserTicketView(id); DataSet ds = new DataSet(); ds.Tables.Add(dt); Session.Add("ticketTable", ds); gv_usertickets.DataSource = ds; gv_usertickets.DataBind(); } } }
protected void gv_deleteusers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("DeleteUser")) { HttpCookie cookie = Request.Cookies["Details"]; if (cookie == null) { Response.Redirect("Login.aspx"); } else { WS_UserProfile ws = new WS_UserProfile(); DataSet ds = (DataSet)Session["usersTable"]; DataTable dt = ds.Tables[0]; int i = int.Parse(e.CommandArgument.ToString()); int id = int.Parse(dt.Rows[i]["UserID"].ToString()); AdminActions ac = new AdminActions(); DataTable dt2 = ws.UserTicketView(id); for (int q = 0; q < dt2.Rows.Count; q++) { int invitation = int.Parse(dt2.Rows[q]["InvitationID"].ToString()); ws.CancelInvite(invitation); } int j = ac.DeleteUser(id); if (j == 1) { Response.Write("User Was Deleted"); } else { Response.Write("Delete Failed"); } Response.Redirect("AdminDeleteUsers.aspx"); } } }
protected void btn_updateprofile_Click(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["Details"]; string sID = cookie["UserID"].ToString(); int id = int.Parse(sID); string fname, lname, country, gender, email, pass; int age, updatemsg, credit; WS_UserProfile us = new WS_UserProfile(); Service s = new Service(); if (txt_fname_updatepage.Text == "") { fname = us.RetrieveFirstName(id); } else { fname = txt_fname_updatepage.Text; } if (txt_lname_updatepage.Text == "") { lname = us.RetrieveFLastName(id); } else { lname = txt_lname_updatepage.Text; } if (txt_age_updatepage.Text == "") { age = us.RetrieveAge(id); } else { age = int.Parse(txt_age_updatepage.Text); } if (txt_country_updatepage.Text == "") { country = us.RetrieveCountry(id); } else { country = txt_country_updatepage.Text; } if (txt_gender_updatepage.Text == "") { gender = us.RetrieveGender(id); } else { gender = txt_gender_updatepage.Text; } if (txt_email_updatepage.Text == "") { email = us.RetrieveEmail(id); } else { email = txt_email_updatepage.Text; } if (txt_creditcard_updatepage.Text == "") { credit = us.RetrieveCreditNum(id); } else { credit = int.Parse(txt_creditcard_updatepage.Text); } pass = us.UserPassword(id); updatemsg = us.UserProfileUpdate(id, fname, lname, age, country, gender, email, credit, pass); if (updatemsg == 1) { Response.Write("Update Successful."); } else { Response.Write("Update failed."); } }