Beispiel #1
0
 private void BtnSua_Click(object sender, EventArgs e)
 {
     if (txtTen.Text == "" || txtQue.Text == "" || txtQuoctich.Text == "" || txtCongviec.Text == "")
     {
         errorProvider1.SetError(txtTen, "Bắt buộc phải điền đầy đủ thông tin!");
     }
     else
     {
         if (db.checkTacGia(txtTen.Text) == 0)
         {
             MessageBox.Show("Trùng Tác giả", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             db.SuaTG(Convert.ToInt32(txtMatg.Text), txtTen.Text, txtQue.Text, txtCongviec.Text, txtQuoctich.Text, dptNgaysinh.Value);
             DialogResult a = MessageBox.Show("Sửa thành công!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             if (a == DialogResult.OK)
             {
                 txtTen.Enabled      = false;
                 txtQue.Enabled      = false;
                 txtQuoctich.Enabled = false;
                 txtCongviec.Enabled = false;
                 dptNgaysinh.Enabled = false;
             }
             btnSua.Visible       = false;
             dgvTacGia.DataSource = db.TacGia_table();
         }
     }
 }