-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20292a4
commit b3114fd
Showing
6 changed files
with
255 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
bookticket/src/main/java/com/ticketbooking/bookticket/controller/NotificationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.ticketbooking.bookticket.controller; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.mail.MailException; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.servlet.ModelAndView; | ||
|
||
import com.ticketbooking.bookticket.service.NotificationService; | ||
|
||
@Controller | ||
public class NotificationController { | ||
|
||
@Autowired | ||
NotificationService notificationService; | ||
|
||
@Autowired | ||
SeatController seatController; | ||
|
||
@Autowired | ||
TheatreController theatreController; | ||
|
||
private Logger logger=LoggerFactory.getLogger(AuthenticationController.class); | ||
|
||
private String email; | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
@RequestMapping(value = "/mail", method = RequestMethod.GET) | ||
public ModelAndView mail() { | ||
ModelAndView modelAndView=new ModelAndView(); | ||
modelAndView.addObject("email",email); | ||
modelAndView.setViewName("mail"); | ||
return modelAndView; | ||
} | ||
|
||
@RequestMapping(value = "/notif", method = RequestMethod.POST) | ||
public ModelAndView notif(@RequestParam("email") String e,ModelAndView modelAndView) { | ||
//ModelAndView modelAndView=new ModelAndView(); | ||
email=e; | ||
try { | ||
notificationService.sendNotification(email,seatController.getNum(),theatreController.getM_name(),seatController.getTheatre_name()); | ||
}catch(MailException g) { | ||
logger.info("Error sending mail: "+g.getMessage()); | ||
} | ||
modelAndView.setViewName("notif"); // resources/template/home.html | ||
return modelAndView; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
bookticket/src/main/java/com/ticketbooking/bookticket/controller/PaymentController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.ticketbooking.bookticket.controller; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.servlet.ModelAndView; | ||
|
||
@Controller | ||
public class PaymentController { | ||
|
||
@Autowired | ||
SeatController seatController; | ||
|
||
@RequestMapping(value = "/pay", method = RequestMethod.GET) | ||
public ModelAndView payment(@RequestParam(value="t",required=false) String t,ModelAndView modelAndView) { | ||
//ModelAndView modelAndView=new ModelAndView(); | ||
int p=seatController.getNum()*120; | ||
modelAndView.addObject("total",seatController.getNum()); | ||
modelAndView.addObject("price",p); | ||
modelAndView.setViewName("pay"); | ||
return modelAndView; | ||
} | ||
|
||
@RequestMapping(value = "/gate", method = RequestMethod.GET) | ||
public ModelAndView gateway() { | ||
ModelAndView modelAndView=new ModelAndView(); | ||
modelAndView.setViewName("gate"); | ||
return modelAndView; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
bookticket/src/main/java/com/ticketbooking/bookticket/controller/SeatController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.ticketbooking.bookticket.controller; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.servlet.ModelAndView; | ||
import com.ticketbooking.bookticket.service.SeatService; | ||
import com.ticketbooking.bookticket.service.TheatreService; | ||
|
||
@Controller | ||
public class SeatController { | ||
|
||
private Logger logger=LoggerFactory.getLogger(AuthenticationController.class); | ||
|
||
@Autowired | ||
TheatreService theatreService; | ||
|
||
@Autowired | ||
SeatService seatService; | ||
|
||
private String theatre_name; | ||
private int num; | ||
|
||
public String getTheatre_name() { | ||
return theatre_name; | ||
} | ||
|
||
public int getNum() { | ||
return num; | ||
} | ||
|
||
@RequestMapping(value="/seats",method=RequestMethod.POST) | ||
public synchronized ModelAndView seats(@RequestParam(value="num",required=false) Integer n,ModelAndView modelAndView) { | ||
try { | ||
num=n; | ||
logger.info("in seats method"); | ||
modelAndView.setViewName("seats"); | ||
}catch(Exception e) { | ||
logger.info("Error in seat method: "+e.getMessage()); | ||
} | ||
return modelAndView; | ||
} | ||
|
||
@RequestMapping(value = "/outp", method = RequestMethod.POST) | ||
public ModelAndView outp(@RequestParam("theater") String t,ModelAndView modelAndView) { | ||
theatre_name=t; | ||
modelAndView.addObject("num",num); | ||
modelAndView.setViewName("outp"); | ||
return modelAndView; | ||
} | ||
|
||
@RequestMapping(value = "/confirm", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) | ||
public @ResponseBody int confirm(@RequestBody String[] ids) { | ||
logger.info("in confirm method 1"); | ||
int tid=theatreService.getTID(theatre_name); | ||
seatService.insert(ids,tid); | ||
logger.info("in confirm method 2"); | ||
return ids.length; | ||
} | ||
} | ||
|
55 changes: 55 additions & 0 deletions
55
bookticket/src/main/java/com/ticketbooking/bookticket/controller/TheatreController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.ticketbooking.bookticket.controller; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.servlet.ModelAndView; | ||
|
||
import com.ticketbooking.bookticket.service.TheatreService; | ||
|
||
@Controller | ||
public class TheatreController { | ||
|
||
@Autowired | ||
TheatreService theatreService; | ||
|
||
private String city; | ||
private String m_name; | ||
|
||
|
||
public String getCity() { | ||
return city; | ||
} | ||
|
||
public String getM_name() { | ||
return m_name; | ||
} | ||
|
||
@RequestMapping(value = "/place" , method=RequestMethod.GET) | ||
public ModelAndView home() { | ||
ModelAndView modelAndView=new ModelAndView(); | ||
//city=c; | ||
modelAndView.addObject("city",city); | ||
modelAndView.setViewName("place"); | ||
return modelAndView; | ||
} | ||
|
||
@RequestMapping(value = "/movies", method = RequestMethod.POST) | ||
public ModelAndView movies(@RequestParam("city") String c,ModelAndView modelAndView) { | ||
//ModelAndView modelAndView=new ModelAndView(); | ||
city=c; | ||
modelAndView.addObject("movies",theatreService.getMovies(city)); | ||
modelAndView.setViewName("movies"); | ||
return modelAndView; | ||
} | ||
|
||
@RequestMapping(value = "/theatres", method = RequestMethod.POST) | ||
public ModelAndView theatres(@RequestParam("m_name") String m,ModelAndView modelAndView) { | ||
m_name=m; | ||
modelAndView.addObject("m_name",theatreService.getTheatres(m_name, city)); | ||
modelAndView.setViewName("theatres"); | ||
return modelAndView; | ||
} | ||
} |
Oops, something went wrong.