예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
                }
            }
        }