Ejemplo n.º 1
0
 private void them()
 {
     try
     {
         if (txtMaNV.Text == "" || txtMaBH.Text == "" || txtNoiCap.Text == "")
         {
             MessageBox.Show("Vui lòng điều đẩy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             XuLyBaoHiem xl = new XuLyBaoHiem();
             if (xl.InsertBH(txtMaNV.Text, long.Parse(txtMaBH.Text), DateTime.Parse(dtNgayCap.Text), DateTime.Parse(dtNgayHetHan.Text), txtNoiCap.Text))
             {
                 MessageBox.Show("Thêm thành công", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Thêm không thành công", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             dgvBaoHiem.DataSource = xl.LoadBH();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Vui lòng điều đúng thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }