예제 #1
0
 private void btnLoad_Click(object sender, EventArgs e)
 {
     using (var cmd = new NhomHangHoaListRepository())
     {
         this.nhomHangHoaBindingSource.DataSource = cmd.Execute();
     }
 }
예제 #2
0
 private void PhieuBanHang_Load(object sender, EventArgs e)
 {
     using (var cmd = new NhomHangHoaListRepository())
     {
         var data = cmd.Execute();
         this.cbbNhomHangHoa.DataSource    = data;
         this.cbbNhomHangHoa.DisplayMember = "TenNhomHanghoa";
         this.cbbNhomHangHoa.ValueMember   = "NhomHanghoaId";
     }
 }
예제 #3
0
 private void btnLoad_Click(object sender, EventArgs e)
 {
     try
     {
         using (var cmd = new NhomHangHoaListRepository())
         {
             this.nhomHangHoaBindingSource.DataSource = cmd.Execute();
         }
     }
     catch
     {
         MessageBox.Show("Tải dữ liệu thất bại. Xin thử lại sau!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            var cur = this.nhomHangHoaBindingSource.Current as NhomHangHoa.Domain.NhomHangHoa;

            if (cur != null && !string.IsNullOrWhiteSpace(cur.NhomHanghoaId) && cur.NhomHanghoaId != "")
            {
                using (var cmd = new NhomHangHoaDeleteRepository())
                {
                    cmd.NhomHanghoaId = cur.NhomHanghoaId;
                    cmd.Execute();
                }
                using (var cmd = new NhomHangHoaListRepository())
                {
                    this.nhomHangHoaBindingSource.DataSource = cmd.Execute();
                }
            }
        }
예제 #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            var listcur = this.nhomHangHoaBindingSource.DataSource as List <NhomHangHoa.Domain.NhomHangHoa>;

            if (listcur != null)
            {
                using (var cmd = new NhomHangHoaSaveBusiness())
                {
                    foreach (var item in listcur)
                    {
                        cmd.item = item;
                        cmd.Execute();
                    }
                }
                using (var cmd = new NhomHangHoaListRepository())
                {
                    this.nhomHangHoaBindingSource.DataSource = cmd.Execute();
                }
            }
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            var cur = this.nhomHangHoaBindingSource.Current as NhomHangHoa.Domain.NhomHangHoa;

            if (cur != null && !string.IsNullOrWhiteSpace(cur.NhomHanghoaId) && cur.NhomHanghoaId != "")
            {
                using (var cmd = new NhomHangHoaDeleteRepository())
                {
                    cmd.NhomHanghoaId = cur.NhomHanghoaId;
                    cmd.Execute();
                }
                using (var cmd = new NhomHangHoaListRepository())
                {
                    this.nhomHangHoaBindingSource.DataSource = cmd.Execute();
                }
            }
            else
            {
                MessageBox.Show("Mã nhóm hàng hóa không tồn tại!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }