public void AgregarDetalle(string Descripcion,Decimal Monto) { if (this.Items == null) this.Items = new List<clsDetalleGastos>(); /* var query = from i in this.Items where i.Producto.Producto_Id == Prod.Producto_Id && i.Comanda.IdComanda == com.IdComanda select i; if (query.Count() == 0) { */ clsDetalleGastos item = new clsDetalleGastos(); item.Descripcion = Descripcion; item.Monto = Monto; this.Items.Add(item); this.Total += Math.Round(item.Monto, 2); /* } else { clsDetalleGastos item = query.First(); item.Cantidad = item.Cantidad + Cantidad; item.SubTotal = item.Cantidad * Prod.Producto_Precio; this.Total += Math.Round(item.SubTotal, 2); }*/ }
public Boolean RegistrarDetalleGastos(clsDetalleGastos Gastos) { SqlCommand cmd = new SqlCommand("PA_REGISTRAR_DetalleGASTOS", cnx); cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramId = new SqlParameter("IdDetalleGastos", SqlDbType.Int, 8); paramId.Direction = ParameterDirection.Output; cmd.Parameters.Add(paramId); cmd.Parameters.AddWithValue("Descripcion", Gastos.Descripcion); cmd.Parameters.AddWithValue("Monto", Gastos.Monto); cmd.Parameters.AddWithValue("IdGasto", Gastos.Gastos.IdGastos); cnx.Open(); Int32 i = cmd.ExecuteNonQuery(); cnx.Close(); if (i == 1) return true; Gastos.IdDetalleGasto = Convert.ToInt32(paramId.Value); return false; }
public Boolean GuardarDetalleGasto(clsDetalleGastos Gastos) { clsDetalleGastosDAO dal = new clsDetalleGastosDAO(); return dal.RegistrarDetalleGastos(Gastos); }