private bool RetrieveVehicleInformationAndBind(string vehicleId) { try { VehicleInformation info; string vehicleKey; using (KeyEncoderService keyEncoderService = new KeyEncoderService()) { keyEncoderService.Url = settings.FuelTrakUrl + (settings.FuelTrakUrl.EndsWith("/") ? "" : "/") + "Services/KeyEncoderService.asmx"; info = keyEncoderService.GetVehicleInformation(vehicleId); if (info == null) { DisplayStatusMessage("No data found for vehicle: " + vehicleId, false); return(false); } vehicleKey = keyEncoderService.GetVehicleKeyId(vehicleId); } FuelTrakKeyData data = FuelTrakKeyData.ParseFromVehicleInformation(info, vehicleKey); BindDataToView(data); return(true); } catch (Exception ex) { return(false); } }
private bool RetrievePersonnelInformationAndBind(string personnelId) { try { PersonnelInformation info; string personnelKey; using (KeyEncoderService keyEncoderService = new KeyEncoderService()) { keyEncoderService.Url = settings.FuelTrakUrl + (settings.FuelTrakUrl.EndsWith("/") ? "" : "/") + "Services/KeyEncoderService.asmx"; info = keyEncoderService.GetPersonnelInformation(personnelId); if (info == null) { DisplayStatusMessage("No data found for personnel: " + personnelId, false); return(false); } personnelKey = keyEncoderService.GetPersonnelKeyId(personnelId); } FuelTrakKeyData data = FuelTrakKeyData.ParseFromPersonnelInformation(info, personnelKey); BindDataToView(data); return(true); } catch (Exception ex) { Log(ex.Message); Log(ex.StackTrace); DisplayStatusMessage("Exception:" + ex.InnerException.ToString(), false); return(false); } }
private bool ValidateSettings() { if (string.IsNullOrEmpty(txtFuelTrakUrl.Text) || !Uri.IsWellFormedUriString(txtFuelTrakUrl.Text, UriKind.Absolute)) { MessageBox.Show("Error: Invalid FuelTRAK Url Entered. Please enter the base url to the FuelTRAK website (e.g http://<your-web-server>/FuelTRAK/).", "Invalid Setting", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } using (KeyEncoderService service = new KeyEncoderService()) { try { service.Url = txtFuelTrakUrl.Text + (txtFuelTrakUrl.Text.EndsWith("/") ? "" : "/") + "Services/KeyEncoderService.asmx"; service.Ping(); return(true); } catch (Exception) { MessageBox.Show("Error: Invalid FuelTRAK Url Entered. Please enter the base url to the FuelTRAK website (e.g http://<your-web-server>/FuelTRAK/).", "Invalid Setting", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } }