@RequestMapping(value = "/getStates", method = RequestMethod.GET) @ResponseBody public String getStates() { HashMap<String, Object> resultMap = new HashMap<String, Object>(); try { List<States> states = addressDetailsDAO.getStates(); resultMap = util.responseBuilderCustom(states); } catch (Exception e) { e.printStackTrace(); } return util.getJsonResult(resultMap); }
@RequestMapping(value = "/getCities", method = RequestMethod.GET) @ResponseBody public String getCities(HttpSession session, HttpServletRequest request) { HashMap<String, Object> resultMap = new HashMap<String, Object>(); String stateCode = request.getParameter("stateCode"); try { List<String> cities = addressDetailsDAO.getCities(stateCode); resultMap = util.responseBuilderCustom(cities); } catch (Exception e) { e.printStackTrace(); } return util.getJsonResult(resultMap); }
@RequestMapping(value = "/getAddressDetails", method = RequestMethod.POST) @ResponseBody public String getAddressDetails( HttpSession session, @RequestParam(value = "moduleId") Long moduleId, @RequestParam(value = "moduleName") String moduleName) { HashMap<Object, Object> map = new HashMap<Object, Object>(); try { ArrayList<AddressDetails> allAddressDetails = addressDetailsDAO.getAddressDetails(moduleId, moduleName.toUpperCase()); map.put("allAddressDetails", allAddressDetails); } catch (Exception e) { map = util.handleException(map, e); } return util.getJsonResult(map); }
@Override public String deleteCustomer(HttpServletRequest request, UserDetail userDetails) throws Exception { int compId = 0; String result = ""; try { if (request.getParameter("compIdToDel") != null && request.getParameter("compIdToDel") != "") { compId = Integer.parseInt(request.getParameter("compIdToDel").trim()); result = customerDetailsDAO.setCustomerDelete(compId); result = addressDetailsDAO.setDeleteAddressByUser(compId, userDetails); } else { result = "Cannot Find The Company To Delete. Please refresh the page and try again."; } return result; } catch (Exception e) { e.printStackTrace(); throw e; } }
@RequestMapping(value = "/deleteAddress", method = RequestMethod.POST) @ResponseBody public String deleteAddress( HttpSession session, HttpServletRequest request, @RequestParam(value = "moduleId") String jobId) { HashMap<Object, Object> resultMap = new HashMap<Object, Object>(); try { Integer moduleId = null; if (null != jobId && !jobId.trim().isEmpty()) { moduleId = Integer.valueOf(jobId); UserDetail userDetails = (UserDetail) session.getAttribute("selectedUser"); String result = addressDetailsDAO.setDeleteAddressByUser(moduleId, userDetails); resultMap = util.responseBuilder(result); } } catch (Exception e) { e.printStackTrace(); util.handleException(resultMap, e); } return util.getJsonResult(resultMap); }