public static FacturaActiveRecord BuscarUno(int numeroFactura)
 {
     using (SqlConnection conexion = new SqlConnection(CadenaConexion()))
     {
         conexion.Open();
         String     sql     = "select * from Facturas where numero= @numeroFactura";
         SqlCommand comando = new SqlCommand(sql, conexion);
         comando.Parameters.AddWithValue("@numeroFactura", numeroFactura);
         SqlDataReader lector = comando.ExecuteReader();
         if (lector.Read())
         {
             FacturaActiveRecord f = new FacturaActiveRecord(Convert.ToInt32(lector["numero"]), Convert.ToString(lector["concepto"]));
             return(f);
         }
         else
         {
             throw new Exception("No se ha encontrado la factura");
         }
     }
 }
Esempio n. 2
0
 static void Main(string[] args)
 {
     Console.WriteLine(FacturaActiveRecord.UnidadesTotales());
     Console.ReadLine();
 }