minhlap.allgoo.us
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.


When we control the event,we control your lives
 
Trang ChínhLatest imagesTìm kiếmĐăng kýĐăng Nhập
Tìm kiếm
 
 

Display results as :
 
Rechercher Advanced Search
Latest topics
» Tô màu theo vùng quét
Quản Lý Nhà Hàng FRI Icon_minitimeTue Aug 13, 2013 4:18 pm by minhlap

» authentischen Hermes Lindy Taschen
Quản Lý Nhà Hàng FRI Icon_minitimeWed Jan 23, 2013 11:15 am by cangliang

» Hermes Bag
Quản Lý Nhà Hàng FRI Icon_minitimeWed Jan 23, 2013 11:14 am by cangliang

» Hermes Evelyn pm
Quản Lý Nhà Hàng FRI Icon_minitimeWed Jan 23, 2013 11:13 am by cangliang

» Hermes Kelly bag billig
Quản Lý Nhà Hàng FRI Icon_minitimeMon Jan 21, 2013 8:57 am by cangliang

» Hermes Constance Bag
Quản Lý Nhà Hàng FRI Icon_minitimeMon Jan 21, 2013 8:56 am by cangliang

» Discout Hermes Belt
Quản Lý Nhà Hàng FRI Icon_minitimeMon Jan 21, 2013 8:55 am by cangliang

» Christian Louboutin Love Flats
Quản Lý Nhà Hàng FRI Icon_minitimeTue Jan 15, 2013 12:25 pm by cangliang

» Christian Louboutin Love Flats
Quản Lý Nhà Hàng FRI Icon_minitimeTue Jan 15, 2013 12:25 pm by cangliang

Navigation
 Portal
 Diễn Đàn
 Thành viên
 Lý lịch
 Trợ giúp
 Tìm kiếm
April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     
CalendarCalendar
Diễn Đàn
Affiliates
free forum


 

 Quản Lý Nhà Hàng FRI

Go down 
Tác giảThông điệp
connguoibian_tn_9
Thành viên bậc 1
Thành viên bậc 1
connguoibian_tn_9


Tổng số bài gửi : 9
Points : 21
Reputation : 1
Join date : 24/07/2009
Age : 35
Đến từ : Thiên Đường Hạnh Phúc

Quản Lý Nhà Hàng FRI Empty
Bài gửiTiêu đề: Quản Lý Nhà Hàng FRI   Quản Lý Nhà Hàng FRI Icon_minitimeFri Jul 24, 2009 10:41 pm

Sau mấy ngày tẩm ngẩm, thế là cũng gần xong cái nhà hàng của mình zòi. Nhưng seo phần kết nối cơ sở dữ liệu thì dở qué.
uhm.. Post thử mí file lên mọi ng xem nhen

File MenuChinh.java

Code:

import java.awt.*;
import java.awt.event.*;
public class MenuChinh
{
   public static void main(String[] args)
   {
      createMenu();
   }
   private static void createMenu()
   {
      //tao frame cho chuong trinh
      final Frame fr = new Frame("Chuong trinh quan ly nha hang");
      fr.setLayout(new BorderLayout());
      
      //tao Menu Bar
      MenuBar menu = new MenuBar();
      
      //tao cac Menu
      Menu menuFile = new Menu("File");
      Menu menuUpdate = new Menu("Cap Nhat");
      Menu menuProcess = new Menu("Xu Ly");
      Menu menuHelp = new Menu("Help");
      
      //tao Menu Item cho File
      MenuItem trangThai = new MenuItem("Trang thai Ban");
      trangThai.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new TrangThai("Trang Thai Ban");
         }
      });
      MenuItem goiMon = new MenuItem("Goi Mon");
      goiMon.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new GoiMon("Goi Mon");
         }
      });
      MenuItem tinhTien = new MenuItem("Tinh Tien");
      tinhTien.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new TinhTien("Tinh Tien");
         }
      });
      MenuItem thoat = new MenuItem("Thoat");
      thoat.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            System.exit(0);
         }
      });
      menuFile.add(trangThai);
      menuFile.add(goiMon);
      menuFile.add(tinhTien);
      menuFile.addSeparator();
      menuFile.add(thoat);
      //tao Menu Item cho Update
      MenuItem themBan = new MenuItem("Danh sach Ban");
      themBan.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new ThemBan("Danh sach Ban");
         }
      });
      MenuItem themThucDon = new MenuItem("Thuc Don");
      themThucDon.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new ThucDon("Thuc Don");
         }
      });
      menuUpdate.add(themBan);
      menuUpdate.add(themThucDon);
      //tao Menu Item cho Process
      //tao Menu Item cho Help
      MenuItem troGiup = new MenuItem("Tro  Giup");
      troGiup.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new TroGiup("Tro Giup");
         }
      });
      MenuItem about = new MenuItem("About");
      about.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new About("About");
         }
      });
      menuHelp.add(troGiup);
      menuHelp.add(about);
      //gan cac Menu vao MenuBar
      menu.add(menuFile);
      menu.add(menuUpdate);
      MenuItem thayDoi  = new MenuItem("Thay Doi Mon");
      thayDoi.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new ThemMon("Thay Doi Mon");
         }
      });
      MenuItem ghepBan  = new MenuItem("Ghep Ban");
      ghepBan.addActionListener(new ActionListener()
      {
         public void actionPerformed(ActionEvent ae)
         {
            new GhepBan("Ghep ban");
         }
      });
      menuProcess.add(thayDoi);
      menuProcess.add(ghepBan);
      menu.add(menuProcess);
      menu.add(menuHelp);
      //gan MenuBar vao khung
      fr.setMenuBar(menu);
      Label lb = new Label("CHUONG TRINH QUAN LY NHA HANG FRI",Label.CENTER);
      lb.setFont(new Font("Times Roman",Font.BOLD,30));
      fr.add(lb,BorderLayout.CENTER);
      fr.setBounds(0,0, 800, 570);
      fr.setVisible(true);
      fr.setFont(new Font("Arial",Font.PLAIN,13));
      //xu ly su kien dong cua so ung dung
      fr.addWindowListener(new WindowAdapter()
            {
               public void windowClosing(WindowEvent e)
               {
                  System.exit(0);
               }   
            });
   }
}


Hẳn nhiên là cái bài nó chưa chạy zòi..Đây mới chỉ là dự án. vả lại...cái cơ sở SQL mình chưa rành nữa
Về Đầu Trang Go down
http://thuhuong.tk
connguoibian_tn_9
Thành viên bậc 1
Thành viên bậc 1
connguoibian_tn_9


Tổng số bài gửi : 9
Points : 21
Reputation : 1
Join date : 24/07/2009
Age : 35
Đến từ : Thiên Đường Hạnh Phúc

Quản Lý Nhà Hàng FRI Empty
Bài gửiTiêu đề: File TrangThai.java   Quản Lý Nhà Hàng FRI Icon_minitimeFri Jul 24, 2009 10:46 pm

hix..Tui hết sửa dc mí cái file có liên kế zòi, bạn nào sửa dc sửa giùm nha
Tui ziết bằng SQL, nhưng mà hog chạy, vì seo thì ..no way Very Happy

Code:

import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class TrangThai extends Frame implements ActionListener
{
   int n=0;//dung de duyet cac ban
   Panel panelSouth = new Panel();
   Label lbChinh = new Label("Trang thai Ban",Label.CENTER);
   TextArea txaChinh = new TextArea();
   Button buttXem = new Button("  Xem  ");
   Button buttThoat = new Button("  Thoat  ");
   Choice chMaBan = new Choice();
   Choice chTenBan = new Choice();
   java.sql.Connection con;
   java.sql.Statement stmt;
   ResultSet rs;
   public TrangThai(String title)
   {
      super(title);
      lbChinh.setFont(new Font("Tahoma",Font.BOLD,20));
      add(lbChinh,BorderLayout.NORTH);
      txaChinh.setEditable(false);
      txaChinh.setText("\tTen Ban\t\tTrang thai\n\n");
      add(txaChinh,BorderLayout.CENTER);
      panelSouth.add(buttXem);
      panelSouth.add(buttThoat);
      add(panelSouth,BorderLayout.SOUTH);
      buttXem.addActionListener(this);
      buttThoat.addActionListener(this);
      setFont(new Font("Arial",Font.PLAIN,14));
      setLocation(200,50);
      setSize(400, 400);
      setResizable(false);
      setVisible(true);
      try
      {
         connect();
         rs = stmt.executeQuery("SELECT * FROM Ban");
         rs.next();
         while(!rs.isAfterLast())
         {
            chMaBan.addItem(rs.getString(1));
            chTenBan.addItem(rs.getString(2));
            n++;
            rs.next();
         }
      }
      catch(Exception e){}
   }
   public void actionPerformed(ActionEvent e)
   {
      if (e.getSource()==buttXem)
         Xem();
      if(e.getSource() == buttThoat)
      {
         setVisible(false);
      }
   }
   public void Xem()
   {
      
      try
      {
         connect();
         rs = stmt.executeQuery("SELECT BanID FROM Goi_mon");
         for(int i = 0; i<n;i++)
         {
            String s = chMaBan.getItem(i);
            rs.first();
            boolean flag = false;
            while(!rs.isAfterLast())
            {
               if(rs.getString(1).equals(s))
               {
                  flag = true;
                  break;
               }
               rs.next();
            }
            if(flag == true)
               txaChinh.append("\t"+chTenBan.getItem(i)+"\t\t\tDa su dung");
            else
               txaChinh.append("\t"+chTenBan.getItem(i)+"\t\t\tChua su dung");
            txaChinh.append("\n");
         }
      }
      catch(Exception e)
      {
         System.err.println("Error: "+e.toString());
      }
   }
   public void connect()
   {
      try
      {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Nap trinh dieu khien Access
      }
      catch (ClassNotFoundException ex)
      {
         System.out.print("Error: " + ex.getMessage());
      }
      try
      {
         String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/cafe.mdb";
         con = DriverManager.getConnection(url);
         stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
      }
      catch(SQLException se)
      {
         System.err.println("Error: "+se.getMessage());
      }
   }
}

---------------------------------------------------------
File GoiMon.java

Code:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
public class GoiMon extends Frame implements ActionListener
{
   Panel panelCenter = new Panel();
   Panel panelSub = new Panel(new GridLayout(4,2,10,10));
   Panel panelSouth = new Panel();
   Panel panelSpace = new Panel();
   Label lbSpace = new Label(" ");
   Label lbGoiMon = new Label("GOI MON",Label.CENTER);
   Label lbMaGoi = new Label("Luot goi:");
   Label lbBan = new Label("Ban:");
   Label lbDoUong = new Label("Do uong:");
   Label lbSoLuong = new Label("So luong:");
   TextField txtMaGoi = new TextField("Vd: 23 la Ban 2,Luot goi 3");
   Choice chBan = new Choice();
   Choice chTenBan = new Choice();
   Choice chDoUong = new Choice();
   Choice chTenDoUong = new Choice();
   TextField txtSoLuong = new TextField();
   Button buttLuu = new Button("  Luu  ");
   Button buttThoat = new Button(" Thoat ");
   java.sql.Connection con;
   java.sql.Statement stmt;
   ResultSet rs;
   public GoiMon(String title)
   {
      super(title);
      lbGoiMon.setFont(new Font("Tahoma",Font.BOLD,20));
      add(lbGoiMon,BorderLayout.NORTH);
      panelSub.add(lbMaGoi);
      panelSub.add(txtMaGoi);
      panelSub.add(lbBan);
      try
      {
         connect();
         rs = stmt.executeQuery("SELECT * FROM Ban");
         rs.next();
         while(!rs.isAfterLast())
         {
            chBan.addItem(rs.getString(1));
            chTenBan.addItem(rs.getString(2));
            rs.next();
         }
      }
      catch(Exception e){}
      try
      {
         connect();
         rs = stmt.executeQuery("SELECT * FROM Thuc_don");
         rs.next();
         while(!rs.isAfterLast())
         {
            chDoUong.addItem(rs.getString(1));
            chTenDoUong.addItem(rs.getString(2));
            rs.next();
         }
      }
      catch(Exception e){}

      panelSub.add(chTenBan);
      panelSub.add(lbDoUong);
      panelSub.add(chTenDoUong);
      panelSub.add(lbSoLuong);
      panelSub.add(txtSoLuong);
      panelCenter.add(panelSub);
      panelSpace.add(lbSpace);
      panelCenter.add(panelSpace);
      add(panelCenter,BorderLayout.CENTER);
      panelSouth.add(buttLuu);
      add(panelSouth,BorderLayout.SOUTH);
      panelSouth.add(buttThoat);
      add(panelSouth,BorderLayout.SOUTH);
      buttLuu.addActionListener(this);
      buttThoat.addActionListener(this);
      setFont(new Font("Arial",Font.PLAIN,14));
      setLocation(180,50);
      setSize(500, 250);
      setResizable(false);
      setVisible(true);
   }
   public void actionPerformed(ActionEvent e)
   {
      if (e.getSource()==buttLuu)
         Luu();
      if(e.getSource() == buttThoat)
      {
         setVisible(false);
      }
   }
   public void Luu()
   {
      try
      {
         connect();
         rs = stmt.executeQuery("SELECT * FROM Goi_mon");
         rs.moveToInsertRow();
         rs.updateLong(1, Long.parseLong(txtMaGoi.getText()));
         int n = chTenBan.getSelectedIndex();
         rs.updateString(2, chBan.getItem(n));
         int m = chTenDoUong.getSelectedIndex();
         rs.updateString(3,chDoUong.getItem(m));
         rs.updateLong(4, Long.parseLong(txtSoLuong.getText()));
         rs.insertRow();
         txtMaGoi.setText("");
         txtSoLuong.setText("");
      }
      catch(Exception e)
      {
         System.err.println("Error: "+e.toString());
      }
   }
   public void connect()
   {
      try
      {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Nap trinh dieu khien Access
      }
      catch (ClassNotFoundException ex)
      {
         System.out.print("Error: " + ex.getMessage());
      }
      try
      {
         String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/cafe.mdb";
         con = DriverManager.getConnection(url);
         stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
      }
      catch(SQLException se)
      {
         System.err.println("Error: "+se.getMessage());
      }
   }
}


Hog, mà phải nói là mình làm quản lý NHÀ HÀNG mà nấu ăn dở tệ lun..
Ac ac.. Shocked Chắc có tài lèm quản lý chớ hog phải đầu bếp..^^
Ah..Đang lèm típ, từ từ tui post típ nhen.
Về Đầu Trang Go down
http://thuhuong.tk
 
Quản Lý Nhà Hàng FRI
Về Đầu Trang 
Trang 1 trong tổng số 1 trang
 Similar topics
-
» Một số link quan trọng
» Hỏi về hằng trong C#
» CMMI nghĩa là gì? CMMI là viết tắt của Capability Maturity Model Integration, tức Chuẩn quản lý quy trình chất lượng.
» "BACKTRACK" CÔNG CỤ HACK WIFI HÀNG ĐẦU THẾ GIỚI

Permissions in this forum:Bạn không có quyền trả lời bài viết
minhlap.allgoo.us :: Lập trình :: Lập Trình WEb - HTML/PHP/Javascip..-
Chuyển đến