protected void LoginBtn_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                try
                {
                    CamperDAO camperDAO  = new CamperDAO(txtUserName.Text.ToUpper(), txtPassword.Text);
                    Camper    camperInfo = camperDAO.ValidateCamper();

                    if (camperInfo != null)
                    {
                        Session.Add("login", camperInfo);
                        Response.Redirect("~/CamperActivities.aspx");
                    }
                    else
                    {
                        lblInvalid.Visible = true;
                    }
                }
                catch (Exception)
                {
                    lblInvalid.Visible = true;
                }
            }
        }
Beispiel #2
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Camper    login      = (Camper)Session["login"];
            CamperDAO activity   = new CamperDAO(login.UserName, login.Password);
            int       index      = Convert.ToInt32(e.CommandArgument);
            int       ActivityID = Convert.ToInt32(GridView1.Rows[index].Cells[0].Text);

            if (e.CommandName == "DELETE")
            {
                try
                {
                    activity.UnregisterActivity(ActivityID);
                    GetNumberOfActivities();
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Message;
                }
            }
        }