Exemple #1
0
 private void bntthem_Click(object sender, EventArgs e)
 {
     if (this.txtma.TextLength == 0)
     {
         MessageBox.Show("Mã không được để trống");
         this.txtma.Focus();
     }
     else if (this.txtten.TextLength == 0)
     {
         MessageBox.Show("Tên không được để trống");
         this.txtten.Focus();
     }
     else
     {
         try
         {
             ctpn.Insertsv(txtma.Text, txtten.Text, gt, cbquequan.SelectedItem.ToString());
             MessageBox.Show("Đã thêm dự án thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Form1_Load(sender, e);
         }
         catch
         {
             MessageBox.Show("Mã dự án " + this.txtma.Text + " đã tồn tại");
         }
     }
 }
 private void bntThem_Click(object sender, EventArgs e)
 {
     if (this.txtma.TextLength == 0)
     {
         MessageBox.Show("Mã không được để trống");
         this.txtma.Focus();
     }
     else if (this.txtten.TextLength == 0)
     {
         MessageBox.Show("Tên không được để trống");
         this.txtten.Focus();
     }
     else if (this.txtnam.TextLength == 0)
     {
         MessageBox.Show("Năm không được để trống");
         this.txtnam.Focus();
     }
     else if (this.txtem.TextLength == 0)
     {
         MessageBox.Show("Email không được để trống");
         this.txtem.Focus();
     }
     else if (this.txtdt.TextLength == 0)
     {
         MessageBox.Show("Điện thoại không được để trống");
         this.txtdt.Focus();
     }
     else
     {
         try
         {
             ctpn.Insertsv(txtma.Text, txtten.Text, txtnam.Text, txtem.Text, txtdt.Text, cbmalop.SelectedValue.ToString());
             MessageBox.Show("Đã thêm dự án thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             frmSINHVIEN_Load(sender, e);
         }
         catch
         {
             MessageBox.Show("Mã dự án " + this.txtma.Text + " đã tồn tại");
         }
     }
 }