Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/05/13 14:09:51 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Billing Component may now be deactivated by setting the BillingEnabled flag within the OaaS service configuration.
  • Added views for invoices and usage data.
  • Changed appearance of the SaveOrder view.
Location:
branches/OaaS/HeuristicLab.Services.Optimization.Billing
Files:
6 edited

Legend:

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

    • Property svn:ignore set to
      bin
      obj
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs

    r9582 r9586  
    6060      throw new System.NotImplementedException();
    6161    }
     62
     63
     64    public IList<UsageRecord> GetUsageRecords(string userName) {
     65      throw new System.NotImplementedException();
     66    }
     67
     68
     69    public IList<Invoice> GetInvoices(string userName) {
     70      throw new System.NotImplementedException();
     71    }
    6272  }
    6373}
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingServiceProvider.cs

    r9577 r9586  
    33namespace HeuristicLab.Services.Optimization.Billing.Business {
    44  public static class BillingServiceProvider {
    5     private static IOptimizationBilling instance = new BillingService();
     5    private static IOptimizationBilling instance = new MockupBillingService();
    66
    77    public static IOptimizationBilling Instance {
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/MockupBillingService.cs

    r9582 r9586  
    22using System.Linq;
    33using HeuristicLab.Services.Optimization.Billing.Interfaces;
     4using System;
    45
    56namespace HeuristicLab.Services.Optimization.Billing.Business {
     
    1011    private static IList<Model.Order> allOrders;
    1112    private static IDictionary<string, Model.User> users;
     13    private static IDictionary<string, IList<Model.UsageRecord>> records;
     14    private static IDictionary<string, IList<Model.Invoice>> invoices;
    1215    private static long maxId = 1;
    1316
    1417    static MockupBillingService() {
     18      Model.Product oaas;
    1519      products = new List<Model.Product>();
    16       products.Add(new Model.Product() {
     20
     21      products.Add(oaas = new Model.Product() {
    1722        Name = "Optimization-as-a-Service - Experiment execution",
    1823        Description = "Create and run your experiments within HeuristicLab Hive",
     
    3237      allOrders = new List<Model.Order>();
    3338      users = new Dictionary<string, Model.User>();
     39      records = new Dictionary<string, IList<Model.UsageRecord>>();
     40      records["fschoeppl"] = new List<Model.UsageRecord>() {
     41        new Model.UsageRecord() { ProductId = 1, Product = oaas, UsageRecordId = 1, User = new Model.User() { Name = "fschoeppl", UserId = 1 }, Begin = DateTime.Now, End = DateTime.Now.AddHours(2), UserId = 1, ResourceIdentifier = 0, ServiceIdentifier = 1 }
     42      };
     43      invoices = new Dictionary<string, IList<Model.Invoice>>();
     44      invoices["fschoeppl"] = new List<Model.Invoice>() {
     45        new Model.Invoice() {
     46          Due = DateTime.Now.AddDays(-1),
     47          Status = Model.InvoiceStatus.Overdue, 
     48          InvoiceId = 1, OrderId = 1,
     49          InvoiceLines = new List<Model.InvoiceLine>() {
     50            new Model.InvoiceLine() { Product = oaas, ProductId = oaas.ProductId, ProductPrice = oaas.Price, Quantity = 2, InvoiceLineId = 1, InvoiceId = 1 }
     51          },
     52          UserId = 1, User = new Model.User() { UserId = 1, Name = "fschoeppl" }
     53        }
     54      };
    3455    }
    3556
     
    4162      IList<Model.Order> orders;
    4263      if (!userToOrders.TryGetValue(order.User.Name, out orders)) {
    43         userToOrders[order.User.Name] = orders = new List<Model.Order>();       
     64        userToOrders[order.User.Name] = orders = new List<Model.Order>();
    4465      }
    4566      var oldOrder = (from o in orders where o.OrderId == order.OrderId select o).FirstOrDefault();
     
    81102      users[user.Name] = user;
    82103    }
     104
     105
     106    public IList<Model.UsageRecord> GetUsageRecords(string userName) {
     107      IList<Model.UsageRecord> foundRecords;
     108      if (records.TryGetValue(userName, out foundRecords)) {
     109        return foundRecords;
     110      }
     111      return null;
     112    }
     113
     114
     115    public IList<Model.Invoice> GetInvoices(string userName) {
     116      IList<Model.Invoice> foundInvoices;
     117      if (invoices.TryGetValue(userName, out foundInvoices)) {
     118        return foundInvoices;
     119      }
     120      return null;
     121    }
    83122  }
    84123}
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Interfaces/IOptimizationBilling.cs

    r9582 r9586  
    2121    User GetUser(string userName);
    2222    void SaveUser(User user);
     23
     24    IList<UsageRecord> GetUsageRecords(string userName);
     25    IList<Invoice> GetInvoices(string userName);
    2326  }
    2427}
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs

    r9582 r9586  
    9090  }
    9191
     92  public enum InvoiceStatus {
     93    Open, Overdue, Paid
     94  }
     95
    9296  public class Invoice {
    9397    public long InvoiceId { get; set; }
     
    9599    public long OrderId { get; set; }
    96100    public DateTime Due { get; set; }
    97     public string Status { get; set; }
     101    public InvoiceStatus Status { get; set; }
    98102    public string InvoiceDocument { get; set; }
    99103
Note: See TracChangeset for help on using the changeset viewer.