Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var cur = this.hangHoaBindingSource.Current as HangHoa.Domain.HangHoa;

            if (cur != null && !string.IsNullOrWhiteSpace(cur.HanghoaId))
            {
                using (var cmd = new HangHoaDeleteRepository())
                {
                    cmd.hangHoaId = cur.HanghoaId;
                    cmd.Execute();
                }
                using (var cmd = new HangHoaListRepository())
                {
                    this.hangHoaBindingSource.DataSource = cmd.Execute();
                }
            }
        }
Пример #2
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     try
     {
         var cur = this.hangHoaBindingSource.Current as HangHoa.Domain.HangHoa;
         if (cur != null && !string.IsNullOrWhiteSpace(cur.HanghoaId))
         {
             using (var cmd = new HangHoaDeleteRepository())
             {
                 cmd.hangHoaId = cur.HanghoaId;
                 cmd.Execute();
             }
             using (var cmd = new HangHoaListRepository())
             {
                 this.hangHoaBindingSource.DataSource = cmd.Execute();
             }
         }
     }
     catch
     {
         MessageBox.Show("Lỗi không xác định, vui lòng thử lại!", "THÔNG BÁO!", MessageBoxButtons.OK);
     }
 }