コード例 #1
0
ファイル: frmkhachhang.cs プロジェクト: ngochien1999/TTCM
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         makh           = dataGridView1.CurrentRow.Cells[0].Value.ToString();
         txtten.Text    = dataGridView1.CurrentRow.Cells[1].Value.ToString();
         txttuoi.Text   = dataGridView1.CurrentRow.Cells[2].Value.ToString();
         txtsdt.Text    = dataGridView1.CurrentRow.Cells[3].Value.ToString();
         txtdiachi.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
         txtcmnd.Text   = dataGridView1.CurrentRow.Cells[5].Value.ToString();
         txtemail.Text  = dataGridView1.CurrentRow.Cells[6].Value.ToString();
         btnsua.Enabled = true;
     }
     catch
     {
         btnsua.Enabled = false;
     }
     if (e.ColumnIndex == 7)
     {
         if (MessageBox.Show("Bạn có muốn xóa nhà khách hàng không ?", "xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
             {
                 quanli.deletekh(makh);
                 MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                 Form8_Load(sender, e);
             }
         }
     }
 }
コード例 #2
0
ファイル: frmkhachhang.cs プロジェクト: ngochien1999/TTCM
 private void gunaButton3_Click(object sender, EventArgs e)
 {
     using (QLBCMBEntities3 quanli = new QLBCMBEntities3())
     {
         quanli.deletekh(makh);
         quanli.SaveChanges();
         MessageBox.Show("đã xóa", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         Form8_Load(sender, e);
     }
 }