Example #1
0
 private void btnLoad_Click(object sender, EventArgs e)
 {
     using (var cmd = new KhachHangListRepository())
     {
         this.khachHangBindingSource.DataSource = cmd.Execute();
     }
 }
Example #2
0
 private void btnAdd_Click_1(object sender, EventArgs e)
 {
     try
     {
         var f = new frmAdd();
         if (f.ShowDialog() != DialogResult.OK)
         {
             using (var cmd = new KhachHangListRepository())
             {
                 this.khachHangBindingSource.DataSource = cmd.Execute();
             }
         }
     }
     catch
     {
         MessageBox.Show("Xảy ra lỗi không xác định!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var listcur = this.khachHangBindingSource.DataSource as List <KhachHang.Domain.KhachHang>;

            if (listcur != null)
            {
                using (var cmd = new KhachHangSaveBusiness())
                {
                    foreach (var item in listcur)
                    {
                        cmd.item = item;
                        cmd.Execute();
                    }
                }
                using (var cmd = new KhachHangListRepository())
                {
                    this.khachHangBindingSource.DataSource = cmd.Execute();
                }
            }
        }
Example #4
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         var cur = this.khachHangBindingSource.Current as KhachHang.Domain.KhachHang;
         if (cur != null && !string.IsNullOrWhiteSpace(cur.KhachhangId))
         {
             using (var cmd = new KhachHangDeleteRepository())
             {
                 cmd.KhachhangId = cur.KhachhangId;
                 cmd.Execute();
             }
             using (var cmd = new KhachHangListRepository())
             {
                 this.khachHangBindingSource.DataSource = cmd.Execute();
             }
         }
     }
     catch
     {
         MessageBox.Show("Xảy ra lỗi không xác định!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }