public IHttpActionResult SaveDriverActivity(DriverActivity driverActivity) { try { var result = new DriverActivityBO().SaveDriverActivity(driverActivity); return(Ok(result ? UTILITY.SUCCESSMSG : UTILITY.FAILEDMSG)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult IsConfirmBooking(string bookingNo) { try { var booking = new BookingBO().GetBooking(new Booking { BookingNo = bookingNo }); var driverInfo = new Driver(); var driverActivity = new DriverActivity(); if (booking.IsConfirm) { driverInfo = new DriverBO().GetDriver(new Driver { DriverID = booking.DriverID }); driverActivity = new DriverActivityBO().GetDriverActivityByDriverID(new DriverActivity { DriverID = booking.DriverID }); } if (booking != null) { return(Ok(new { isConfirm = booking.IsConfirm, driverId = driverInfo.DriverID ?? "", vehicleNo = driverInfo.VehicleNo ?? "", driverName = driverInfo.DriverName ?? "", driverImage = "", MobileNo = driverInfo.MobileNo ?? "", latitude = driverActivity.CurrentLat, longitude = driverActivity.CurrentLong, OTP = booking.OTP, VehicleType = booking.VehicleType })); } else { return(NotFound()); } } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult StartTrip(Trip trip) { try { var result = new TripBO().SaveTrip(trip); if (result) { var customerObj = new CustomerBO().GetCustomer(new Customer { MobileNo = trip.CustomerMobile }); var driverActivity = new DriverActivity { DriverID = HeaderValueByKey("DRIVERID"), TokenNo = HeaderValueByKey("AUTH_TOKEN"), Latitude = Convert.ToDecimal(HeaderValueByKey("LATITUDE")), Longitude = Convert.ToDecimal(HeaderValueByKey("LONGITUDE")), IsLogIn = true, IsOnDuty = true }; new DriverActivityBO().DriverActivityUpdate(driverActivity); PushNotification(customerObj.DeviceID, "", UTILITY.NotifyTripStart); return(Ok(new { tripID = trip.TripID, message = UTILITY.SUCCESSMSG })); } else { return(BadRequest()); } } catch (Exception ex) { return(InternalServerError(ex)); } }
void InitDictionary() { driverActivities = new Dictionary <string, DriverActivity>(); driverBehaviors.ForEach(d => { string className = d.GetType().Name; DriverActivity activity = new DriverActivity(); activity.behaviorName = d.behaviorName; driverActivities.Add(className, activity); d.maxValueChanged.AddListener(args => { DriverBehavior driverBehavior = (DriverBehavior)args.sender; activity.maxValue = driverBehavior.maxValue; }); d.minValueChanged.AddListener(args => { DriverBehavior driverBehavior = (DriverBehavior)args.sender; activity.minValue = driverBehavior.minValue; }); d.avgValueChanged.AddListener(args => { DriverBehavior driverBehavior = (DriverBehavior)args.sender; activity.avgValue = driverBehavior.avg; }); d.ErrorOccurred.AddListener(args => { DriverBehavior driverBehavior = (DriverBehavior)args.sender; activity.missteps.Add(new DriverMisstep(driverBehavior.CurrentValue, driverBehavior.diffValue, new Vector3(0, 0, 0), Quaternion.identity)); activity.errorsCount = driverBehavior.errorsCount; }); }); }
public IHttpActionResult DriverLogOut() { try { var driverActivity = new DriverActivity { DriverId = HeaderValueByKey("DRIVERID"), TokenNo = HeaderValueByKey("AUTH_TOKEN"), Latitude = Convert.ToDecimal(HeaderValueByKey("LATITUDE")), Longitude = Convert.ToDecimal(HeaderValueByKey("LONGITUDE")), IsLogIn = false, IsOnDuty = false }; var result = new DriverActivityBO().DriverActivityUpdate(driverActivity); return(Ok(result ? UTILITY.LOGOUT : UTILITY.FAILEDMSG)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult UpdateDriverDutyStatus(bool status, bool isintrip, string tripID) { try { var driverActivity = new DriverActivity { DriverId = HeaderValueByKey("DRIVERID"), TokenNo = HeaderValueByKey("AUTH_TOKEN"), Latitude = Convert.ToDecimal(HeaderValueByKey("LATITUDE")), Longitude = Convert.ToDecimal(HeaderValueByKey("LONGITUDE")), IsLogIn = true, IsOnDuty = status }; var driverActivityObj = new DriverActivity(); if (isintrip) { driverActivityObj = new DriverActivityBO().GetDriverActivity(new DriverActivity { TokenNo = HeaderValueByKey("AUTH_TOKEN"), DriverId = HeaderValueByKey("DRIVERID") }); var frmLatLong = driverActivityObj.CurrentLat.ToString() + "," + driverActivityObj.CurrentLong.ToString(); var toLatLong = driverActivity.Latitude + "," + driverActivity.Longitude; var distance = GetTravelTimeBetweenTwoLocations(frmLatLong, toLatLong).distance; new TripBO().TripUpdateTravelledDistance(tripID, distance); } var result = new DriverActivityBO().DriverActivityUpdate(driverActivity); return(Ok(result ? UTILITY.SUCCESSMSG : UTILITY.FAILEDMSG)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public bool DriverActivityUpdate(DriverActivity item) { return(driveractivityDAL.DriverActivityUpdate(item)); }
public DriverActivity GetDriverActivityByDriverID(DriverActivity item) { return((DriverActivity)driveractivityDAL.GetDriverActivityByDriverID <DriverActivity>(item)); }
public DriverActivity GetDriverActivity(DriverActivity item) { return((DriverActivity)driveractivityDAL.GetItem <DriverActivity>(item)); }
public bool DeleteDriverActivity(DriverActivity item) { return(driveractivityDAL.Delete(item)); }
public bool SaveDriverActivity(DriverActivity newItem) { return(driveractivityDAL.Save(newItem)); }
public bool AuthenticateDriver(DriverActivity item) { return(driveractivityDAL.AuthenticateDriver(item)); }