Esempio n. 1
0
        void luuTamTinh()
        {
            if (matamtinh == "") //lưu lần đầu
            {
                TAMTINH tt = new TAMTINH();
                matamtinh        = "TT" + XuLy.TaoMaRandom.taoMaRandom();
                tt.MaTamTinh     = matamtinh;
                tt.MaNV          = hoadon_bll.layMaNV(tendn);
                tt.MaKhach       = makhach;
                tt.TienBan       = float.Parse(txtTienBan.Text); //tiền bàn = 0
                tt.MaBan         = maban;
                tt.GioDatBan     = giovao;
                tt.TienChuyenBan = 0;

                if (tamtinh_bll.themTamTinh(tt))
                {
                    MessageBox.Show("Đặt bàn " + txtTenBan.Text + " thành công !!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    themCTTT(matamtinh); //thêm với mã tt mới
                    ban.capNhatTrangThai(maban, "Có khách");
                }
                else
                {
                    MessageBox.Show("Đặt bàn thất bại !!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            else //update
            {
                xoaCTTT(matamtinh); //vì hàng hóa có thể thêm hoặc bớt, để dễ xử lý ta xóa hết và thêm lại mới
                themCTTT(matamtinh);
                MessageBox.Show("Những thay đổi đã lưu thành công !!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
 public bool themTamTinh(TAMTINH ttinh)
 {
     try
     {
         tamtinh.TAMTINHs.InsertOnSubmit(ttinh);
         tamtinh.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 3
0
 public bool suaTamTinh(string matamtinh, float tienban)
 {
     try
     {
         TAMTINH tt = tamtinh.TAMTINHs.Where(t => t.MaTamTinh == matamtinh).FirstOrDefault();
         tt.TienBan = tienban;
         tamtinh.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 4
0
 public bool xoaTamTinh(string ma)
 {
     try
     {
         TAMTINH tt = tamtinh.TAMTINHs.Where(t => t.MaTamTinh == ma).FirstOrDefault();
         tamtinh.TAMTINHs.DeleteOnSubmit(tt);
         tamtinh.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 5
0
        private void FrmThueBan_Load(object sender, EventArgs e)
        {
            UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue");
            loadTheoTen(TenHang);
            timerDem.Start();

            txtTenBan.Text  = ban.layTenBan(maban);
            txtLoaiBan.Text = ban.layTenLoai(maban);

            makhach = "KH" + XuLy.TaoMaRandom.taoMaRandom();

            //thanh toán
            if (thanhtoan == true)
            {
                btnLuu.Text = "Thanh toán";
                matamtinh   = tamtinh_bll.layMaTamTinh(maban);
                //MessageBox.Show(matamtinh);

                TAMTINH tamtinh = tamtinh_bll.layTamTinh(matamtinh);
                giovao        = (DateTime)tamtinh.GioDatBan;
                tienchuyenban = (float)tamtinh.TienChuyenBan;
                txtVao.Text   = String.Format("{0:G}", giovao);
            }

            if (matamtinh != "")
            {
                int index = dtgvCTHD.Rows.Count - 1;
                foreach (CT_TAMTINH ct in tamtinh_bll.layCTTT(matamtinh))
                {
                    index++;
                    dtgvCTHD.Rows.Add();
                    dtgvCTHD.Rows[index].Cells[0].Value = ct.MaHang;
                    dtgvCTHD.Rows[index].Cells[1].Value = hanghoa_bll.layTenHang(ct.MaHang);
                    dtgvCTHD.Rows[index].Cells[2].Value = ct.SoLuongBan;
                    dtgvCTHD.Rows[index].Cells[3].Value = ct.DonGiaBan;
                }
            }

            dongiaban = ban.layDonGia(maban);

            txtChuyenBan.Text = tienchuyenban.ToString();
            txtVao.Text       = String.Format("{0:G}", giovao); //h:mm:ss  tt
        }
Esempio n. 6
0
 public bool themTamTinh(TAMTINH tt)
 {
     return(tamtinh_dal.themTamTinh(tt));
 }