// When lease is clicked, get slip and cust ID, instantiate new lease, add it to DB and refresh view. protected void uxLease_Click(object sender, EventArgs e) { int slipID = Convert.ToInt32(uxSlips.SelectedValue); int custID; if (Request.Cookies["CustomerID"] != null) { custID = Convert.ToInt32(Request.Cookies["CustomerID"].Value); } else if (Session["customerID"] != null) { // Get customer ID from session. custID = (int)Session["customerID"]; } else // display message if cookies are disabled and session custID doesn't exist. { uxMessage.Text = "Something went wrong, please log out and log in again."; return; } // instantiate new lease and add it to DB, then bind. Lease newLease = new Lease { CustomerID = custID, SlipID = slipID }; mgr.LeaseSlip(newLease); GetAvailableSlips(Convert.ToInt32(DockSelector.SelectedDockID)); }