protected void btAdd_Click(object sender, EventArgs e) { classCharter charter = new classCharter(); charter.char_Trip = Convert.ToInt32(txtTrip.Text); charter.char_Date = DateTime.Parse(txtDate.Text); charter.ac_Number = txtAccountNum.Text; charter.char_Destination = drpDestination.Text; charter.char_Hours_Flown = double.Parse(txtHoursFlown.Text); charter.char_Hours_Wait = double.Parse(txtHoursWait.Text); charter.char_Fuel_Gallons = double.Parse(txtFuelGallons.Text); charter.char_Oil_Qts = int.Parse(txtOilQuantity.Text); charter.cus_Code = int.Parse(txtCusCode.Text); charterHandler cHandler = new charterHandler(); if (cHandler.AddNewCharter(charter) == true) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Fail')", true); } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Success')", true); } }
protected void dgvCharter_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblTrip = dgvCharter.Rows[e.RowIndex].FindControl("lblTrip") as Label; TextBox txtDate = dgvCharter.Rows[e.RowIndex].FindControl("txtDate") as TextBox; TextBox txtNumber = dgvCharter.Rows[e.RowIndex].FindControl("txtNumber") as TextBox; TextBox txtDestination = dgvCharter.Rows[e.RowIndex].FindControl("txtDestination") as TextBox; TextBox txtDistance = dgvCharter.Rows[e.RowIndex].FindControl("txtDistance") as TextBox; TextBox txtHoursFlown = dgvCharter.Rows[e.RowIndex].FindControl("txtHoursFlown") as TextBox; TextBox txtHoursWait = dgvCharter.Rows[e.RowIndex].FindControl("txtHoursWait") as TextBox; TextBox txtFuelGallons = dgvCharter.Rows[e.RowIndex].FindControl("txtFuelGallons") as TextBox; TextBox txtOil_Qts = dgvCharter.Rows[e.RowIndex].FindControl("txtOil_Qts") as TextBox; TextBox txtcust_Code = dgvCharter.Rows[e.RowIndex].FindControl("txtcust_Code") as TextBox; if (lblTrip != null && txtDate != null && txtNumber != null && txtDestination != null && txtDistance != null && txtHoursFlown != null && txtHoursWait != null && txtFuelGallons != null && txtOil_Qts != null && txtcust_Code != null) { classCharter charter = new classCharter(); charter.char_Trip = Convert.ToInt32(lblTrip.Text.Trim()); charter.char_Date = DateTime.Parse(txtDate.Text); charter.ac_Number = txtNumber.Text; charter.char_Destination = txtDestination.Text; charter.char_Distance = int.Parse(txtDistance.Text); charter.char_Hours_Flown = double.Parse(txtHoursFlown.Text); charter.char_Hours_Wait = double.Parse(txtHoursWait.Text); charter.char_Fuel_Gallons = double.Parse(txtFuelGallons.Text); charter.char_Oil_Qts = int.Parse(txtOil_Qts.Text); charter.cus_Code = int.Parse(txtOil_Qts.Text); if (cHandler.UpdateCharter(charter) == true) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Success')", true); } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Fail')", true); } dgvCharter.EditIndex = -1; this.BindGrid(); } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('It not working')", true); } }
public bool UpdateCharter(classCharter charter) { return(charterDB.UpdateCharter(charter)); }
public bool AddNewCharter(classCharter charter) { return(charterDB.AddNewCharter(charter)); }