示例#1
0
        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);
        }
示例#2
0
        ITBus IStorageService.getBusbyReg(string regNo)
        {
            ITBus iBus = null;

            TBus tBus = _Sb.TBus.FirstOrDefault(obj => obj.sRegNo == regNo);

            if (tBus != null)
            {
                iBus = new OTBus(tBus) as ITBus;
            }
            return(iBus);
        }
示例#3
0
        ITBus IStorageService.GetBusById(long n)
        {
            ITBus iBus = null;

            TBus tBus = _Sb.TBus.FirstOrDefault(obj => obj.n == n);

            if (tBus != null)
            {
                iBus = new OTBus(tBus) as ITBus;
            }
            return(iBus);
        }
        internal TBusModal.GetBusByIdResp GetBusById(TBusModal.GetBusByIdReq req)
        {
            TBusModal.GetBusByIdResp rsp = new TBusModal.GetBusByIdResp();
            rsp.apiError = new APIErrors();
            rsp.apiError = ApiError_defs.err_Invalid_Request;
            ITBus iBus = _storage.GetBusById(req.nBusId);

            if (iBus != null)
            {
                rsp.sRegNo    = iBus.sRegNo;
                rsp.jCapacity = iBus.jCapacity;
                rsp.apiError  = ApiError_defs.ok;
            }
            return(rsp);
        }
示例#5
0
        ITBus IStorageService.ModifyBus(ITBus iBus, string sRegNo, int jOccupied, bool fCommitNow)
        {
            TBus tBus = (iBus as OTBus)._oMoniker;

            tBus.sRegNo    = sRegNo;
            tBus.jCapacity = jOccupied;
            OTBus objBus = new OTBus(tBus);

            if (fCommitNow)
            {
                _Sb.SubmitChanges();
            }

            return(objBus);
        }
        internal TBusModal.AddBusRsp AddBus(TBusModal.AddBusReq req)
        {
            TBusModal.AddBusRsp rsp = new TBusModal.AddBusRsp();
            rsp.apiError = new APIErrors();
            rsp.apiError = ApiError_defs.err_Invalid_Request;
            ITBus ibus = _storage.AddBus(req.sRegNo, req.jCapacity, true);

            if (ibus != null && ibus.n > 0)
            {
                rsp.nBusId   = ibus.n;
                rsp.apiError = ApiError_defs.ok;
            }
            else
            {
                rsp.apiError.sErrorMessage = "Unable to add bus";
            }

            return(rsp);
        }
示例#7
0
        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 TBusModal.ModifyBusResp ModifyBus(TBusModal.ModifyBusReq req)
        {
            TBusModal.ModifyBusResp rsp = new TBusModal.ModifyBusResp();
            rsp.apiError = new APIErrors();
            rsp.apiError = ApiError_defs.err_Invalid_Request;
            ITBus bus  = _storage.GetBusById(req.nBusId);
            ITBus ibus = _storage.ModifyBus(bus, req.sRegNo, req.jCapacity, true);

            if (ibus != null)
            {
                rsp.nBusId    = ibus.n;
                rsp.jCapacity = ibus.jCapacity;
                rsp.sRegNo    = ibus.sRegNo;
                rsp.apiError  = ApiError_defs.ok;
            }
            else
            {
                rsp.apiError.sErrorMessage = "Unable to add bus";
            }

            return(rsp);
        }