예제 #1
0
 public Invoice(Customer Customer, decimal VAT, List <Service> Services, MyCompany MyCompany, int InvoiceNumber, int PaymentPeriod)
 {
     this.MyCompany              = MyCompany;
     this.VATPercentage          = VAT;
     this.InvoiceNumber          = InvoiceNumber;
     this.Services               = Services;
     this.TotalPriceIncludingVAT = (ServicesTotal() * VATPercentage) + ServicesTotal();
     this.Date                = DateTime.Today.Date;
     this.Customer            = Customer;
     this.VATAmount           = VATCalculator();
     this.ControllCalculation = Controll();
     this.PaymentPeriod       = PaymentPeriod;
 }
 void InitializeMyCompanyProperties() //Reads from file to CurrentCompany-propertie.
 {
     try
     {
         myCompanyDataBase = String.Format("{0}{1}{2}", directory, Path.DirectorySeparatorChar, "MyCompany.json");
         string toBeDeSerialized = File.ReadAllText(myCompanyDataBase);
         CurrentCompany = JsonConvert.DeserializeObject <MyCompany>(toBeDeSerialized);
     }
     catch (FileNotFoundException)
     {
         File.Create(myCompanyDataBase).Close();
         CurrentCompany = new MyCompany("Namn", "Adressfält", "Bolagsinformation", "Tele och mail", "Giro", "Bankkonto", "Iban", "bic/Swift");
     }
 }
예제 #3
0
 public USDInvoice(Customer Customer, decimal VAT, List <Service> Services, MyCompany MyCompany, int InvoiceNumber, int PaymentPeriod) : base(Customer, VAT, Services, MyCompany, InvoiceNumber, PaymentPeriod)
 {
     ExchangeRate = GetCurrencyInformation();
 }
        internal void SaveMyCompany(MyCompany updatedMyCompany) //Writes to file
        {
            string mySerializedCompany = JsonConvert.SerializeObject(updatedMyCompany);

            File.WriteAllText(myCompanyDataBase, mySerializedCompany);
        }