/** 增加账户信息 */ public void addAccount(AccountVO accountvo) { try { DatabaseFactory database = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); InformationFactory inf = database.getInformationFactory(); InformationInsertDataService infoinsert = inf.getInformationInsertData(); AccountPO ap = new AccountPO(accountvo.getId(), accountvo.getPassword(), accountvo.getBalance()); infoinsert.insert(ap); } catch (Exception e) { e.printStackTrace(); } }
/** 增加机构信息 */ public void addInstitution(InstitutionVO institutionvo) { try { DatabaseFactory database = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); InformationFactory inf = database.getInformationFactory(); InformationInsertDataService infoinsert = inf.getInformationInsertData(); InstitutionPO ip = new InstitutionPO(institutionvo.getID(), institutionvo.getLocation()); infoinsert.insert(ip); } catch (MalformedURLException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } }
/** 增加车辆信息 */ public void addVehicle(VehicleVO vehiclevo) { try { DatabaseFactory database = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); InformationFactory inf = database.getInformationFactory(); InformationInsertDataService infoinsert = inf.getInformationInsertData(); VehiclePO vp = new VehiclePO( vehiclevo.getId(), vehiclevo.getPlateNumber(), vehiclevo.getWorkTime(), vehiclevo.getImage()); infoinsert.insert(vp); } catch (Exception e) { e.printStackTrace(); } }
/** 增加人员薪水信息 */ public void addSalary(SalaryVO salaryvo) { try { DatabaseFactory database = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); InformationFactory inf = database.getInformationFactory(); InformationInsertDataService infoinsert = inf.getInformationInsertData(); SalaryPO sp = new SalaryPO( salaryvo.getId(), salaryvo.getInstitution(), salaryvo.getName(), salaryvo.getSalary()); infoinsert.insert(sp); } catch (Exception e) { e.printStackTrace(); } }
/** 增加人员信息 */ public void addStaff(UserVO uservo) { try { DatabaseFactory database = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); InformationFactory inf = database.getInformationFactory(); InformationInsertDataService infoinsert = inf.getInformationInsertData(); UserPO sp = new UserPO( uservo.getId(), uservo.getPassword(), uservo.getRole(), uservo.getName(), uservo.getInstitution()); infoinsert.insert(sp); } catch (Exception e) { e.printStackTrace(); } }
/** 增加司机信息 */ public void addDriver(DriverVO drivervo) { try { DatabaseFactory database = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); InformationFactory inf = database.getInformationFactory(); InformationInsertDataService infoinsert = inf.getInformationInsertData(); DriverPO dp = new DriverPO( drivervo.getId(), drivervo.getName(), drivervo.getDateOfBirth(), drivervo.getIDcardNumber(), drivervo.getPhoneNumber(), drivervo.getDrivingPeriod(), drivervo.getGender()); infoinsert.insert(dp); } catch (Exception e) { e.printStackTrace(); } }
/** * 获得价格数据服务 * * @return PriceDataService */ private PriceDataService getService() { PriceDataService priceDataService = null; try { // 获得数据库的引用 DatabaseFactory databaseFactory = (DatabaseFactory) Naming.lookup(RMIConnect.RMI); FinanceFactory financeFactory = databaseFactory.getFinanceFactory(); priceDataService = financeFactory.getPriceDataService(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } return priceDataService; }