private void ActualizarInvProducto(int pkDetalle, double pCantidad) { try { DataClasses1DataContext dc = new DataClasses1DataContext(); SIGEEA_DetInvProducto detalle = dc.SIGEEA_DetInvProductos.First(c => c.PK_Id_DetInvProductos == pkDetalle); if (pCantidad <= 0) { detalle.Cantidad_DetInvProductos += 0; } else { detalle.Cantidad_DetInvProductos += pCantidad; } detalle.PK_Id_DetInvProductos = detalle.PK_Id_DetInvProductos; detalle.FK_Id_InvProductos = detalle.FK_Id_InvProductos; detalle.FK_Id_TipProducto = detalle.FK_Id_TipProducto; detalle.FK_Id_UniMedida = detalle.FK_Id_UniMedida; dc.SubmitChanges(); } catch (Exception ex) { throw new ArgumentException("Error al actualizar: " + ex.Message); } }
/// <summary> /// SumarInventario /// </summary> /// <param name="PK_Id_TipProducto, Cantidad"></param> public void SumarInventario(int pIdTipProducto, double Cantidad) { DataClasses1DataContext dc = new DataClasses1DataContext(); SIGEEA_DetInvProducto detInvPro = dc.SIGEEA_DetInvProductos.First(c => c.FK_Id_TipProducto == pIdTipProducto); detInvPro.Cantidad_DetInvProductos = Cantidad; dc.SubmitChanges(); }
private void InsertarInvProducto(int pkUMedida, int pkProducto, double pCantidad) { try { DataClasses1DataContext dc = new DataClasses1DataContext(); SIGEEA_DetInvProducto detalle = new SIGEEA_DetInvProducto(); detalle.FK_Id_InvProductos = 1; detalle.FK_Id_TipProducto = pkProducto; detalle.FK_Id_UniMedida = pkUMedida; detalle.Cantidad_DetInvProductos = pCantidad; dc.SIGEEA_DetInvProductos.InsertOnSubmit(detalle); dc.SubmitChanges(); } catch (Exception ex) { throw new ArgumentException("Error al actualizar: " + ex.Message); } }