public static int EliminarFactura(FacturaNE fNE) { IDbConnection con = CapaDA.DBComun.Conexion(); con.Open(); SqlCommand Comand = new SqlCommand("DELETE from Factura WHERE NumeroFactura=@NumeroFactura", con as SqlConnection); Comand.Parameters.Add(new SqlParameter("@NumeroFactura", fNE.NumeroFactura)); int Resultado = Comand.ExecuteNonQuery(); con.Close(); return(Resultado); }
public static int AgregarFactura(FacturaNE fNE) { IDbConnection con = CapaDA.DBComun.Conexion(); con.Open(); SqlCommand Comand = new SqlCommand("IF NOT EXISTS (SELECT NumeroFactura FROM Factura WHERE NumeroFactura = @NumeroFactura)INSERT INTO Factura ( NumeroFactura, Fecha , CuitProveedor, NombreProveedor, TotalImporte) VALUES ( @NumeroFactura, @Fecha , @CuitProveedor, @NombreProveedor, @TotalImporte)", con as SqlConnection); Comand.Parameters.Add(new SqlParameter("@NumeroFactura", fNE.NumeroFactura)); Comand.Parameters.Add(new SqlParameter("@Fecha", fNE.Fecha)); Comand.Parameters.Add(new SqlParameter("@CuitProveedor", fNE.NumeroProveedor)); Comand.Parameters.Add(new SqlParameter("@NombreProveedor", fNE.NombreProveedor)); Comand.Parameters.Add(new SqlParameter("@TotalImporte", fNE.TotalImporte)); int Resultado = Comand.ExecuteNonQuery(); con.Close(); return(Resultado); }
public static int ModificarFactura(FacturaNE eNE) { IDbConnection con = CapaDA.DBComun.Conexion(); con.Open(); SqlCommand Comand = new SqlCommand(" UPDATE Factura SET Fecha=@Fecha , CuitProveedor=@CuitProveedor , NombreProveedor=@NombreProveedor, TotalImporte=@TotalImporte WHERE NumeroFactura = @NumeroFactura", con as SqlConnection); Comand.Parameters.Add(new SqlParameter("@NumeroFactura", eNE.NumeroFactura)); Comand.Parameters.Add(new SqlParameter("@Fecha", eNE.Fecha)); Comand.Parameters.Add(new SqlParameter("@CuitProveedor", eNE.NumeroProveedor)); Comand.Parameters.Add(new SqlParameter("@NombreProveedor", eNE.NombreProveedor)); Comand.Parameters.Add(new SqlParameter("@TotalImporte", eNE.TotalImporte)); int Resultado = Comand.ExecuteNonQuery(); con.Close(); return(Resultado); }
public List <FacturaNE> TraerUltimoNumeroFactura() { IDbConnection con = DBComun.Conexion(); con.Open(); SqlCommand _Command = new SqlCommand("SELECT( max(NumeroFactura)+1) from Factura", con as SqlConnection); // _Command.CommandType = CommandType.StoredProcedure; IDataReader reader = _Command.ExecuteReader(); List <FacturaNE> Lista = new List <FacturaNE>(); while (reader.Read()) { FacturaNE ObjetoFacturaNE = new FacturaNE(); ObjetoFacturaNE.NumeroFactura = reader.GetInt32(0); Lista.Add(ObjetoFacturaNE); } con.Close(); return(Lista); }
public List <FacturaNE> MostrarFactura() { IDbConnection con = DBComun.Conexion(); con.Open(); SqlCommand _Command = new SqlCommand("SELECT * From Factura", con as SqlConnection); IDataReader reader = _Command.ExecuteReader(); List <FacturaNE> Lista = new List <FacturaNE>(); while (reader.Read()) { FacturaNE ObjetoFacturaNE = new FacturaNE(); ObjetoFacturaNE.NumeroFactura = reader.GetInt32(0); ObjetoFacturaNE.Fecha = reader.GetDateTime(1); ObjetoFacturaNE.NumeroProveedor = reader.GetInt32(2); ObjetoFacturaNE.NombreProveedor = reader.GetString(3); ObjetoFacturaNE.TotalImporte = reader.GetDouble(4); Lista.Add(ObjetoFacturaNE); } con.Close(); return(Lista); }
public int ModificarFactura(FacturaNE fac) { return(FacturaDA.ModificarFactura(fac)); }
public int EliminarFactura(FacturaNE fac) { return(FacturaDA.EliminarFactura(fac)); }
public int AgregarFactura(FacturaNE fac) { return(CapaDA.FacturaDA.AgregarFactura(fac)); }