Exemple #1
0
        //private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        //{

        //    DataRow row = ctrl.NewRow();
        //    row["MaKhachHang"] = "";
        //    row["TenKhachHang"] = "";
        //    row["CMND"] = "";
        //    row["QuocTich"] = "";
        //    row["DiaChi"] = "";
        //    row["DienThoai"] = "";
        //    row["GioiTinh"] = "";

        //    ctrl.Add(row);
        //    bindingNavigator1.BindingSource.MoveLast();
        //    txtMaKHang.Focus();
        //}

        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có chắc chắn xóa không?", "Khach Hang", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                bindingNavigator1.BindingSource.RemoveCurrent();
                ctrl.Save();
            }
        }
        void ThemMoi()
        {
            DataRow row = ctrl.NewRow();

            row["MaPhieuThue"] = txtMaPhieuThue.Text;
            row["MaKhachHang"] = cmbMaKH.SelectedValue;

            ctrl.Add(row);

            PhieuThuePhongControl ctrlPN = new PhieuThuePhongControl();

            if (ctrlPN.LayPhieuThue(txtMaPhieuThue.Text) != null)
            {
                MessageBox.Show("Mã Phiếu này đã tồn tại !", "Phieu Thue", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (ThamSo.LaSoNguyen(txtMaPhieuThue.Text))
            {
                int so = Convert.ToInt32(txtMaPhieuThue.Text);
                if (so >= ThamSo.LayPhieuDangKy())
                {
                    ThamSo.GanPhieuDangKy(so + 1);
                }
            }

            ctrl.Update();
            DataTable tblCTP = (DataTable)bindingNavigator1.BindingSource.DataSource;

            ctpnctrl.Update();
            ctrl.Save();
            ctpnctrl.Save();
            khctrl.Save();
            //ptctrl.Save();
        }
Exemple #3
0
        void ThemMoi()
        {
            DataRow row = ctrl.NewRow();

            row["MaHoaDon"]    = txtMaHoaDon.Text;
            row["NhanVienLap"] = txtTenNhanVien.Text;
            row["MaKhachHang"] = cmbTenKhachHang.SelectedValue;
            row["MaNhanPhong"] = cmbMaNhanPhong.SelectedValue;
            row["TongTien"]    = txtTongTien.Text;
            row["NgayLap"]     = dateNgaylap.Value.Date;

            ctrl.Add(row);

            HoaDonControl hdctrl = new HoaDonControl();

            if (hdctrl.LayHoaDon(txtMaHoaDon.Text) != null)
            {
                MessageBox.Show("Mã hóa đơn này đã tồn tại !", "Hoa Don", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (ThamSo.LaSoNguyen(txtMaHoaDon.Text))
            {
                long so = Convert.ToInt64(txtMaHoaDon.Text);
                if (so >= ThamSo.LayHoaDon())
                {
                    ThamSo.GanHoaDon(so + 1);
                }
            }
            ctrl.Update();

            DataTable tblCTHD = (DataTable)bindingNavigator1.BindingSource.DataSource;

            ctctrl.Update();
            ctrl.Save();
            ctctrl.Save();
            khctrl.Save();
            pnctrl.Save();
        }
 private void save_Click(object sender, EventArgs e)
 {
     bindingNavigatorPositionItem.Focus();
     ctrl.Save();
 }