protected void Button1_Click(object sender, EventArgs e) { String jet = jetsDropDownList.SelectedValue; String dest = destinationDropDownList.SelectedValue; DateTime date = Calendar1.SelectedDate; if (ampmDropDownList.SelectedValue == "PM") { int hours; if (hourBox.Text == "12") { hours = Convert.ToInt32(hourBox.Text); } else { hours = Convert.ToInt32(hourBox.Text) + 12; } TimeSpan time = new TimeSpan(hours, Convert.ToInt32(minuteBox.Text), 0); date = date.Date + time; } else { int hours; if (hourBox.Text == "12") { hours = Convert.ToInt32(hourBox.Text) - 12; } else { hours = Convert.ToInt32(hourBox.Text); } TimeSpan time = new TimeSpan(hours, Convert.ToInt32(minuteBox.Text), 0); date = date.Date + time; } DBReservations.RegisterReservation(DBPlanes.getID(jet), CookieHandler.getID(), DBDestinations.getID(dest), date); //sets cookies for use in results page CookieHandler.setCookie("jet", DBPlanes.getName(DBPlanes.getID(jet))); CookieHandler.setCookie("dest", destinationDropDownList.SelectedValue); CookieHandler.setCookie("date", date.ToString()); //change page to results HttpContext.Current.Response.Redirect("Results.aspx"); }
public static void clearResultsCookies() { CookieHandler.setCookie("jet", string.Empty); CookieHandler.setCookie("dest", string.Empty); CookieHandler.setCookie("date", string.Empty); }