private string TenSP() { foreach (var item in DoUong.DSDU()) { if (this.IDDoUong == item.IDDoUong) { return(item.TenDoUong); } } return(" Null"); }
private string DVT() { foreach (var item in DoUong.DSDU()) { if (this.IDDoUong == item.IDDoUong) { return(item.DonViTinh); } } return("Not Name"); }
private void btnSuaDU_Click(object sender, EventArgs e) { try { var o = new DoUong() { IDDoUong = int.Parse(txt2MaDU.Text), TenDoUong = txtTenDU.Text, IDLoai = int.Parse(cbbLoaiDU.SelectedValue.ToString()), GiaGoc = double.Parse(txtGiaGoc.Text), GiaBan = double.Parse(txtGiaBan.Text), SoLuong = int.Parse(txtSoLuong.Text), NgayNhapHang = dtpkNgayNhap.Value, DonViTinh = cbbDVT.Text, }; using (var k = new AppCode.QuanCafe()) { var kq = k.SuaDoUong(o); if (kq == true) { LoadDSDoUong(); MessageBox.Show("Sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("Sửa thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } catch { return; } }