예제 #1
0
    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();
            }
        }
    }
예제 #2
0
 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");
         }
     }
 }