protected void btnSubmit_Click(object sender, EventArgs e) { DataLayer.CloseConn(); if (cbxDeleteJob.Checked) { DataLayer.DeleteJob(gJobID); Response.Redirect("Schedule.aspx?date=" + dt.Month.ToString() + "/" + dt.Day.ToString() + "/" + dt.Year.ToString()); } else { if (sFunction == null) { if (rblNewExisting.Items[0].Selected) { DateTime dtNextReminder = DateTime.Now.AddDays(14); DataLayer.AddCustomerUpFront(tbxName.Text, tbxPhone.Text, tbxEmail.Text, dtNextReminder); DataSet ds = DataLayer.CustomQuery("SELECT * FROM dCustomers WHERE Name='" + tbxName.Text + "' AND [Phone Number]='" + tbxPhone.Text + "' AND Email='" + tbxEmail.Text + "' AND [Next Reminder Date]='" + dtNextReminder.ToString() + "'"); Guid gCustomerID = new Guid(ds.Tables[0].Rows[0].ItemArray[0].ToString()); DataLayer.AddJob(gCustomerID, dt, ddlJobType.Text, tbxAddress.Text, tbxJobDescription.Text, tbxJobNotes.Text); Response.Redirect("Schedule.aspx?date=" + dt.Month.ToString() + "/" + dt.Day.ToString() + "/" + dt.Year.ToString()); } else { Guid g = new Guid(lbxCustomers.SelectedValue); DataLayer.AddJob(g, dt, ddlJobType.Text, tbxAddress.Text, tbxJobDescription.Text, tbxJobNotes.Text); Response.Redirect("Schedule.aspx?date=" + dt.Month.ToString() + "/" + dt.Day.ToString() + "/" + dt.Year.ToString()); } } else if (sFunction == "edit") { DataLayer.UpdateJob(gJobID, gCustomerID, dt, ddlJobType.SelectedValue, tbxAddress.Text, tbxJobDescription.Text, tbxJobNotes.Text); Response.Redirect("Schedule.aspx?date=" + dt.Month.ToString() + "/" + dt.Day.ToString() + "/" + dt.Year.ToString()); } } }