示例#1
0
 private void btnxoa_Click(object sender, EventArgs e)
 {
     NGONNGU inf = new NGONNGU();
     inf.ngonngu1 = dgvngonngu.SelectedRows[0].Cells[0].Value.ToString();
     data.xoaNgonNgu(inf);
     dgvngonngu.DataSource = data.loadNgonNgu();
     MessageBox.Show("Đã xóa!");
 }
示例#2
0
        public void xoaNgonNgu(NGONNGU inf)
        {
            var temp = data.NGONNGUs.Find(inf.ngonngu1);

            if (temp != null)
            {
                data.NGONNGUs.Remove(temp);
                data.SaveChanges();
            }
        }
示例#3
0
 public void suaNgonNgu(NGONNGU bef, NGONNGU aft)
 {
     SqlCommand sql = new SqlCommand();
     sql.CommandText = "update NGONNGU set ngonngu = @nn where ngonngu = @nn1";
     sql.CommandType = CommandType.Text;
     sql.Parameters.AddWithValue("@nn", aft.ngonngu1);
     sql.Parameters.AddWithValue("@nn1", bef.ngonngu1);
     sql.Connection = DataProvider.con;
     sql.ExecuteNonQuery();
 }
示例#4
0
 private void btnthem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtngonngu.Text))
         return;
     NGONNGU inf = new NGONNGU();
     inf.ngonngu1 = txtngonngu.Text;
     data.themNgonNgu(inf);
     txtngonngu.Clear();
     MessageBox.Show("Đã thêm!");
     dgvngonngu.DataSource = data.loadNgonNgu();
 }
示例#5
0
 public void themNgonNgu(NGONNGU inf)
 {
     data.NGONNGUs.Add(inf);
     data.SaveChanges();
 }
示例#6
0
 public void xoaNgonNgu(NGONNGU inf)
 {
     data.xoaNgonNgu(inf);
 }
示例#7
0
 public void themNgonNgu(NGONNGU inf)
 {
     data.themNgonNgu(inf);
 }
示例#8
0
 public void suaNgonNgu(NGONNGU bef, NGONNGU aft)
 {
     data.suaNgonNgu(bef, aft);
 }