internal Models.LoginModel.ModifyUserresp ModifyUser(Models.LoginModel.ModifyUserreq req) { Models.LoginModel.ModifyUserresp rsp = new Models.LoginModel.ModifyUserresp(); rsp.apiError = new APIErrors(); rsp.apiError = ApiError_defs.err_Invalid_Request; if (req.iuser.sEmail != req.Email) { ITEntity ie = _storage.GetEntityByID(req.iuser.nEntityFK); ITEntity entity = _storage.UpdateEntity(ie, ie.sFname, ie.sMname, ie.sMother, ie.sLname, ie.sDOB, ie.jAge, ie.sEmail1, ie.sContact1, ie.sHouse, ie.sLocality, ie.sAddressLine, ie.sTaluka, ie.sDistrict, ie.sState, ie.sIdProof, ie.sIdProofPath, true); if (entity.sEmail1 != req.Email) { rsp.apiError = ApiError_defs.err_Nesting_Faliled; return(null); } } ITUser User = _storage.ModifyUser(req.iuser, req.Email, req.password); if (User != null) { // rsp.n = iUser.n; //Use if needed rsp.iuser = User; rsp.apiError = ApiError_defs.ok; } else { rsp.apiError.sErrorMessage = "Invalid Username or Password"; } return(rsp); }
ITEntity IStorageService.UpdateEntity(ITEntity iEntity, string sFname, string sMname, string sMother, string sLname, string sDOB, int jAge, string sEmail1, string sContact1, string sHouse, string sLocality, string sAddressLine, string sTaluka, string sDistrict, string sState, string sIdProof, string sIdProofPath, bool bcommit) { TEntity tEntity = (iEntity as OTEntity)._oMoniker; tEntity.sFname = sFname; tEntity.sMname = sMname; tEntity.sMother = sMother; tEntity.sLname = sLname; tEntity.sDOB = sDOB; tEntity.sState = sState; tEntity.jAge = jAge; tEntity.sEmail1 = sEmail1; tEntity.sContact1 = sContact1; tEntity.sHouse = sHouse; tEntity.sLocality = sLocality; tEntity.sAddressLine = sAddressLine; tEntity.sTaluka = sTaluka; tEntity.sDistrict = sDistrict; tEntity.sIdProof = sIdProof; tEntity.sIdProofPath = sIdProofPath; tEntity.dStamp = DateTime.UtcNow; if (bcommit) { CommitToDB(); } return(new OTEntity(tEntity)); }
internal Models.GuardianModel.GetGuardianResp GetParent(Models.GuardianModel.GetGuardianReq req) { Models.GuardianModel.GetGuardianResp rsp = new Models.GuardianModel.GetGuardianResp(); rsp.apiError = new APIErrors(); rsp.apiError = ApiError_defs.err_Nesting_Faliled; ITGuardian IGuard = _storage.GetParent(req.studentPK); //Added Entity if (IGuard != null && IGuard.n > 0) { rsp.parent = new Models.GuardianModel.Relative(); rsp.apiError = ApiError_defs.ok; ITEntity parent = _storage.GetEntityByID(IGuard.nEntityFKParent); rsp.parent.sFname = parent.sFname; rsp.parent.sMname = parent.sMname; rsp.parent.sLname = parent.sLname; rsp.parent.nRelativeId = parent.n; rsp.parent.nRecordId = IGuard.n; } else { rsp.apiError.sErrorMessage = "Unable to get parent"; } return(rsp); }
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); }
ITEntity IStorageService.GetEntityByID(long n) { ITEntity iEntity = null; TEntity tEntity = _Sb.TEntities.FirstOrDefault(obj => obj.n == n); // TEntity tentity = _Sb.TEntities.Where(obj => obj.n == n).FirstOrDefault(); // var tEntity = (TEntity)from te in _Sb.TEntities where te.n == n select te; if (tEntity != null) { iEntity = new OTEntity(tEntity); } return(iEntity); }
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); }