internal Models.DriverBus.editBusDriverresp editBusDriver(Models.DriverBus.editBusDriverreq req) { Models.DriverBus.editBusDriverresp rsp = new Models.DriverBus.editBusDriverresp(); ITDriver_Bus driverBus = _storage.GetDriverBusbyId(req.DriverBusId); rsp.apiError = new APIErrors(); ITDriver_Bus driverBus1 = _storage.editBusDriver(driverBus, req.nEntityId, req.nBusFK, req.bStatus); //Added Entity if (driverBus1 != null && driverBus1.n > 0 && driverBus1.nBusFK == req.nBusFK && driverBus1.nEntityFKDrvier == req.nEntityId) { rsp.apiError = ApiError_defs.ok; rsp.nEntityId = driverBus1.nEntityFKDrvier; ITEntity driver = _storage.GetEntityByID(driverBus1.nEntityFKDrvier); rsp.sFname = driver.sFname; rsp.sMname = driver.sMname; rsp.sLname = driver.sLname; ITBus bus = _storage.GetBusById(driverBus1.nBusFK); rsp.sRegNo = bus.sRegNo; rsp.nBusId = bus.n; } else { rsp.apiError = ApiError_defs.err_Invalid_Request; rsp.apiError.sErrorMessage = "Unable to Update"; } return(rsp); }
//DriverBus models internal Models.DriverBus.MapBustoDriverResp MapDriver(Models.DriverBus.MapBustoDriverReq req) { Models.DriverBus.MapBustoDriverResp rsp = new Models.DriverBus.MapBustoDriverResp(); ITDriver_Bus driverBus = _storage.MapDriver(req.nEntityId, req.nBusFK); rsp.apiError = new APIErrors(); //Added Entity if (driverBus != null && driverBus.n > 0) { rsp.apiError = ApiError_defs.ok; rsp.n = driverBus.n; } else { //rsp.apiError = ApiError_defs.err_Invalid_Request; driverBus = _storage.editBusDriver(_storage.getBusOfDriver(req.nEntityId), req.nEntityId, req.nBusFK, true); if (driverBus != null && driverBus.n > 0) { rsp.apiError = ApiError_defs.ok; rsp.apiError.sErrorMessage = "Another driver to Bus allocation needed to manipulate. Mapping Successful"; rsp.n = driverBus.n; } rsp.apiError.sErrorMessage = "Unable to map driver. Bus may be already assigned"; } return(rsp); }
internal Models.DriverBus.getBusOfDriverResp getBusOfDriver(Models.DriverBus.getBusOfDriverReq req) { Models.DriverBus.getBusOfDriverResp rsp = new Models.DriverBus.getBusOfDriverResp(); ITDriver_Bus driverBus = _storage.getBusOfDriver(req.nEntityId); rsp.apiError = new APIErrors(); //Added Entity if (driverBus != null && driverBus.n > 0) { rsp.apiError = ApiError_defs.ok; ITBus bus = _storage.GetBusById(driverBus.nBusFK); rsp.nDriverBusId = driverBus.n; rsp.sRegNo = bus.sRegNo; } else { rsp.apiError = ApiError_defs.err_Invalid_Request; rsp.apiError.sErrorMessage = "Unable to get bus"; } return(rsp); }
internal Models.DriverBus.getDriverResp GetDriver(Models.DriverBus.getDriverReq req) { Models.DriverBus.getDriverResp rsp = new Models.DriverBus.getDriverResp(); ITDriver_Bus driverBus = _storage.GetDriver(req.nBusFK); rsp.apiError = new APIErrors(); rsp.apiError = ApiError_defs.err_Invalid_Request; //Added Entity if (driverBus != null && driverBus.n > 0) { rsp.apiError = ApiError_defs.ok; ITEntity driver = _storage.GetEntityByID(driverBus.nEntityFKDrvier); rsp.DriverBusId = driverBus.n; rsp.sFname = driver.sFname; rsp.sMname = driver.sMname; rsp.sLname = driver.sLname; } else { rsp.apiError.sErrorMessage = "Unable to get driver"; } return(rsp); }