Exemple #1
0
        private void btnHoaDon_Click(object sender, EventArgs e)
        {
            datban = true;
            DialogResult tl = MessageBox.Show("Bạn có muốn gọi thêm gì không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            try
            {
                if (tl == DialogResult.No)
                {
                    txtSoLuong.Enabled = false;
                    btnChon.Enabled    = false;
                    int id = Int32.Parse(cmbBan.SelectedValue.ToString());
                    RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
                    BAN tb = dbs.BANs.Single(p => p.ID == id && p.TrangThai == 1);
                    tb.status = 1;                              //trạng thái bàn đã được đặt
                    dbs.SubmitChanges();
                    btnOrder.Show();
                    btnUndo.Hide();
                }
            }
            catch
            {
                MessageBox.Show("Hết Bàn Rồi!!!");
                btnOrder.Enabled = false;
            }
        }
Exemple #2
0
        public void Them(string ten, string mk, string dt, bool loai)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            KHACHHANG nv = new KHACHHANG();// bang nhan vien

            try
            {
                //nv.nhanvienid = id;
                nv.TenKH       = ten;
                nv.DiaChi      = mk;
                nv.SoDienThoai = dt;
                nv.Nu          = loai;
                if (picNhanvien.Image == null)
                {
                    nv.Hinh = null;
                }
                else
                {
                    nv.Hinh = imgToByteArray(picNhanvien.Image);
                }
                nv.TrangThai = true;
                dbs.KHACHHANGs.InsertOnSubmit(nv);
                dbs.SubmitChanges();
                MessageBox.Show("Thêm thành công");
            }
            catch
            {
            }
        }
Exemple #3
0
        public void sua(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            KHACHHANG nv = dbs.KHACHHANGs.Single(p => p.ID.ToString() == a);

            nv.TenKH       = txtHoten.Text;
            nv.DiaChi      = txtDiachi.Text;
            nv.SoDienThoai = txtSDT.Text;
            bool gioitinh2 = false;

            if (ckbNu.CheckState == CheckState.Checked)
            {
                gioitinh2 = true;
            }
            else
            {
                gioitinh2 = false;
            }
            if (picNhanvien.Image == null)
            {
                nv.Hinh = null;
            }
            else
            {
                nv.Hinh = imgToByteArray(picNhanvien.Image);
            }
            nv.Nu = gioitinh2;
            dbs.SubmitChanges();
        }
Exemple #4
0
        public void Them(string ten, string mk, DateTime ngay, string hoten, string dt, string loai)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            TAIKHOAN nv = new TAIKHOAN();// bang nhan vien

            //nv.nhanvienid = id;
            nv.TenDangNhap = ten;
            try
            {
                if (!dbs.TAIKHOANs.Where(cls => cls.TenDangNhap == ten).Any())
                {
                    nv.MatKhau = mk;

                    nv.NgayDangKi  = ngay;
                    nv.HoTen       = hoten;
                    nv.SoDienThoai = dt;

                    nv.LoaiTK    = int.Parse(loai);
                    nv.TrangThai = true;
                    dbs.TAIKHOANs.InsertOnSubmit(nv);
                    dbs.SubmitChanges();
                    MessageBox.Show("Thêm thành công");
                }
                else
                {
                    MessageBox.Show("TÊN ĐĂNG NHẬP ĐÃ ĐƯỢC SỬ DỤNG!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
            }
        }
Exemple #5
0
        public void sua(string ma)
        {
            btnThem.Enabled = true;
            btnSave.Enabled = true;
            txtID.Enabled   = false;
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NHANVIEN nv = dbs.NHANVIENs.Single(p => p.ID.ToString() == ma);

            nv.HoTenNV      = txtHoten.Text;
            nv.DiaChi       = txtDiachi.Text;
            nv.CMND         = txtCMND.Text;
            nv.NgayNhanViec = Convert.ToDateTime(txtNgaynhan.Text);
            bool gioitinh2 = false;

            if (ckbNu.CheckState == CheckState.Checked)
            {
                gioitinh2 = true;
            }
            else
            {
                gioitinh2 = false;
            }
            nv.Nu          = gioitinh2;
            nv.SoDienThoai = txtSDT.Text;
            if (picNhanvien.Image == null)
            {
                nv.Hinh = null;
            }
            else
            {
                nv.Hinh = imgToByteArray(picNhanvien.Image);
            }
            nv.LoaiNV = int.Parse(cbbLoai.SelectedValue.ToString());
            dbs.SubmitChanges();
        }
Exemple #6
0
        public void Them(string Hoten, string diachi, string cmnd, string sodt, DateTime ngaynhan, bool gt, int loai)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NHANVIEN nv = new NHANVIEN();

            nv.HoTenNV      = Hoten;
            nv.DiaChi       = diachi;
            nv.CMND         = cmnd;
            nv.NgayNhanViec = ngaynhan;
            nv.SoDienThoai  = sodt;
            if (picNhanvien.Image == null)
            {
                nv.Hinh = null;
            }
            else
            {
                nv.Hinh = imgToByteArray(picNhanvien.Image);
            }
            nv.LoaiNV = loai;

            nv.Nu        = gt;
            nv.TrangThai = true;
            dbs.NHANVIENs.InsertOnSubmit(nv);
            dbs.SubmitChanges();
        }
Exemple #7
0
        public void xoa(int a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            BAN tb = dbs.BANs.Single(p => p.ID == a);

            tb.TrangThai = 0;
            dbs.SubmitChanges();
        }
Exemple #8
0
        public void xoa(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            LUONG dc = dbs.LUONGs.Single(p => p.ID_NV.ToString() == a);

            dc.Status = false;
            dbs.SubmitChanges();
        }
        public void sua(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NHACUNGCAP dc = dbs.NHACUNGCAPs.Single(p => p.ID.ToString() == a);

            dc.TenNhaCungCap = txtten.Text;
            dbs.SubmitChanges();
        }
Exemple #10
0
        public void xoa(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            HOADONNH hd = dbs.HOADONNHs.Single(p => p.ID.ToString() == a);

            hd.TrangThai = false;
            dbs.SubmitChanges();
        }
        public void xoa(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NHACUNGCAP dc = dbs.NHACUNGCAPs.Single(p => p.ID.ToString() == a);

            dc.TrangThai = false;
            dbs.SubmitChanges();
        }
        public void sua(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NGUYENLIEU dc = dbs.NGUYENLIEUs.Single(p => p.ID.ToString() == a);

            dc.TenSP  = txtten.Text;
            dc.DonGia = Convert.ToInt32(txtgia.Text);
            dbs.SubmitChanges();
        }
Exemple #13
0
        public void Sua(int id)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            BAN tb = dbs.BANs.Single(p => p.ID == id);

            tb.TenBan = txtTenBan.Text;
            tb.status = Int32.Parse(txtTrangThai.Text);
            dbs.SubmitChanges();
        }
Exemple #14
0
        public void Sua1(Int32 id)        //Sửa theo id bàn đang chọn
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            BAN tb = dbs.BANs.Single(p => p.ID == id);

            //BAN tb = new BAN();
            //btnLuu_Click(null, null);
            tb.status = 1;
            dbs.SubmitChanges();
        }
        public void them(string ten, string ngay, bool Trangthai)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NHACUNGCAP nl = new NHACUNGCAP();

            nl.TenNhaCungCap = ten;
            nl.NgayHopTac    = DateTime.Now;
            nl.TrangThai     = true;
            dbs.NHACUNGCAPs.InsertOnSubmit(nl);
            dbs.SubmitChanges();
        }
        public void them(string ten, string gia, bool Trangthai)
        {
            txtma.Enabled = true;
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            NGUYENLIEU nl = new NGUYENLIEU();

            nl.TenSP     = ten;
            nl.DonGia    = Convert.ToInt32(txtgia.Text);
            nl.TrangThai = true;
            dbs.NGUYENLIEUs.InsertOnSubmit(nl);
            dbs.SubmitChanges();
        }
Exemple #17
0
        protected void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            int      r     = GridNhanvien.CurrentCell.RowIndex;
            string   strID = GridNhanvien.Rows[r].Cells[0].Value.ToString();
            NHANVIEN kh    = dbs.NHANVIENs.Single(p => p.ID.ToString() == strID && p.TrangThai == true);// bang nhan vien

            kh.TrangThai = false;
            MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            dbs.SubmitChanges();
            LoadData();
        }
Exemple #18
0
        public void sua(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            TAIKHOAN nv = dbs.TAIKHOANs.Single(p => p.TenDangNhap.ToString() == a);

            nv.TenDangNhap = txtTaikhoan.Text;
            nv.MatKhau     = txtMatkhau.Text;
            nv.HoTen       = txtHoten.Text;
            nv.SoDienThoai = txtSdt.Text;
            nv.LoaiTK      = Convert.ToInt16(cbbLoaiTK.SelectedValue);
            dbs.SubmitChanges();
        }
Exemple #19
0
        private void btnXoa_ItemClick(object sender, ItemClickEventArgs e)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();

            int      r       = dgvMenu.CurrentCell.RowIndex;
            string   strMaNV = dgvMenu.Rows[r].Cells[0].Value.ToString();
            TAIKHOAN kh      = dbs.TAIKHOANs.Single(p => p.TenDangNhap.ToString() == strMaNV && p.TrangThai == true);// bang nhan vien

            kh.TrangThai = false;
            MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            dbs.SubmitChanges();
            LoadData();
        }
Exemple #20
0
        public void Them_HD(int Manv, int Maban, bool tt, int Makh, int Tien)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            HOADONBH b = new HOADONBH();    //Tạo 1 hóa đơn mới

            b.MaNV      = Manv;
            b.MaBan     = Maban;
            b.TrangThai = tt;
            b.MaKH      = Makh;
            b.TongTien  = Tien;
            dbs.HOADONBHs.InsertOnSubmit(b);
            dbs.SubmitChanges();
        }
Exemple #21
0
        public void Them_Ban(string tenban, int status, int tt)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            BAN tb = new BAN();

            tb.TenBan    = tenban;
            tb.status    = status;
            tb.TrangThai = tt;


            dbs.BANs.InsertOnSubmit(tb);
            dbs.SubmitChanges();
        }
        private void btnChitiet_ItemClick(object sender, ItemClickEventArgs e)
        {
            FrmChitiet f2 = new FrmChitiet(textBox2.Text);

            //f2.cc = new FrmChitiet.KieuDulieuTruyenRa(nhancc);
            f2.ShowDialog();
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            int      r     = GridHoadonBH.CurrentCell.RowIndex;
            string   strID = GridHoadonBH.Rows[r].Cells[0].Value.ToString();
            HOADONBH kh    = dbs.HOADONBHs.Single(p => p.ID.ToString() == strID);

            dbs.SubmitChanges();
            LoadData();
        }
Exemple #23
0
        public void sua(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            HOADONNH HD = dbs.HOADONNHs.Single(p => p.ID.ToString() == a);

            txttong.Text = (DG * txtSoLuong.Value).ToString();
            HD.NV        = Convert.ToInt32(cbxMANV.SelectedValue.ToString());
            HD.NSX       = Convert.ToInt32(cbxNSX.SelectedValue.ToString());
            HD.SP        = Convert.ToInt32(cbxSP.SelectedValue.ToString());
            HD.SoLuong   = Convert.ToInt32(txtSoLuong.Text);
            HD.DonGia    = Convert.ToInt32(txtgia.Text);
            HD.ThanhTien = Convert.ToInt32(txttong.Text);
            dbs.SubmitChanges();
        }
Exemple #24
0
        private void btnThem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DialogResult tl = MessageBox.Show("Tính lương nhân viên", "Thông Báo",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (tl == DialogResult.OK)
            {
                if (txtLuong.Text == " " || txtThuong.Text == " ")
                {
                    MessageBox.Show("Nhập Lương/Thưởng");
                    txtLuong.ResetText();
                    txtThuong.ResetText();
                    txtLuong.Focus();
                }
                else
                {
                    if (!Check(txtLuong.Text) || !Check(txtThuong.Text))
                    {
                        MessageBox.Show("Lương/Thưởng Nhập Không hợp lệ");
                        txtThuong.ResetText();
                        txtLuong.ResetText();
                        txtLuong.Focus();
                    }
                    else
                    {
                        RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
                        LUONG L = new LUONG();
                        L.TenNV     = Convert.ToInt32(cbxMANV.SelectedValue.ToString());
                        L.LuongCB   = Convert.ToInt32(txtLuong.Text);
                        L.Thuong    = Convert.ToInt32(txtThuong.Text);
                        L.TongLuong = Convert.ToInt32(txtLuong.Text) + Convert.ToInt32(txtThuong.Text);
                        L.TrangThai = true;
                        dbs.LUONGs.InsertOnSubmit(L);
                        dbs.SubmitChanges();
                        MessageBox.Show("Đã Tính Xong!", "Thông báo!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDaTa();
                        txtLuong.ResetText();
                        txtThuong.ResetText();
                        txttong.ResetText();
                        txtLuong.Focus();
                    }
                }
            }
            else
            {
                LoadDaTa();
            }
        }
Exemple #25
0
        public void sua(string ma)
        {
            btnThem.Enabled = true;
            btnSave.Enabled = true;
            txttong.Enabled = false;
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            LUONG L = dbs.LUONGs.Single(p => p.ID_NV.ToString() == ma);

            L.TenNV     = Convert.ToInt32(cbxMANV.SelectedValue.ToString());
            L.LuongCB   = Convert.ToInt32(txtLuong.Text);
            L.Thuong    = Convert.ToInt32(txtThuong.Text);
            L.TongLuong = Convert.ToInt32(txtLuong.Text) + Convert.ToInt32(txtThuong.Text);
            L.TrangThai = true;
            dbs.SubmitChanges();
        }
Exemple #26
0
        // int dem = 0;
        private void createBillDetail(int id, DateTime date, int thisCoffee, int sl)       //tạo chi tiết hóa đơn
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            //thisCoffee = dbs.SANPHAMs.Where(p => p.ID == id).ToList().Last().ID;       //tìm món có mã bằng vs mã đã chọn
            CHITIETHDBH bill = new CHITIETHDBH();

            {
                bill.IDHD      = id;
                bill.Ngay      = date;
                bill.SanPham   = thisCoffee;
                bill.SoLuong   = sl;
                bill.TrangThai = true;
            };
            dbs.CHITIETHDBHs.InsertOnSubmit(bill);
            dbs.SubmitChanges();
        }
Exemple #27
0
        public void them(string nv, string nsx, string sp, string sl, string gia, string tong, string ngay, bool trangthai)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            HOADONNH HD = new HOADONNH();

            txttong.Text = (DG * txtSoLuong.Value).ToString();
            HD.NV        = Convert.ToInt32(cbxMANV.SelectedValue.ToString());
            HD.NSX       = Convert.ToInt32(cbxNSX.SelectedValue.ToString());
            HD.SP        = Convert.ToInt32(cbxSP.SelectedValue.ToString());
            HD.SoLuong   = Convert.ToInt32(txtSoLuong.Text);
            HD.DonGia    = Convert.ToInt32(txtgia.Text);
            HD.ThanhTien = Convert.ToInt32(txttong.Text);
            HD.Ngay      = DateTime.Now;
            HD.TrangThai = true;
            dbs.HOADONNHs.InsertOnSubmit(HD);
            dbs.SubmitChanges();
        }
        public void sua(string a)
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            SANPHAM nv = dbs.SANPHAMs.Single(p => p.ID.ToString() == a);

            nv.TenSP  = txtTenmon.Text;
            nv.DonGia = Convert.ToInt32(txtDongia.Text);
            if (picMonan.Image == null)
            {
                nv.Hinh = null;
            }
            else
            {
                nv.Hinh = imgToByteArray(picMonan.Image);
            }
            dbs.SubmitChanges();
        }
Exemple #29
0
        private void ThanhToan(Int32 mb)      //Hàm thanh toán
        {
            RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
            Int32 MaCanSua = mb;

            Sua2(MaCanSua);
            HOADONBH hd = dbs.HOADONBHs.FirstOrDefault(p => p.MaBan == mb && p.TrangThai == true);

            hd.TrangThai = false;
            MessageBox.Show("Thanh Toán Thành Công !!!");
            dgvTable.Update();
            loadData();
            panelTable.Controls.Clear();
            SetUpTable();

            dbs.SubmitChanges();
        }
Exemple #30
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtNew.Text == txtXM.Text && txtNew.Text != txtPass.Text)
     {
         RestaurantManagerDataContext dbs = new RestaurantManagerDataContext();
         TAIKHOAN nv = dbs.TAIKHOANs.FirstOrDefault(p => p.TenDangNhap == txtUser.Text);
         nv.MatKhau = txtNew.Text;
         MessageBox.Show("Đã cập nhật !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         dbs.SubmitChanges();
     }
     else
     {
         MessageBox.Show("Kiểm tra lại mật khẩu vừa nhập !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtNew.ResetText();
         txtXM.ResetText();
         txtNew.Focus();
     }
 }