Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9586


Ignore:
Timestamp:
06/05/13 14:09:51 (11 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
Files:
10 added
17 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Hive.Scaler

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

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

    • 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
  • branches/OaaS/HeuristicLab.Services.Optimization.Web

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3Bin
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/BaseController.cs

    r9582 r9586  
    3434          return true;
    3535        }
    36         if (orderNecessary)
     36        if (orderNecessary && BillingComponent.Enabled)
    3737          return RedirectToCreateOrderIfNecessary();
    3838        return false;
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OrderAdminController.cs

    r9582 r9586  
    44using HeuristicLab.Services.Optimization.Billing.Interfaces;
    55using HeuristicLab.Services.Optimization.Web.Models;
     6using HeuristicLab.Services.Optimization.Web.Helpers;
    67
    78namespace HeuristicLab.Services.Optimization.Web.Controllers {
    89  [Authorize(Roles = "Web User")]
     10  [BillingFilterActionAttribute]
    911  public class OrderAdminController : Controller {
    1012    private IOptimizationBilling billing = BillingServiceProvider.Instance;
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OrderController.cs

    r9582 r9586  
    77using HeuristicLab.Services.Optimization.Billing.Model;
    88using HeuristicLab.Services.Optimization.Web.Models;
     9using HeuristicLab.Services.Optimization.Web.Helpers;
    910
    1011namespace HeuristicLab.Services.Optimization.Web.Controllers {
    1112  [Authorize(Roles = "Web User")]
     13  [BillingFilterActionAttribute]
    1214  public class OrderController : BaseController {
    1315    private IOptimizationBilling billing = BillingServiceProvider.Instance;
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj

    r9582 r9586  
    127127    <Compile Include="Controllers\ExperimentController.cs" />
    128128    <Compile Include="Controllers\HomeController.cs" />
     129    <Compile Include="Controllers\InvoiceController.cs" />
    129130    <Compile Include="Controllers\JobController.cs" />
    130131    <Compile Include="Controllers\OrderAdminController.cs" />
    131132    <Compile Include="Controllers\OrderController.cs" />
     133    <Compile Include="Controllers\UsageController.cs" />
    132134    <Compile Include="Global.asax.cs">
    133135      <DependentUpon>Global.asax</DependentUpon>
    134136    </Compile>
     137    <Compile Include="Helpers\BillingComponent.cs" />
     138    <Compile Include="Helpers\BillingFilterActionAttribute.cs" />
    135139    <Compile Include="Helpers\ControllerService.cs" />
    136140    <Compile Include="Helpers\HtmlExtensions.cs" />
     
    139143    <Compile Include="Models\AdminModels.cs" />
    140144    <Compile Include="Models\ChartModels.cs" />
     145    <Compile Include="Models\InvoiceModel.cs" />
    141146    <Compile Include="Models\OrderAdminModel.cs" />
    142147    <Compile Include="Models\ExperimentModel.cs" />
     
    144149    <Compile Include="Models\OrderModel.cs" />
    145150    <Compile Include="Models\StatusModel.cs" />
     151    <Compile Include="Models\UsageModel.cs" />
    146152    <Compile Include="Properties\AssemblyInfo.cs" />
    147153    <Compile Include="WebRole.cs" />
     
    400406    <Content Include="Views\Order\Overview.cshtml" />
    401407    <Content Include="Views\Order\Payment.cshtml" />
     408    <Content Include="Views\Usage\Index.cshtml" />
     409    <Content Include="Views\Invoice\Index.cshtml" />
    402410  </ItemGroup>
    403411  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Order/SaveOrder.cshtml

    r9582 r9586  
    2828}
    2929else {
     30    <h2>Choose one of your payment options:</h2>
    3031    foreach (var pi in Model.User.PaymentInformation) {
     32        <p>
    3133         @Html.Label("PaymentInformationId", string.Format("{0} ({1})", pi.PaymentMethod, pi.CardNumber))
    32          @Html.RadioButton("PaymentInformationId", pi.PaymentInformationId);
     34         @Html.RadioButton("PaymentInformationId", pi.PaymentInformationId)
     35        </p>
    3336    }
    34     <h2>Or add payment information by clicking @Html.ActionLink("here", "Payment").</h2>
     37    <h3>Or add payment information by clicking @Html.ActionLink("here", "Payment").</h3>
    3538   
    3639    using (Html.BeginForm("SaveOrder", "Order")) {
    3740    <h2>How often would you like to be billed?</h2>
    38 
     41    <p>
    3942    @Html.RadioButtonForEnum(m => m.BillingPeriod)
    40 
     43    </p>
    4144    <h2>Would you like to pay upfront or at the end of the period?</h2>
    42 
     45    <p>
    4346    @Html.RadioButtonForEnum(m => m.BillingType)
    44      
    45      <div>
     47    </p>
    4648     <p>
    4749        <input type="submit" value="Save order" />
    4850    </p>
    49     </div>
    5051}
    5152}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/_Layout.cshtml

    r9582 r9586  
    1 <!DOCTYPE html>
     1@using HeuristicLab.Services.Optimization.Web.Helpers
     2<!DOCTYPE html>
    23<html>
    34<head>
     
    6263        <div id="master-mainmenu">
    6364            <ul id="menu">
    64                 <li>@Html.ActionLink("Home", "Index", "Home")</li>
    65                 <li>@Html.ActionLink("Experiment", "Index", "Experiment")</li>         
    66                 <li>@Html.ActionLink("Orders", "Overview", "Order")</li>     
    67                 <li>@Html.ActionLink("Admin", "Index", "Admin")</li>               
     65                <li>@Html.ActionLink("Home", "Index", "Home")</li>                           
     66                <li>@Html.ActionLink("Experiment", "Index", "Experiment")</li>
     67                <li>@Html.ActionLink("Experiment Administrator", "Index", "Admin")</li>   
     68                @if (BillingComponent.Enabled) {         
     69                <li>@Html.ActionLink("My Orders", "Overview", "Order")</li>     
     70                <li>@Html.ActionLink("My Usages", "Index", "Usage")</li>
     71                <li>@Html.ActionLink("My Invoices", "Index", "Invoice")</li>                               
    6872                <li>@Html.ActionLink("Order Administration", "Index", "OrderAdmin")</li>               
     73                }
    6974                <li>@Html.ActionLink("About", "About", "Home")</li>
    7075            </ul>
  • branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.build.csdef

    r9508 r9586  
    3232      <Setting name="HiveEndpointName" />
    3333      <Setting name="ControllerEndpointName" />
     34      <Setting name="BillingEnabled" />
    3435    </ConfigurationSettings>
    3536  </WebRole>
  • branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.csdef

    r9508 r9586  
    2323      <Setting name="HiveEndpointName" />
    2424      <Setting name="ControllerEndpointName" />
     25      <Setting name="BillingEnabled" />
    2526    </ConfigurationSettings>
    2627  </WebRole>
Note: See TracChangeset for help on using the changeset viewer.