private void btnLoad_Click(object sender, EventArgs e) { using (var cmd = new NhomHangHoaListRepository()) { this.nhomHangHoaBindingSource.DataSource = cmd.Execute(); } }
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"; } }
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); } }
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(); } } }
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(); } } }
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); } }