⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excutework.java

📁 酒店管理系统
💻 JAVA
字号:
package javabean;

import database.connectDB;
import java.io.IOException;
import javax.servlet.ServletException;



public class excuteWork {
	public int workOutDietBill(String id) throws ServletException, IOException {
//		 创建数据库连接对象:
		int DietPrice=0;
		try {
			// 创建数据记录集对象:
			//int DietPrice=0;
			connectDB con = new connectDB();
			String sql = "select identifierID from orderInfo where identifierID = '"+id+"'";
			//System.out.print(sql + "\n");
			con.excuteQuery(sql);
			if(!con.next())
			{
				return -1;
			}else{
				//ResultSet rs=null;
				String sql1 = "select foodNumber,foodPrice from customerDiet,diet where identifierID='"+id+"' " +
						      "and customerDiet.foodID=diet.foodID;";
				con.excuteQuery(sql1);
				//System.out.print(sql1);
				//rs = (ResultSet) con.excuteQuery(sql1);
				while(con.next()){
					int no=con.getInt("foodNumber");
					int pr=con.getInt("foodPrice");
					DietPrice += no*pr;
					//System.out.print("sfdffff"+DietPrice);
				}
				//System.out.print("jiu shi"+DietPrice);
				return DietPrice;
			}
			
		}
		catch (Exception e) {
			e.printStackTrace();
			
		}
		return DietPrice;
		}
	
	public int workOutRoomBill(String id) throws ServletException, IOException {
//		 创建数据库连接对象:
		int roomPrice=0;
		try {
			// 创建数据记录集对象:
			connectDB con = new connectDB();
			String sql = "select lodgingTime,roomPrice from orderInfo,room where identifierID='"+id+"' " +
		      "and orderInfo.roomID=room.roomID;";
            con.excuteQuery(sql);
//          System.out.print(sql1);
			//rs = (ResultSet) con.excuteQuery(sql1);
			while(con.next()){
				int no=con.getInt("lodgingTime");
				int pr=con.getInt("roomPrice");
				roomPrice += no*pr;
				//System.out.print("sfdffff"+DietPrice);
			}
			//System.out.print("jiu shi"+DietPrice);
			return roomPrice;
		
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		return roomPrice;
		}
	
	public void payBill(String id) throws ServletException, IOException {
//		 创建数据库连接对象:
		//String vip="unkown";
		try {
			// 创建数据记录集对象:
			connectDB con = new connectDB();
			//String sql = "delete from ";
			String sql1 = "delete from customerDiet where identifierID='"+id+"';";
			String sql2 = "delete from orderInfo where identifierID='"+id+"';";
			con.excuteUpdate(sql1);
			con.excuteUpdate(sql2);
       
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		
		}
	
	public String vipQuery(String id) throws ServletException, IOException {
//		 创建数据库连接对象:
		String vip="否";
		try {
			// 创建数据记录集对象:
			connectDB con = new connectDB();
			String sql = "select * from customerInfo where identifierID='"+id+"';";
			con.excuteQuery(sql);
			while(con.next()){
				if(con.getString("VIP").equals("是"))
			    vip="是";
			    else{
			    	vip="否";
			    }
			}
			return vip;
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		return vip;
		}
	
	public int orderMoneyQuery(String id) throws ServletException, IOException {
//		 创建数据库连接对象:
		int omq=0;
		try {
			// 创建数据记录集对象:
			connectDB con = new connectDB();
			String sql = "select * from orderInfo where identifierID='"+id+"';";
			con.excuteQuery(sql);
			while(con.next()){
			omq += con.getInt("orderMoney");
			}
			return omq;
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		return omq;
		}
	
		
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -