private void checkOutJButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_checkOutJButtonActionPerformed // TODO add your handling code here: Order o = moc.addOrder(order); // customer.addOrder(order); OrderWorkRequest owr = new OrderWorkRequest(); owr.setOrder(order); owr.setSender(userAccount); owr.setStatus(WorkRequest.Status.SENT.getValue()); userAccount.getWorkQueue().getWorkRequests().add(owr); for (Organization orgn : business.getOrganizationDirectory().getOrganizationDirectory()) { if (orgn instanceof SalesSpecialistOrganization) { orgn.getWorkQueue().getWorkRequests().add(owr); } } if (o != null) { setSoldQuantity(); JOptionPane.showMessageDialog(null, "You have successfully checked out.!!"); } else { JOptionPane.showMessageDialog(null, "Checked out Errrr.!!"); return; } isCheckedOut = true; order = new Order(); txtModifyQuantity.setText(""); populateOrderItemTable(); populateProductTable(); } // GEN-LAST:event_checkOutJButtonActionPerformed
public static void getNexts() { List<Creativo> creativos = Creativo.find("rank = 0").fetch(); List<Business> business = Business.find("rank = 0").fetch(); render(creativos, business); }
// Now on ClientVip public void sellProductToClientVip(ClientVip cv, Product p, int password) { if (password == cv.getInfo().getPassword() && p.getAmount() > 0) { cv.setCredit(cv.getCredit() - (p.getPrice() * cv.getDiscount())); p.setAmount(p.getAmount() - 1); Business.sendMessage( cv, "Dear " + cv.getInfo().getFirstName() + " you the bought the item " + p.getName()); } }
/** @param args */ public static void main(String[] args) { final Business business = new Business(); new Thread( new Runnable() { public void run() { for (int i = 1; i <= 50; i++) { business.sub(i); } } }) .start(); for (int i = 1; i <= 50; i++) { business.main(i); } }
/** @param args */ public static void main(String[] args) throws Exception { Registry registry = LocateRegistry.getRegistry("localhost"); String name = "BusinessDemo"; Business business = (Business) registry.lookup(name); BufferedReader systemIn = new BufferedReader(new InputStreamReader(System.in)); while (true) { String command = systemIn.readLine(); if (command == null || "quit".equalsIgnoreCase(command.trim())) { System.out.println("Client quit!"); try { business.echo(command); } catch (Exception e) { // IGNORE } System.exit(0); } System.out.println(business.echo(command)); } }
@SuppressWarnings("unchecked") @RequestMapping(value = "/map", method = RequestMethod.POST) @ResponseBody public JSONArray mapPost(@ModelAttribute Business biz, Model model) { JSONArray jsonArr = new JSONArray(); JSONObject tmpJson = new JSONObject(); model.addAttribute("biz", biz); biz.setCoordinatesGoogle(); if (biz.isNull()) { thefacade.getGoogleAPIResults(businesses); listOfBusinesses = thefacade.getResults(); // add businesses to array of JSONs for (int i = 0; i < listOfBusinesses.size(); i++) { // re-init tmp JSON Object tmpJson = new JSONObject(); // add attributes tmpJson.put("name", listOfBusinesses.get(i).getName()); tmpJson.put("address", listOfBusinesses.get(i).getAddress()); tmpJson.put("phone", listOfBusinesses.get(i).formatPhoneNumber()); tmpJson.put("rating", listOfBusinesses.get(i).getAverageRating()); tmpJson.put("lat", listOfBusinesses.get(i).getCoordinates().getLatitude()); tmpJson.put("lng", listOfBusinesses.get(i).getCoordinates().getLongitude()); tmpJson.put("website", listOfBusinesses.get(i).getWebsite()); tmpJson.put("openStatus", listOfBusinesses.get(i).getOpenStatus()); // add JSON Object to array jsonArr.add(tmpJson); } // clear list of businesses businesses.clear(); listOfBusinesses.clear(); } else { businesses.add(biz); } return jsonArr; }
public static void postDate(String code, String userId, int rank) { Logger.info(code); Logger.info(userId); Logger.info("" + rank); if (code.equals(Business.BUSINESS)) { Business b = Business.findById(userId); b.rank = rank; b.save(); } else if (code.equals(Developer.DEVELOPER)) { Developer d = Developer.findById(userId); d.rank = rank; d.save(); } else if (code.equals(Creativo.CREATIVO)) { Creativo c = Creativo.findById(userId); c.rank = rank; c.save(); } render(); }
/** Creates new form BrowseProductJPanel */ public BrowseProductJPanel( JPanel userProcessContainer, Business business, UserAccount userAccount) { initComponents(); this.business = business; this.userProcessContainer = userProcessContainer; this.moc = business.getMasterOrderCatalog(); this.customer = (Customer) userAccount.getEmployee(); this.userAccount = userAccount; for (Organization o : business.getOrganizationDirectory().getOrganizationDirectory()) { if (o.getOrganizationName().equals(Organization.TypeOfOrg.Supplier.getValue())) { employeeDirectory = o.getEmployeeDirectory(); } } customerName.setText("Welcome :" + customer.getName()); if (!isCheckedOut) { order = new Order(); } populateSupplierCombox(); populateProductTable(); }
public static Business initializeBusiness() { Business business = Business.getInstance(); // create an Employee Employee emp = business.getEmployeeDirectory().addEmployee(); emp.setFirstName("Hari"); emp.setLastName("Panjwani"); emp.setOrganization("NEU"); // add a user account UserAccount userAccount = business.getUserAccountDirectory().addUserAccount(); userAccount.setUserName("admin"); userAccount.setPassword("admin"); userAccount.setIsActive("Yes"); userAccount.setPerson(emp); userAccount.setRole(UserAccount.ADMIN_ROLE); return business; }
@Override public void onClick(View v) { if (v.getId() == R.id.buttonLogin) { String email = editTextEmail.getText().toString(); String password = editTextPassword.getText().toString(); String deviceName = editTextDeviceName.getText().toString(); if (email.isEmpty() || password.isEmpty()) { Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_SHORT).show(); return; } if (email.equals("*****@*****.**")) { Business.setBackground(R.drawable.goldbg); } else { Business.setBackground(R.drawable.bg); } // Start AsyncTask. dialog = ProgressDialog.show(this, "", "Loging in..."); dialog.setCanceledOnTouchOutside(false); new BusinessLoginAsyncTask(email, password, this).execute(); } }
public static void getRank() { List<Creativo> creativos = Creativo.find("rank <> 0 order by rank desc").fetch(); List<Business> business = Business.find("rank <> 0 order by rank desc").fetch(); render(creativos, business); }