Package org.sis.ancmessaging.domain

Examples of org.sis.ancmessaging.domain.HealthCenter


  @Autowired
  private HealthCenterService healthCenterService;
 
  @RequestMapping(value = "{id}", method = RequestMethod.GET)
  public String getMainPage(@PathVariable int id, Model model) {
    HealthCenter healthCenter = healthCenterService.findById(id);
    String telephone = healthCenter.getCenterPhone().substring(4);
    healthCenter.setCenterPhone(telephone);
    model.addAttribute("healthCenter", healthCenter);
    return "healthcenter";
  }
View Full Code Here


  @RequestMapping(value = "edithealthcenter", method = RequestMethod.POST)
  public @ResponseBody CustomGenericResponse editCenter(
    @RequestParam("centerId") int centerId,  @RequestParam("centerName") String centerName,
    @RequestParam("centerPhone") String centerPhone) {
   
    HealthCenter healthCenter = new HealthCenter();
    healthCenter.setCenterId(centerId);
    healthCenter.setCenterName(centerName);
    healthCenter.setCenterPhone(centerPhone);
   
    boolean result = healthCenterService.persist(healthCenter);
    CustomGenericResponse response = new CustomGenericResponse();
   
    if (result) {
View Full Code Here

  @Autowired
  private HealthCenterService healthCenterService;
 
  @RequestMapping(method = RequestMethod.GET)
  public String getMainPage(@RequestParam("pid") int pId, Model model) {
    HealthCenter healthCenter = healthCenterService.findById(pId);
    model.addAttribute("healthCenter", healthCenter);
    HealthPostDTO healthPostDTO = new HealthPostDTO();
    healthPostDTO.setCenterId(pId);
    model.addAttribute("healthPostDTO", healthPostDTO);
    return "healthpost";
View Full Code Here

      model.addAttribute("healthCenter", healthCenterService.findById(healthPostDTO.getCenterId()));
      model.addAttribute("healthPostDTO", healthPostDTO);
      return "healthpost";
    } else {
      HealthPost healthPost = healthPostDTO.generateHealthPost();
      HealthCenter healthCenter = healthCenterService.findById(healthPostDTO.getCenterId());
      healthCenterService.addHpToHc(healthCenter, healthPost);
      return "redirect:/admin/healthpost?pid=" + healthPostDTO.getCenterId();
    }
   
  }
View Full Code Here

  public boolean persist(HealthCenter healthCenter) {
    try {
      if (healthCenter.getCenterId() == 0) {
        healthCenterDao.save(healthCenter);
      } else {
        HealthCenter existingCenter = healthCenterDao.getById(healthCenter.getCenterId());
        existingCenter.setCenterName(healthCenter.getCenterName());
        existingCenter.setCenterPhone(healthCenter.getCenterPhone());
        healthCenterDao.update(existingCenter);
      }
      return true;
    } catch (Exception ex) {
      return false;
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Override
  public List<HealthPost> getPaginatedList(int centerId, int rows, int page, StringBuilder sb) {
    HealthCenter healthCenter = (HealthCenter) getSession().createCriteria(HealthCenter.class)
                               .add(Restrictions.eq("centerId", centerId))
                               .uniqueResult();
    int total = healthCenter.getHealthPosts().size();
    int totalPages;
    if (total <= rows) {
      totalPages = 1;
    } else {
      totalPages = total / rows;
View Full Code Here

TOP

Related Classes of org.sis.ancmessaging.domain.HealthCenter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.