protected void btnTestGetRentalCarAgencies_Click(object sender, EventArgs e) { CarServiceRef.Agency agency = new CarServiceRef.Agency(); CarServiceRef.CarService pxy = new CarServiceRef.CarService(); DataSet myDS = pxy.GetRentalCarAgencies("Philadelphia", "PA"); gvDisplayResults.DataSource = myDS; gvDisplayResults.DataBind(); }
protected void btnSearchCarAgencies_Click(object sender, EventArgs e) { CarServiceRef.CarService carService = new CarServiceRef.CarService(); DataSet agencies = carService.GetRentalCarAgencies(txtCarCity.Text, ddlCarState.SelectedValue); CarServiceRef.Agency agency = new CarServiceRef.Agency(); agency.agencyID = (int)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["agencyID"]; agency.name = ddlAgencies.SelectedValue; agency.phone = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["phone"]; agency.email = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["email"]; agency.city = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["city"]; agency.state = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["state"]; CarServiceRef.CarService pxy = new CarServiceRef.CarService(); DataSet myDS = pxy.GetCars(agency, txtCarCity.Text, ddlCarState.SelectedValue); rptCars.DataSource = myDS; rptCars.DataBind(); divCarForm.Visible = false; divCarResults.Visible = true; }
protected void btnCarSelectCity_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtCarCity.Text)) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('Please enter a valid city.')", true); return; } if (ddlCarState.SelectedValue == "Select state") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('Please select a state.')", true); return; } CarServiceRef.CarService carService = new CarServiceRef.CarService(); DataSet agencies = carService.GetRentalCarAgencies(txtCarCity.Text, ddlCarState.SelectedValue); ddlAgencies.DataSource = agencies; ddlAgencies.DataTextField = "name"; ddlAgencies.DataValueField = "name"; ddlAgencies.DataBind(); divCarDetails.Visible = true; }