Esempio n. 1
0
 public Boolean ktmaxktrung()
 {
     if (XUATKHODAO.KiemTraMaXKTrung(dsXK, txtMaXK.Text.Trim()))
     {
         MessageBox.Show("Đã có mã xuất kho này trong dữ liệu, không thể lưu");
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (kttontaimaxk())
     {
         DialogResult dlr = MessageBox.Show("Bạn có chắc muốn xóa dữ liệu xuất kho này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
         if (dlr == DialogResult.Yes)
         {
             String sql = "delete from phieuxuat_kho where mapx = '" + txtMaXK.Text.Trim() + "'";
             cn.themxoasua(sql);
             XUATKHODAO.XoaXK(dsXK, txtMaXK.Text.Trim());
             dgvXK.Rows.RemoveAt(indexXK);
             MessageBox.Show("Xóa thành công");
         }
     }
 }
Esempio n. 3
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (kttxtxk() && ktmaxktrung())
     {
         DialogResult dlr = MessageBox.Show("Bạn có chắc muốn lưu dữ liệu xuất kho này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
         if (dlr == DialogResult.Yes)
         {
             String sql = "set dateformat dmy insert into phieuxuat_kho values ('" + txtMaXK.Text.Trim() + "', '" + dateNgayLap.Text.Trim() + "', '" + DangNhap.MaNV + "', N'" + txtGhiChu.Text.Trim() + "')";
             cn.themxoasua(sql);
             XUATKHODAO.ThemXK(dsXK, txtMaXK.Text.Trim(), dateNgayLap.Text.Trim(), DangNhap.MaNV, txtGhiChu.Text.Trim());
             dgvXK.Rows.Add(txtMaXK.Text.Trim(), dateNgayLap.Text.Trim(), DangNhap.MaNV, txtGhiChu.Text.Trim());
             cbboxMaXK.Items.Add(txtMaXK.Text.Trim());
             MessageBox.Show("Thêm thành công");
         }
     }
 }
Esempio n. 4
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            DialogResult dlr = MessageBox.Show("Bạn có chắc muốn tạo dữ liệu xuất kho này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (dlr == DialogResult.Yes)
            {
                txtMaXK.Text        = XUATKHODAO.KiemTraMaXKTuDongTang(dsXK, XUATKHODAO.MaXKTuDong(dsXK));
                txtGhiChu.Enabled   = true;
                txtSoLuong.Enabled  = true;
                dateNgayLap.Enabled = true;
                btnThem.Enabled     = false;
                btnLuu.Enabled      = true;
                btnXoa.Enabled      = false;
                btnSua.Enabled      = false;
                dateNgayLap.Focus();
            }
        }
Esempio n. 5
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (kttxtxk())
     {
         DialogResult dlr = MessageBox.Show("Bạn có chắc muốn sửa dữ liệu xuất kho này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
         if (dlr == DialogResult.Yes)
         {
             String sql = "set dateformat dmy update phieuxuat_kho set ngaylap = '" + dateNgayLap.Text.Trim() + "', ghichu = N'" + txtGhiChu.Text.Trim() + "' where mapx = '" + txtMaXK.Text.Trim() + "'";
             cn.themxoasua(sql);
             XUATKHODAO.SuaXK(dsXK, txtMaXK.Text.Trim(), dateNgayLap.Text.Trim(), txtGhiChu.Text.Trim());
             DataGridViewRow row = dgvXK.Rows[indexXK];
             row.Cells[1].Value = dateNgayLap.Text.Trim();
             row.Cells[3].Value = txtGhiChu.Text.Trim();
             MessageBox.Show("Sửa thành công");
         }
     }
 }