protected void BtnSave_Click(object sender, EventArgs e) { int iReturn; _vehicleAccidentDetail = new VehicleAccidentDetailsBLL(); _vehicleAccidentDetail = GetVehicelDetails(); switch (BtnSave.Text) { case "Update": _vehicleAccidentDetail.HdnId = int.Parse(ViewState["hdnvalue"].ToString()); iReturn = _vehicleAccidentDetail.UpdVehicleAccidentInvestigationDetails(); switch (iReturn) { case 0: Show("Records Not Inserted"); ClearAll(); break; default: Show("Record Inserted Successfully"); GetVehicleNumber(); ClearAll(); break; } break; default: switch (ddlistVehicleNumber.SelectedIndex) { case 0: Show("Select Vehicle"); break; default: iReturn = _vehicleAccidentDetail.InsertVehicleAccidentInvestigationDetails(); switch (iReturn) { case 0: Show("Records Not Inserted"); ClearAll(); break; default: Show("Record Inserted Successfully"); GetVehicleNumber(); ClearAll(); break; } break; } break; } }
protected void gvVehicleDetails_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "_Details": BtnSave.Text = "Update"; ddlistVehicleNumber.Visible = false; txtVehNum.Visible = true; txtVehNum.Enabled = false; var row = (GridViewRow)((WebControl)e.CommandSource).Parent.Parent; var hdnfield = (HiddenField)row.FindControl("hdnvehicelvalue"); var accdetails = new VehicleAccidentDetailsBLL(); var ds = accdetails.GetaccvehicelDetails(int.Parse(hdnfield.Value)); ViewState["hdnvalue"] = int.Parse(hdnfield.Value); txtVehNum.Text = Convert.ToString(ds.Tables[1].Rows[0]["VehicleNumber"].ToString()); TxtAccidentDateTime.Text = Convert.ToString(ds.Tables[0].Rows[0]["AccidentDateTime"].ToString()); TxtAccidentTitle.Text = Convert.ToString(ds.Tables[0].Rows[0]["AccidentTitle"].ToString()); TxtSpotSurveyor.Text = Convert.ToString(ds.Tables[0].Rows[0]["SpotSurveyor"].ToString()); TxtSpotSurveyorDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["SpotSurDate"].ToString()); TxtFinalSurveyor.Text = Convert.ToString(ds.Tables[0].Rows[0]["FinalSurveyor"].ToString()); TxtFinalSurveyorDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["FinalSurDate"].ToString()); TxtReinspectionSurveyor.Text = Convert.ToString(ds.Tables[0].Rows[0]["ReInsSurveyor"].ToString()); TxtReinspectionSurveyorDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["ReInsSurDate"].ToString()); TxtPolicyNumber.Text = Convert.ToString(ds.Tables[0].Rows[0]["PolicyNo"].ToString()); TxtAgency.Text = Convert.ToString(ds.Tables[0].Rows[0]["Agency"].ToString()); TxtInsuranceStartDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["InsStDate"].ToString()); TxtInsuranceEndDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["InsEndDate"].ToString()); TxtClaimFormSubmissionDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["ClaimDate"].ToString()); TxtTotalCostofRepairs.Text = Convert.ToString(ds.Tables[0].Rows[0]["CostRepairs"].ToString()); TxtSurveyorAssessmentValue.Text = Convert.ToString(ds.Tables[0].Rows[0]["AssValue"].ToString()); TxtBillSubmissionDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["BillSubmissionDate"].ToString()); ddlistPaymentStatus.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["PayStatus"].ToString()); txtRemarks.Text = Convert.ToString(ds.Tables[0].Rows[0]["Remarks"].ToString()); TxtPaymentRecievedDate.Text = Convert.ToString(ds.Tables[0].Rows[0]["PayDate"].ToString()); TxtChequeNo.Text = Convert.ToString(ds.Tables[0].Rows[0]["Cheque"].ToString()); TxtAmountRecievedFromInsurance.Text = Convert.ToString(ds.Tables[0].Rows[0]["AmtRecieved"].ToString()); TxtCostToCompany.Text = Convert.ToString(ds.Tables[0].Rows[0]["Cost"].ToString()); break; } }