Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9653 for branches/OaaS


Ignore:
Timestamp:
06/24/13 14:04:56 (11 years ago)
Author:
spimming
Message:

#1888:

  • Set flag to indicate a modified model object
  • Add dao query method to specify includes as parameter
  • cleaned up the using of namespaces to qualify types
Location:
branches/OaaS/HeuristicLab.Services.Optimization.Billing
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/BillingEngine/BillingEngine.cs

    r9645 r9653  
    6161              // An invoice has never been generated from this order
    6262              order.NextBillableDay = currentDate;
     63              order.EntityState = State.Modified;
    6364            }
    6465
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/BillingEngine/PlainTextInvoiceFormattingEngine.cs

    r9641 r9653  
    3838    }
    3939
    40     public string Generate(Model.Invoice invoice) {
     40    public string Generate(Invoice invoice) {
    4141      invoiceText = string.Copy(template);
    4242
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingContext.cs

    r9645 r9653  
    2020    public DbSet<PaymentInformation> PaymentInformations { get; set; }
    2121
    22     // enum PaymentMethod
    23     // enum OrderState
    24 
    2522    public BillingContext()
    2623      : this("name=BillingContext") {
     
    3128      : base(connectionString) {
    3229
    33       Database.SetInitializer(new HeuristicLab.Services.Optimization.Billing.DataAccess.BillingContext.BillingContextInitiliazer());
     30      Database.SetInitializer(new BillingContextInitiliazer());
    3431
    3532      // Hook up event to mark existing entities as Unchanged
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingDao.cs

    r9645 r9653  
    22using System;
    33using System.Collections.Generic;
    4 using System.Data;
    54using System.Data.Entity;
    65using System.Linq;
     
    1110  public class BillingDao {
    1211
    13     #region Context Creation and Execution
     12    #region Context Creation
    1413
    1514    private BillingContext CreateContext() {
     
    3231        var products = context.Products.Where(predicate).ToList();
    3332        return products;
     33      }
     34    }
     35
     36    public IEnumerable<Product> FindProductBy(Expression<Func<Product, bool>> query, params Expression<Func<Product, object>>[] includes) {
     37      using (var context = CreateContext()) {
     38        IQueryable<Product> products = context.Products.Where(query);
     39
     40        if (includes != null) {
     41          products = includes.Aggregate(products, (current, include) => current.Include(include));
     42        }
     43
     44        return products.ToList();
    3445      }
    3546    }
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Interfaces/IGenericDao.cs

    r9577 r9653  
    99    IQueryable<T> FindBy(Expression<Func<T, bool>> predicate);
    1010    IQueryable<T> FindAll();
    11     void Add(T entity);
    12     void Update(T entity);
     11    void InsertOrUpdate(T entity);
    1312    void Delete(T entity);
    1413    void Commit();
Note: See TracChangeset for help on using the changeset viewer.