public int SaveItem(ETrackItem item)
 {
     lock (locker)
     {
         if (item.ID != 0)
         {
             database.Update(item);
             return(item.ID);
         }
         else
         {
             return(database.Insert(item));
         }
     }
 }
Example #2
0
        public EtrackJson(ETrackItem item)
        {
            this.user_id       = item.user_id;
            this.car_id        = item.car_id;
            this.dt            = item.dt;
            this.gps_latitude  = item.gps_latitude;
            this.gps_longitude = item.gps_longitude;
            this.vehicle_speed = item.vehicle_speed;
            this.mileage       = item.mileage;

            jsonString = "[{\"user_id\":" + user_id + ",\"car_id\":\"" + car_id + "\",\"dt\":" + dt + "," +
                         "\"time_interval\":0,\"engine_load\":-1000,\"engine_rpm\":-1000," +
                         "\"vehicle_speed\":" + vehicle_speed + ",\"engine_start_time\":-1000,\"temperature_engine_coolant\":-1000," +
                         "\"temperature_engine_oil\":-1000,\"temperature_intake_air\":-1000,\"fuel_pressure\":-1000," +
                         "\"battery_life\":-1000,\"mileage\":" + mileage + ",\"steering_angle\":-1000,\"gps_longitude\":\"" + gps_longitude + "\"," +
                         "\"gps_latitude\":\"" + gps_latitude + "\",\"orientation\":\"0.0\",\"accelerator_pressure\":\"-1000.0\"," +
                         "\"tire_pressure\":\"-1000.0\",\"tire_temperature\":\"-1000.0\",\"brakes\":\"-1000.0\",\"hand_brakes\":\"-1000\"," +
                         "\"light_direction\":\"-1000\",\"wiper\":\"-1000\",\"gear_position\":\"-1000\",\"esp_status\":-1000," +
                         "\"adas_event_log\":{\"laneDepatureWarning\":0,\"forwardCollisionWarning\":0,\"backwardCollisionWarning\":0," +
                         "\"blindSpotDetectionWarning\":0,\"overTheSpeedLimitWarning\":0,\"sleepDetectionWarning\":0,\"carCollisionWarning\":0,\"emergencyBrakeWarning\":0}," +
                         "\"event_video_file\":\"\",\"engine_start_count\":0,\"faultCode\":\"\",\"batteryVoltage\":\"-1000\",\"residualFuel\":\"-1000\"}]";
        }