public void cargarDatosVenta() { try { ConectarBD conect = new ConectarBD(); DataSet dataSet = new DataSet(); String sSQL; sSQL = "EXEC dbo.adp_obtenerDatosVenta "; sSQL = sSQL + " @Id_Venta = " + fg.fcSql(this.m_Id_Venta.ToString(), "INTEGER"); dataSet = conect.ejecutarQuerySelect(sSQL); foreach (DataRow dataRow in dataSet.Tables[0].Rows) { Articulo_Venta articulo_venta = new Articulo_Venta(); this.m_cantidad_articulos = Int32.Parse(dataRow["CANTIDAD_ARTICULOS"].ToString()); this.m_importe = Double.Parse(dataRow["IMPORTE"].ToString()); this.m_estado = Int32.Parse(dataRow["ESTADO"].ToString()); this.m_fecha_venta = DateTime.Parse(dataRow["FECHA_VENTA"].ToString()); this.m_hora_venta = dataRow["HORA_VENTA"].ToString(); this.cargarArticulosVenta(); } } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public void cargarArticulosVenta() { try { ConectarBD conect = new ConectarBD(); DataSet dataSet = new DataSet(); String sSQL; sSQL = "EXEC dbo.adp_obtenerArticulosVenta2 "; sSQL = sSQL + " @Id_Venta = " + fg.fcSql(this.m_Id_Venta.ToString(), "INTEGER"); dataSet = conect.ejecutarQuerySelect(sSQL); this.m_articulos_venta = new List<Articulo_Venta>(); foreach (DataRow dataRow in dataSet.Tables[0].Rows) { Articulo_Venta articulo_venta = new Articulo_Venta(); articulo_venta.m_id_venta = UInt64.Parse(dataRow["ID_VENTA"].ToString()); articulo_venta.m_id_item_venta = UInt64.Parse(dataRow["ID_ITEM_VENTA"].ToString()); articulo_venta.m_id_articulo = UInt64.Parse(dataRow["ID_ARTICULO"].ToString()); articulo_venta.m_cantidad = Int32.Parse(dataRow["CANTIDAD"].ToString()); articulo_venta.m_precio_venta = Double.Parse(dataRow["PRECIO_VENTA"].ToString()); this.m_articulos_venta.Add(articulo_venta); } } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }