public bool DeleteProduct(bill_detail bd) { try { db.bill_details.DeleteOnSubmit(bd); db.SubmitChanges(); return true; } catch (Exception ex) { throw ex; } }
private void btnThemTrai_Click(object sender, EventArgs e) { btnLuuCT.Enabled = true; if (gvSanPham.SelectedRowsCount == 0) return; product p = (product)gvSanPham.GetFocusedRow(); if (busHoaDon.KiemTraTonTai(b, p)) { XtraMessageBox.Show("Sản phẩm đã tồn tại!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); return; } bill_detail bd = new bill_detail(); bd.id = b.id + p.id; bd.created = DateTime.Now; bd.quantity = (int)spSoLuong.Value; bd.monetized = (int)(spSoLuong.Value * p.price); bd.product = p; bd.bill = b; dgvCTPhieuBaoGia.DataSource = busHoaDon.GetProduct(b); }
private void detach_bill_details(bill_detail entity) { this.SendPropertyChanging(); entity.bill = null; }
partial void Deletebill_detail(bill_detail instance);
partial void Updatebill_detail(bill_detail instance);
partial void Insertbill_detail(bill_detail instance);
private void attach_bill_details(bill_detail entity) { this.SendPropertyChanging(); entity.product = this; }