public override bool Buscar(int IdBuscado) { DbConexion conexion = new DbConexion(); DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); bool retornar = true; try { dt = conexion.ObtenerDatos("SELECT * FROM Solicitudes WHERE IdSolicitud=" + IdBuscado); if (dt.Rows.Count > 0) { this.IdSolicitud = (int)dt.Rows[0]["IdSolicitud"]; this.Fecha = dt.Rows[0]["Fecha"].ToString(); this.Razon = dt.Rows[0]["Razon"].ToString(); this.Total = Convert.ToSingle(dt.Rows[0]["Total"]); dt2 = conexion.ObtenerDatos("SELECT * FROM SolicitudesDetalle WHERE IdSolicitud=" + IdBuscado); foreach (DataRow item in dt2.Rows) { this.InsertarMaterial(IdBuscado, (int)item["IdMaterial"], (int)item["Cantidad"], (float)item["Precio"]); } } return(dt.Rows.Count > 0); } catch (Exception) { retornar = false; } return(retornar); }
public override bool Buscar(int IdBuscar) { DbConexion cone = new DbConexion(); DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); bool Retornar = false; try { dt = cone.ObtenerDatos("Select * from Ventas where ventaId = " + IdBuscar); if (dt.Rows.Count > 0) { this.VetaId = (int)dt.Rows[0]["VentaId"]; this.Monto = Convert.ToSingle(dt.Rows[0]["Monto"]); this.Fecha = dt.Rows[0]["Fecha"].ToString(); dt2 = cone.ObtenerDatos(String.Format("Select * from VentasDetalle where VentaId = {0}", IdBuscar)); foreach (DataRow row in dt2.Rows) { AgregarArticulos((int)row["ArticuloId"], (int)row["Cantidad"], Convert.ToSingle(row["Precio"])); } } return(dt.Rows.Count > 0); }catch (Exception) { Retornar = false; } return(Retornar); }
public override bool Buscar(int IdBuscar) { DataTable dt = new DataTable(); DataTable dtDetalle = new DataTable(); DbConexion cone = new DbConexion(); try { dt = cone.ObtenerDatos(String.Format("Select * from Material where MaterialId=)" + IdBuscar)); this.MaterialId = (int)dt.Rows[0]["MaterialId"]; this.Razon = dt.Rows[0]["Razon"].ToString(); dtDetalle = cone.ObtenerDatos(String.Format("Select * from MaterialDetalle where MaterialId+", IdBuscar)); if (dt.Rows.Count > 0) { foreach (DataRow row in dtDetalle.Rows) { AgregarMateriales(row[0].ToString(), (int)row[0]); } } }catch (Exception ex) { throw ex; } return(dt.Rows.Count > 0); }
public override DataTable Listado(string Campos, string Condicion, string Orden) { DbConexion conexion = new DbConexion(); string ordenar = ""; if (!Orden.Equals("")) { ordenar = " orden by " + Orden; } return(conexion.ObtenerDatos(("SELECT " + Campos + " FROM Solicitudes WHERE " + Condicion + ordenar))); }
public override DataTable Listar(string Campo, string Condicion, string Orden) { throw new NotImplementedException(); DbConexion cone = new DbConexion(); string OrdenFinal = ""; if (!Orden.Equals("")) { OrdenFinal = "Orden by" + Orden; } return(cone.ObtenerDatos("Select " + Campo + "from MaterialesDetalle where " + Condicion + Orden)); }
public override DataTable Listar(string Campo, string Condicion, string Orden) { DataTable dt = new DataTable(); DbConexion cone = new DbConexion(); string OrdenFinal = ""; if (!Orden.Equals("")) { OrdenFinal = "Order by " + Orden; } return(cone.ObtenerDatos(String.Format("Select " + Campo + " from Ventas as v inner join VentasDetalle d on v.ventasId = d.VentasId " + Condicion + " " + OrdenFinal))); }
public DataTable Listar(string Campo, string Condicion, string Orden) { DataTable dt = new DataTable(); DbConexion cone = new DbConexion(); string OrdenFinal = ""; if (!Orden.Equals("")) { OrdenFinal = "Order by " + Orden; } return(dt = cone.ObtenerDatos(String.Format("Select * from Articulos "))); }
public void ObtenerDatosArticulo(int Articulo) { DbConexion cone = new DbConexion(); DataTable dt = new DataTable(); try { dt = cone.ObtenerDatos(String.Format("Select * from Articulos where ArticuloId ={0}", Articulo)); if (dt.Rows.Count > 0) { this.ArticuloId = (int)dt.Rows[0]["ArticuloId"]; this.Precio = Convert.ToSingle(dt.Rows[0]["Precio"]); this.Existencia = (int)dt.Rows[0]["Existencia"]; } }catch (Exception ex) { throw ex; } }
public override bool Buscar(int IdBuscado) { DbConexion conexion = new DbConexion(); DataTable dt = new DataTable(); bool retornar = true; try { dt = conexion.ObtenerDatos("SELECT * FROM Materiales WHERE IdMaterial=" + IdBuscado); if (dt.Rows.Count > 0) { this.IdMaterial = (int)dt.Rows[0]["IdMaterial"]; this.Descripcion = dt.Rows[0]["Descripcion"].ToString(); this.Precio = Convert.ToSingle(dt.Rows[0]["Precio"]); } }catch (Exception) { retornar = false; } return(retornar); }
public string PrecioDetalle(string material) { string retorno = ""; DbConexion conexion = new DbConexion(); DataTable dt = new DataTable(); bool retornar = true; try { dt = conexion.ObtenerDatos("SELECT * FROM Materiales WHERE Descripcion =" + material); if (dt.Rows.Count > 0) { this.IdMaterial = (int)dt.Rows[0]["IdMaterial"]; this.Descripcion = dt.Rows[0]["Descripcion"].ToString(); this.Precio = Convert.ToSingle(dt.Rows[0]["Precio"]); } } catch (Exception) { retornar = false; } return(retorno); }