コード例 #1
0
ファイル: FormTuyenSinhThem.cs プロジェクト: leonard-git/DSS
 private void buttonLuu_Click(object sender, EventArgs e)
 {
     try
     {
         ExcuteSql.excuteCom(sql1());
         MessageBox.Show("Lưu thành công.");
         FormTuyenSinh fts = new FormTuyenSinh(id, Nam.Text);
         this.Close();
     }
     catch
     {
         MessageBox.Show("Lỗi! Kiểm tra lại thông tin trên form.");
     }
 }
コード例 #2
0
 private void buttonLuu_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(MaTruong.Text) || string.IsNullOrEmpty(TenTruong.Text) || string.IsNullOrEmpty(DiaChi.Text) || string.IsNullOrEmpty(BQL.Text) || string.IsNullOrEmpty(Website.Text))
         {
             MessageBox.Show("Các thông tin phải nhập đầy đủ.");
         }
         else
         {
             ExcuteSql.excuteCom(sql1());
             MessageBox.Show("Lưu thành công");
             this.Close();
         }
     }
     catch
     {
         MessageBox.Show("Lỗi! Kiểm tra lại thông tin trên form.");
     }
 }
コード例 #3
0
 private void buttonXoa_Click(object sender, EventArgs e)
 {
     try
     {
         string idDel         = dataGridViewTruong.CurrentRow.Cells[0].Value.ToString();
         string sql           = "DELETE FROM Truong WHERE MaTruong ='" + idDel + "'"; //Xóa theo mã trường
         var    confirmResult = MessageBox.Show("Bạn chắc chắn muốn xóa trường " + dataGridViewTruong.CurrentRow.Cells[1].Value.ToString() + "?",
                                                "Xóa trường!",
                                                MessageBoxButtons.YesNo);
         if (confirmResult == DialogResult.Yes)
         {
             ExcuteSql.excuteCom(sql);
             MessageBox.Show("Xóa thành công");
             resetForm();
         }
     }
     catch
     {
         MessageBox.Show("Không thể xóa!");
     }
 }