public void EditarDetalleCompra(int id) { FAJA_MODELDataContext dc = new FAJA_MODELDataContext(); Detail_Buy_Bill Compra = dc.Detail_Buy_Bill.First(c => c.DetBuyBil_PK == id); Compra.DetBuyBil_Status = "A"; dc.SubmitChanges(); Product_Detail Producto = dc.Product_Detail.First(c => c.ProDet_PK == Compra.DetBuyBil_FK_DetPro); Producto.ProDet_Quantity = Producto.ProDet_Quantity + Compra.DetBuyBil_Quantity; dc.SubmitChanges(); }
public void RegistrarDetalleCompra(int idCompra, int detpro, double precio, int cantidad) { FAJA_MODELDataContext dc = new FAJA_MODELDataContext(); Detail_Buy_Bill Compra = new Detail_Buy_Bill(); Compra.DetBuyBil_FK_DetPro = detpro; Compra.DetBuyBil_BuyPrice = precio; Compra.DetBuyBil_FK_BuyBil = idCompra; Compra.DetBuyBil_Quantity = cantidad; Compra.DetBuyBil_Status = "P"; dc.Detail_Buy_Bill.InsertOnSubmit(Compra); dc.SubmitChanges(); }
public void EliminarDetalleCompra(int id) { FAJA_MODELDataContext dc = new FAJA_MODELDataContext(); Detail_Buy_Bill Compra = dc.Detail_Buy_Bill.First(c => c.DetBuyBil_PK == id); if (Compra.DetBuyBil_Status.Equals("A")) { Product_Detail Producto = dc.Product_Detail.First(c => c.ProDet_PK == Compra.DetBuyBil_FK_DetPro); Producto.ProDet_Quantity = Producto.ProDet_Quantity - Compra.DetBuyBil_Quantity; dc.SubmitChanges(); } Compra.DetBuyBil_Status = "I"; dc.SubmitChanges(); }