Exemplo n.º 1
0
        public void DeleteVehicle()
        {
            //setting up test data
            int testId = 1019;
            VehicleInfo testVehicle = new VehicleInfo ();
            testVehicle.Id = testId;
            testVehicle.Make = "Honda";
            testVehicle.Model = "Insight";
            testVehicle.Registration = "1ECH993";
            testVehicle.EngType = "1300";
            testVehicle.OdometerReading = 489576;
            testVehicle.Description = "Vehicle being saved so we can test delete";
            testVehicle.ClubRegistration = false;

            DBManager.Instance.SaveVehicle (testVehicle);

            //delete information
            VehicleInfo deleteVehicle = DBManager.Instance.GetVEH(testId);
            Assert.NotNull (deleteVehicle);

            DBManager.Instance.DeleteVeh (testId);

            VehicleInfo veh = DBManager.Instance.GetVEH (testId);
            Assert.Null (veh);
        }
Exemplo n.º 2
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			// Use this to return your custom view for this Fragment
			// return inflater.Inflate(Resource.Layout.YourFragment, container, false);

			View view = inflater.Inflate(Resource.Layout.VehicleDetailsFragment, container, false);

			_makeEditText = view.FindViewById<EditText>(Resource.Id.makeEditText);
			_modelEditText = view.FindViewById<EditText>(Resource.Id.modelEditText);
			_engineEditText = view.FindViewById<EditText>(Resource.Id.engineEditText);
			_odoEditText = view.FindViewById<EditText>(Resource.Id.odoEditText);
			_regoEditText = view.FindViewById<EditText>(Resource.Id.regoEditText);
			_descrEditText = view.FindViewById<EditText> (Resource.Id.descrEditText);



			SetHasOptionsMenu (true);

			if (Arguments!=null && Arguments.ContainsKey("veh")) {
				string vehJson = Arguments.GetString ("veh");
				_vehInfo = JsonConvert.DeserializeObject<VehicleInfo>(vehJson);
			} else {
				_vehInfo = new VehicleInfo ();
			}

			UpdateUI ();

			return view;
		}
Exemplo n.º 3
0
		public override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			if (Arguments!=null && Arguments.ContainsKey("veh")) {
				string vehJson = Arguments.GetString ("veh");
				_vehInfo = JsonConvert.DeserializeObject<VehicleInfo>(vehJson);
			} else {
				_vehInfo = new VehicleInfo ();
			}
		}
Exemplo n.º 4
0
        public void CreateVehicle()
        {
            //setting up test data
            int testId=1091;
            VehicleInfo newVehicle = new VehicleInfo ();
            newVehicle.Id = testId;
            newVehicle.Make = "Honda";
            newVehicle.Model = "Insight";
            newVehicle.Registration = "1ECH993";
            newVehicle.EngType = "1300";
            newVehicle.OdometerReading = 489576;
            newVehicle.ClubRegistration = false;

            //saving Vehicle Record
            int recordsUpdated = DBManager.Instance.SaveVehicle(newVehicle);

            //verifiy if the newly created vehicle exists

            VehicleInfo vehicle = DBManager.Instance.GetVEH (testId);
            Assert.NotNull (vehicle);
            Assert.AreEqual (vehicle.Make, "Honda");
        }
Exemplo n.º 5
0
 //vehicleInfo table actions when creating a vehicle
 //inserting or updating a vehicle record
 public int SaveVehicle(VehicleInfo veh)
 {
     int result = dbConn.InsertOrReplace (veh);
     Console.WriteLine ("{0} record updated", result);
     return result;
 }
Exemplo n.º 6
0
		private async void CreateOrUpdateVehAsync(VehicleInfo veh){
			VELService service = new VELService ();
			if (!service.isConnected(activity)) {
				Toast toast = Toast.MakeText (activity, "Not conntected to internet. Please check your device network settings.", ToastLength.Short);
				toast.Show ();
				return;
			}

			string response = await service.CreateOrUpdateVehAsync(_vehInfo);
			if (!string.IsNullOrEmpty (response)) {
				Toast toast = Toast.MakeText (activity, String.Format ("{0} saved.", _vehInfo.Registration), ToastLength.Short);
				toast.Show();

				DBManager.Instance.SaveVehicle (veh);

				if(!DVELActivity.isDualMode)
					activity.Finish ();
			} else {
				Toast toast = Toast.MakeText (activity, "Something went Wrong!", ToastLength.Short);
				toast.Show();
			}
		}