Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Billing/BillingEngine/FileSystemInvoiceDao.cs @ 11763

Last change on this file since 11763 was 10013, checked in by spimming, 11 years ago

#1888:

  • enabled transactions
  • enabled tracing output
  • set correct invoice data
  • saving invoices
File size: 880 bytes
Line 
1using System.IO;
2using HeuristicLab.Services.Optimization.Billing.Interfaces;
3
4namespace HeuristicLab.Services.Optimization.Billing.BillingEngine {
5  class FileSystemInvoiceDao : IInvoiceDao {
6    private string rootPath;
7
8    public FileSystemInvoiceDao()
9      : this("") {
10
11    }
12
13    public FileSystemInvoiceDao(string rootPath) {
14      this.rootPath = rootPath;
15    }
16
17    public bool SaveDocument(string documentName, string contents) {
18      File.WriteAllText(rootPath + documentName, contents);
19      return true;
20    }
21
22    public string LoadDocument(string documentName) {
23      return File.ReadAllText(rootPath + documentName);
24    }
25
26    public void LoadDocument(string documentName, System.IO.Stream target) {
27      byte[] contents = File.ReadAllBytes(rootPath + documentName);
28      target = new MemoryStream(contents);
29    }
30  }
31}
Note: See TracBrowser for help on using the repository browser.