public void OnSelect(object sender, EventArgs e) { GridViewRow row = AlGride.SelectedRow; int start = int.Parse(row.Cells[3].Text); int end = int.Parse(row.Cells[4].Text); String driverid = row.Cells[2].Text; String carid = row.Cells[1].Text; datacontrol b = (datacontrol)Session["database"]; if (b.isCarContract(carid, start, end)) { Response.Write("<script>alert('car not free!');</script>"); return; } if (b.isDriverContract(driverid, start, end)) { Response.Write("<script>alert('driver not free!');</script>"); return; } b.updateContractIsagree(carid, driverid, start, true); }
protected void OnAddContract(object sender, EventArgs e) { Driver a = (Driver)Session["driver"]; datacontrol b = (datacontrol)Session["database"]; String id = carid.Text; int start = int.Parse(startText.Text); int end = int.Parse(endText.Text); if (!b.isCarContract(id, start, end)) { System.Windows.Forms.MessageBox.Show("car not free"); return; } if (!b.isDriverContract(a.driverid, start, end)) { System.Windows.Forms.MessageBox.Show("driver not free"); return; } else { System.Windows.Forms.MessageBox.Show("success"); } b.insert(carid.Text, a.driverid, start, end, false, true); }