private void btnLuu_Click(object sender, EventArgs e)
 {
     if (ValidateData())
     {
         obj.TenLoaiHang = txtTenLoaiHang.Text;
         obj.MoTa        = txtMoTa.Text;
         obj.TinhTrang   = cbTrangThai.Checked ? 1 : 0;
         bus.Insert(obj);
         XtraMessageBox.Show("Thêm loại hàng thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
 }
Exemplo n.º 2
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     obj.IDLoaiHang = txtMaLoaiHang.Text;
     obj.TenLoai    = txtTenLoaiHang.Text;
     obj.MoTa       = txtMoTa.Text;
     if (isInsert)
     {
         //insert
         bus.Insert(obj);
         XtraMessageBox.Show("Thêm Thông tin Thành công");
         HienThi();
         XoaText();
         KhoaDieuKhien();
     }
     else
     {
         //update
         bus.Update(obj);
         XtraMessageBox.Show("Sửa Thông tin Thành công");
         HienThi();
         XoaText();
         KhoaDieuKhien();
     }
 }