protected void btnDelActivity_Click(object sender, EventArgs e) { int familyID = (int)Session["familyID"]; DateTime startDate = Convert.ToDateTime(calStartDate.SelectedDate); string activityName = ddlActivityName.SelectedValue; try { CalendarDA.DeleteActivity(familyID, activityName, startDate); Response.Redirect("~/Views/Manage.aspx"); } catch (Exception ex) { Console.WriteLine(ex); lblError.Text = "There was an error deleting the Activity"; btnDone.Visible = true; } }
protected void btnAddEvent_Click(object sender, EventArgs e) { Users u = (Users)Session["Users"]; Activity a = new Activity(); a.FamilyID = u.FamilyID; a.ActivityName = txtTitle.Text; a.StartDate = Convert.ToDateTime(txtStartDate.Text); a.EndDate = Convert.ToDateTime(txtEndDate.Text); a.Time = Convert.ToDateTime(txtTime.Text); try { CalendarDA.addActivity(a); Response.Redirect("~/Views/Manage.aspx"); } catch (Exception ex) { Console.WriteLine(ex); lblError.Text = "There was an error adding this activity"; btnExit.Visible = true; } }