示例#1
0
  @RequestMapping(value = "/srch", method = RequestMethod.GET)
  public @ResponseBody JqGridData<?> getCourseDetails(ScorecardPage sp, BindingResult result) {
    // logger.info("Comes inside with searlize object" + sp.getTeetype());
    // logger.info("Comes inside with searlize object" + p.getGender());
    // logger.info("Comes inside with searlize object" + p.getPlayer_id());

    //		    this.sv.validate(sp, result);
    //
    //		    if (result.hasErrors())
    //		    {
    //		    	logger.info("Scorecard has errors");
    //		    	List<ObjectError> obj;
    //			    obj = result.getAllErrors();
    //			    JqGridData<GolfCourseHolesMap> errorData = new
    // JqGridData<GolfCourseHolesMap>(numberOfRows, pageNumber, totalNumberOfRecords,null,obj );
    //		    	return errorData;
    //		    }

    List<GolfCourseHolesMap> courseDetails =
        this.playerManager.getcoursedetails(
            sp.getGolfcourse(), sp.getTeetype(), p.getGender(), p.getPlayer_id());
    numberOfRows = courseDetails.size();
    pageNumber = 1;
    totalNumberOfRecords = courseDetails.size();

    JqGridData<GolfCourseHolesMap> gridData =
        new JqGridData<GolfCourseHolesMap>(
            numberOfRows, pageNumber, totalNumberOfRecords, courseDetails);
    return gridData;
  }
示例#2
0
 @RequestMapping(
     value = "/teetype/{golfcourse}",
     method = RequestMethod.GET,
     produces = "application/json")
 public @ResponseBody List<GolfCourseDetails> getTeeTypes(@PathVariable int golfcourse) {
   logger.info("golfcourse selected is : " + golfcourse);
   List<GolfCourseDetails> gd = this.playerManager.getTeeTypes(golfcourse, p.getGender());
   logger.info("Done getting Tee Types for Golfcourse : " + golfcourse);
   return gd;
 }
示例#3
0
  @RequestMapping(value = "/save", method = RequestMethod.POST)
  public @ResponseBody String saveScore(HttpServletRequest req) {
    logger.info("player result req : " + req.getParameter("playerResult_id"));
    int pr_id;
    try {
      pr_id = Integer.parseInt(req.getParameter("playerResult_id"));
    } catch (Exception ex) {
      pr_id = 0;
    }
    // String playerScore = c1 + ',' + c2 + ',' + c3 + ',' + c4 + ',' + c5 + ',' + c6 + ',' + c7 +
    // ',' + c8 + ',' + c9 + ',' + c10 + ',' + c11 + ',' + c12 + ',' + c13 + ',' + c14 + ',' + c15 +
    // ',' + c16 + ',' + c17 + ',' + c18;

    String playerScore =
        req.getParameter("col_1")
            + ','
            + req.getParameter("col_2")
            + ','
            + req.getParameter("col_3")
            + ','
            + req.getParameter("col_4")
            + ','
            + req.getParameter("col_5")
            + ','
            + req.getParameter("col_6")
            + ','
            + req.getParameter("col_7")
            + ','
            + req.getParameter("col_8")
            + ','
            + req.getParameter("col_9")
            + ','
            + req.getParameter("col_10")
            + ','
            + req.getParameter("col_11")
            + ','
            + req.getParameter("col_12")
            + ','
            + req.getParameter("col_13")
            + ','
            + req.getParameter("col_14")
            + ','
            + req.getParameter("col_15")
            + ','
            + req.getParameter("col_16")
            + ','
            + req.getParameter("col_17")
            + ','
            + req.getParameter("col_18");

    logger.info("Check http Request options + " + playerScore);

    if (pr_id != 0) {
      logger.info("Inside update scorecard");
      return this.playerManager.updateScorecard(pr_id, playerScore);
    } else {
      int golfCourse_id = Integer.parseInt(req.getParameter("gc_id"));
      int golfCourseDetail_id = Integer.parseInt(req.getParameter("gcd_id"));
      String play_date = req.getParameter("date_played");
      String play_time = req.getParameter("time_played");
      logger.info("play date: " + play_date + "Play Time: " + play_time);
      return this.playerManager.addPlayerScorecard(
          p.getPlayer_id(), golfCourse_id, golfCourseDetail_id, play_date, playerScore, play_time);
    }
  }