This repository has been archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from bakaqc/dev
Merge DEV
- Loading branch information
Showing
149 changed files
with
27,062 additions
and
250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: 'Build with Maven' | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
name: 'Build with Maven' | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: 'Checkout repository' | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Set up JDK 8' | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
architecture: 'x64' | ||
|
||
- name: 'Build project with Maven' | ||
run: mvn verify |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/bakaqc/flower/controller/AboutController.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,28 @@ | ||
package com.bakaqc.flower.controller; | ||
|
||
import com.bakaqc.flower.dao.CategoriesDAO; | ||
import com.bakaqc.flower.model.Categories; | ||
import java.io.*; | ||
import java.util.List; | ||
import javax.servlet.*; | ||
import javax.servlet.http.*; | ||
|
||
public class AboutController extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
List<Categories> listCAT = CategoriesDAO.getInstance().selectAll(); | ||
|
||
request.setAttribute("listCAT", listCAT); | ||
request.getRequestDispatcher("/view/about.jsp").forward(request, response); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/bakaqc/flower/controller/AddToCartController.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,45 @@ | ||
package com.bakaqc.flower.controller; | ||
|
||
import java.io.*; | ||
import java.util.*; | ||
import javax.servlet.*; | ||
import javax.servlet.annotation.*; | ||
import javax.servlet.http.*; | ||
|
||
@WebServlet(name = "AddToCartController", urlPatterns = {"/addcart"}) | ||
public class AddToCartController extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
|
||
int pid = Integer.parseInt(request.getParameter("id")); | ||
int amount = Integer.parseInt(request.getParameter("amount")); | ||
|
||
addItem(request, pid, amount); | ||
|
||
response.sendRedirect("cart"); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
} | ||
|
||
public void addItem(HttpServletRequest request, int pid, int amount) { | ||
HttpSession session = request.getSession(); | ||
Map<Integer, Integer> cart = (Map<Integer, Integer>) session.getAttribute("cart"); | ||
|
||
if (cart == null) { | ||
return; | ||
} | ||
|
||
if (cart.containsKey(pid)) { | ||
cart.put(pid, cart.get(pid) + amount); | ||
} else { | ||
cart.put(pid, amount); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/bakaqc/flower/controller/AdminAccountController.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,45 @@ | ||
package com.bakaqc.flower.controller; | ||
|
||
import com.bakaqc.flower.dao.UserDAO; | ||
import com.bakaqc.flower.model.User; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public class AdminAccountController extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
String error = request.getParameter("error"); | ||
String status = request.getParameter("status"); | ||
if (error != null) { | ||
request.setAttribute("error", error); | ||
} | ||
UserDAO userDAO = new UserDAO(); | ||
List<User> users = userDAO.selectAll(); | ||
if (status != null && !status.equals("0")) { | ||
request.setAttribute("status", status); | ||
String statusCode = status.equals("1") ? "activate" : "deactivate"; | ||
users = users.stream().filter((t) -> t.getStatus().toString().equals(statusCode)).collect(Collectors.toList()); | ||
} | ||
request.setAttribute("users", users); | ||
request.getSession().setAttribute("isActive", 1); | ||
request.getRequestDispatcher("/view/AccountAdmin.jsp").forward(request, response); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
|
||
} | ||
|
||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/bakaqc/flower/controller/AdminDeleteController.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,39 @@ | ||
package com.bakaqc.flower.controller; | ||
|
||
import com.bakaqc.flower.dao.AdminDAO; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public class AdminDeleteController extends HttpServlet { | ||
|
||
protected void processRequest(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
try (PrintWriter out = response.getWriter()) { | ||
String id = request.getParameter("id"); | ||
AdminDAO adminDAO = new AdminDAO(); | ||
adminDAO.delete(id); | ||
} | ||
} | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
processRequest(request, response); | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
processRequest(request, response); | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/bakaqc/flower/controller/AdminListController.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,43 @@ | ||
package com.bakaqc.flower.controller; | ||
|
||
import com.bakaqc.flower.dao.AdminDAO; | ||
import com.bakaqc.flower.model.Admin; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.util.List; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public class AdminListController extends HttpServlet { | ||
|
||
protected void processRequest(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
try (PrintWriter out = response.getWriter()) { | ||
AdminDAO adminDAO = new AdminDAO(); | ||
List<Admin> list = adminDAO.selectAll(); | ||
request.setAttribute("list", list); | ||
request.getSession().setAttribute("isActive", 4); | ||
request.getRequestDispatcher("/view/manageAdmin.jsp").forward(request, response); | ||
} | ||
} | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
processRequest(request, response); | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
processRequest(request, response); | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
} | ||
} |
Oops, something went wrong.