private void btnThem_Click(object sender, EventArgs e) { DataTable db = new DataTable(); db = PhieuXuatCtrl.GetData(); string a = ""; if (db.Rows.Count <= 0) { a = "PX01"; } else { int k; a = "px"; k = int.Parse(db.Rows[db.Rows.Count - 1][0].ToString().Trim().Substring(2, 2)); k = k + 1; string tam = k.ToString(); for (int i = 0; i < (2 - tam.Length); i++) { a += "0"; } a = a + k.ToString(); } txtMaPhieu.Text = a; check = 1; txtMaPhieu.Enabled = false; dtpNgay.Enabled = true; cboKhachHang.Enabled = true; cboNhanVien.Enabled = true; txtTimKiem.Enabled = false; btnHuy.Enabled = true; btnThem.Enabled = false; btnSua.Enabled = false; btnXoa.Enabled = false; btnLuu.Enabled = true; dgvPhieuXuat.Enabled = false; dtpNgay.Text = ""; cboNhanVien.Text = ""; cboKhachHang.Text = ""; // }
public void LoadData() { dt1 = new DataTable(); dt1 = PhieuXuatCtrl.GetData(); dgvPhieuXuat.DataSource = dt1; txtMaPhieu.Enabled = false; cboKhachHang.Enabled = false; cboNhanVien.Enabled = false; dtpNgay.Enabled = false; txtTimKiem.Enabled = true; btnHuy.Enabled = false; btnLuu.Enabled = false; btnThem.Enabled = true; btnSua.Enabled = true; btnXoa.Enabled = true; HuyChucNang(); }