Exemplo n.º 1
0
        private void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            trangThai1();
            if (!SP.isDelDatHang(this.maDDH))
            {
                DialogResult dialogResult = MessageBox.Show("Bạn có chắc chắn muốn xóa", "THÔNG BÁO", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    if (txtMaDDH.Text.Trim() == Program.username)
                    {
                        MessageBox.Show("Tài khoản này đang được sử dụng!", "THÔNG BÁO", MessageBoxButtons.OK);
                        return;
                    }
                    else
                    {
                        bdsDH.RemoveCurrent();
                        this.updateTableAdapter();
                        MessageBox.Show("Xóa Thành Công", "THÔNG BÁO", MessageBoxButtons.OK);
                    }
                }

                if (bdsDH.Count <= 0)
                {
                    btnCTDH.Enabled = false;
                }
            }
            else
            {
                MessageBox.Show("Không Thể Xóa", "THÔNG BÁO", MessageBoxButtons.OK);
            }



            trangThai2();
        }
Exemplo n.º 2
0
        private void btnGhi_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!this.validateDH.validate(txtNhaCC))
            {
                return;
            }

            if (!isEdit)
            {
                if (SP.isDDH(txtMaDDH.Text))
                {
                    MessageBox.Show("Đơn Hàng đã tồn tại", "THÔNG BÁO", MessageBoxButtons.OK);
                    this.trangThai1();
                    btnCTDH.Enabled = false;
                    return;
                }
            }

            try
            {
                this.updateTableAdapter();
                MessageBox.Show("Ghi thành công", "THÔNG BÁO", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ghi thất bại\n" + ex.Message + "", "THÔNG BÁO\n", MessageBoxButtons.OK);
            }
            this.trangThai2();
        }
Exemplo n.º 3
0
 private void btnThem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     this.trangThai1();
     vitri = bdsKho.Position;
     bdsKho.AddNew();
     txtMaKho.Text = SP.sinhMaKho();
     isEdit        = false;
     type          = 1; //them
 }
Exemplo n.º 4
0
 private void checkAcount(String maNV)
 {
     if (SP.isAccount(maNV))
     {
         btnDK.Enabled = false;
         btnDK.Text    = "Đã Đăng Kí";
     }
     else
     {
         btnDK.Enabled = true;
         btnDK.Text    = "Đăng Kí";
     }
 }
Exemplo n.º 5
0
        private void btnDK_Click(object sender, EventArgs e)
        {
            if (txtPass.Text != txtCPass.Text)
            {
                MessageBox.Show("Mật khẩu không khớp", "THÔNG BÁO", MessageBoxButtons.OK);
                return;
            }

            if (SP.register(this.loginName, this.userName, txtCPass.Text, this.role))
            {
                MessageBox.Show("Đăng kí thành công", "THÔNG BÁO", MessageBoxButtons.OK);
                return;
            }
        }
Exemplo n.º 6
0
        private void btnGhi_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!validateCTDH.validate(txtSoLg, txtDonGia))
            {
                return;
            }

            if (!isEdit)
            {
                if (SP.isCTDDH(this.maDDH, this.maVT))
                {
                    bdsCTDDH.RemoveCurrent();
                    DialogResult rs = MessageBox.Show("Vật tư này đã tồn tại bạn có muốn đặt thêm", "THÔNG BÁO", MessageBoxButtons.YesNo);
                    if (rs == DialogResult.Yes)
                    {
                        SP.updateCTDDH(this.maDDH, this.maVT, int.Parse(txtSoLg.Text), float.Parse(txtDonGia.Text));
                        this.cTDDHTableAdapter.Fill(this.qLVT_DATHANGDataSet1.CTDDH);
                        this.trangThai2();
                        return;
                    }
                    else
                    {
                        this.trangThai2();
                        return;
                    }
                }
            }

            try
            {
                this.updateTableAdapter();
                MessageBox.Show("Ghi thành công", "THÔNG BÁO", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ghi thất bại\n" + ex.Message + "", "THÔNG BÁO\n", MessageBoxButtons.OK);
            }

            this.trangThai2();
        }
Exemplo n.º 7
0
        private void btnCTDH_Click(object sender, EventArgs e)
        {
            if (!isEdit)
            {
                if (SP.isDDH(txtMaDDH.Text))
                {
                    MessageBox.Show("Nhân viên đã tồn tại", "THÔNG BÁO", MessageBoxButtons.OK);
                    this.trangThai1();
                    return;
                }
            }

            try
            {
                this.updateTableAdapter();

                new fmChiTietDatHang(txtMaDDH.Text).Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ghi thất bại\n" + ex.Message + "", "THÔNG BÁO\n", MessageBoxButtons.OK);
            }
            this.trangThai2();
        }