// bhanu public List getBranchMasterList(String schoolID) { BranchMasterDAO branchMasterDao = null; List instList = new ArrayList(); List branchList = new ArrayList(); try { String im_id = (String) session.getAttribute("IM_ID"); Long sm_id = Long.parseLong(schoolID); branchMasterDao = (BranchMasterDAO) ServiceFinder.getContext(request).getBean("BranchMasterHibernateDao"); if (sm_id == 0) { instList = branchMasterDao.findByPropertyList("imId", im_id); } else if (sm_id > 0) { instList = branchMasterDao.getBranchList("imId", im_id, "smId", sm_id); } System.out.println("in getInstitutionMasterList" + im_id); System.out.println("in dwr ut--" + instList.size()); for (int i = 0; i < instList.size(); i++) { String[] oioio = new String[2]; BranchMaster ioio = (BranchMaster) instList.get(i); System.out.println("--90---" + ioio.getBranchName()); oioio[0] = ioio.getBmId() + ""; oioio[1] = ioio.getBranchName(); branchList.add(oioio); } return branchList; } catch (BeansException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }
public String saveBranchMaster( String schoolID, String sname, String shortName, String address, String city, String country, String br_state, String br_cperson, String bemail, String br_mobile, String br_landline, String isactive) { BranchMasterDAO bMasterDao = null; try { bMasterDao = (BranchMasterDAO) ServiceFinder.getContext(request).getBean("BranchMasterHibernateDao"); BranchMaster br = new BranchMaster(); System.out.println(isactive + "--isactive"); isactive = isactive.equalsIgnoreCase("true") ? "Y" : "N"; br.setActive(isactive); br.setLandline(br_landline); br.setMobile(br_mobile); br.setStateId(Long.parseLong(br_state)); br.setImId((String) session.getAttribute("IM_ID")); br.setSmId(Long.parseLong(schoolID)); br.setBranchName(sname); br.setShortName(shortName); br.setAddress(address); br.setCity(city); br.setStateId(new Long(br_state)); br.setContactPerson(br_cperson); br.setEmailId(bemail); bMasterDao.save(br); return "saved"; } catch (BeansException e) { // TODO Auto-generated catch block e.printStackTrace(); return "error"; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return "error"; } }
// bhanu public List getMultiBranchMasterList(String[] schoolID) { BranchMasterDAO branchMasterDao = null; List instList = new ArrayList(); List branchList = new ArrayList(); try { StringBuffer inString = new StringBuffer(); // in('2','3') for (int i = 0; i < schoolID.length; i++) { if (schoolID[i].equalsIgnoreCase("0")) { inString = new StringBuffer("0"); break; } inString.append(schoolID[i]); if (i < schoolID.length - 1) inString.append(","); } // System.out.println("inString**********"+inString); String inQuery = inString + ""; String im_id = (String) session.getAttribute("IM_ID"); Long sm_id = Long.parseLong(schoolID[0]); branchMasterDao = (BranchMasterDAO) ServiceFinder.getContext(request).getBean("BranchMasterHibernateDao"); if (inQuery.equalsIgnoreCase("0")) { instList = branchMasterDao.findByPropertyList("imId", im_id); for (int i = 0; i < instList.size(); i++) { String[] oioio = new String[2]; BranchMaster ioio = (BranchMaster) instList.get(i); System.out.println("--90---" + ioio.getBranchName()); oioio[0] = ioio.getBmId() + ""; oioio[1] = ioio.getBranchName(); System.out.println(oioio[0] + "*************" + oioio[1]); branchList.add(oioio); } } else { instList = branchMasterDao.getMultiBranchList(im_id, inQuery); for (int i = 0; i < instList.size(); i++) { String[] oioio = new String[2]; System.out.println(instList.size() + "^^^^^^^^^^^^^"); Object[] uu = (Object[]) instList.get(i); oioio[0] = (String) uu[0]; oioio[1] = (String) uu[1]; System.out.println(instList.size() + "@@" + oioio[0] + "**" + oioio[1]); branchList.add(oioio); } } // System.out.println("in getInstitutionMasterList"+im_id); // System.out.println("in dwr ut--"+instList.size()); return branchList; } catch (BeansException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }