Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         JsonManage json = new JsonManage();
         _data.SaveServiceOfVehicle(Int32.Parse(CarID.Text));
         MessageBox.Show("History has been stored, the path is bin/Debug/" + Int32.Parse(CarID.Text) + ".json");
     }
     catch
     {
         MessageBox.Show("Error Input!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public bool SaveServiceOfVehicle(int vehicleId)
        {
            JsonManage jsonManage = new JsonManage();

            object o = GetVehicleByID(vehicleId);

            if ((o.GetType()).Equals(typeof(Car)))
            {
                jsonManage.SaveServiceOfVehicle(((Car)o).History, vehicleId);
                return(true);
            }
            else if ((o.GetType()).Equals(typeof(Truck)))
            {
                jsonManage.SaveServiceOfVehicle(((Truck)o).History, vehicleId);
                return(true);
            }
            return(false);
        }
        public string DisplayServiceOfVehicle(int vehicleId)
        {
            JsonManage jsonManage = new JsonManage();

            return(jsonManage.DisplayServiceOfVehicle(vehicleId));
        }