Beispiel #1
0
 public WorkPart(string id, string description, decimal price, int quantity, Work work)
     : base(id, description, price)
 {
     Quantity = quantity;
     parentWork = work;
 }
Beispiel #2
0
 public static Invoice Find(Work work)
 {
     try
     {
         using (SqlConnection conn = Db.Utils.NewConnection())
         {
             using (SqlCommand cmd = new SqlCommand(
                 "select numFact, dataFact, estadoFact, desconto, totalFactura, cliente " +
                 "from Factura where obra = @obra and oficina = @oficina", conn))
             {
                 cmd.Parameters.AddWithValue("@obra", work.ID);
                 cmd.Parameters.AddWithValue("@oficina", work.ShopID);
                 using (SqlDataReader dr = cmd.ExecuteReader())
                 {
                     if (dr.Read())
                     {
                         return new Invoice(dr.GetInt32(0), dr.GetDateTime(1), dr.GetString(2),
                             dr.GetInt32(3), dr.GetDecimal(4), work.ID, work.ShopID, dr.GetInt32(5));
                     }
                 }
             }
         }
     }
     catch (SqlException ex)
     {
         throw new ModelException("Erro na base de dados.", ex.InnerException);
     }
     return null;
 }