private void btnLoad_Click(object sender, EventArgs e) { using (var cmd = new NhaCungCapListRepository()) { this.nhaCungCapBindingSource.DataSource = cmd.Execute(); } }
private void btnDel_Click(object sender, EventArgs e) { var cur = this.nhaCungCapBindingSource.Current as NhaCungCap.Domain.NhaCungCap; if (cur != null && !string.IsNullOrWhiteSpace(cur.NhacungcapId)) { using (var cmd = new NhaCungCapDeleteRepository()) { cmd.NhacungcapId = cur.NhacungcapId; cmd.Execute(); } using (var cmd = new NhaCungCapListRepository()) { this.nhaCungCapBindingSource.DataSource = cmd.Execute(); } } }
private void btnEdit_Click(object sender, EventArgs e) { var listcur = this.nhaCungCapBindingSource.DataSource as List <NhaCungCap.Domain.NhaCungCap>; if (listcur != null) { using (var cmd = new NhaCungCapSaveBusiness()) { foreach (var item in listcur) { cmd.item = item; cmd.Execute(); } } using (var cmd = new NhaCungCapListRepository()) { this.nhaCungCapBindingSource.DataSource = cmd.Execute(); } } }