# HG changeset patch # User Markus Bröker # Date 1490760156 -7200 # Node ID cfa10fbf52b304758b75c852a3c130144573a970 Initialer Commit diff --git a/.hgignore b/.hgignore new file mode 100644 --- /dev/null +++ b/.hgignore @@ -0,0 +1,139 @@ +syntax: glob +*.com +*.class +*.dll +*.exe +*.o +*.so +*.a +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip +*.log +*.sql +*.sqlite +*.suo +*.user +*.sln.docstates +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ +*.obj +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +.builds +*.pidb +*.log +*.scc +*.pdb +*.user +*.aps +*.pch +*.vspscc +*.vssscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.[Cc]ache +*.ilk +*.log +*.lib +*.sbr +_ReSharper*/ +[Tt]humbs.db +[Tt]est[Rr]esult* +[Bb]uild[Ll]og.* +*.[Pp]ublish.xml +*.resharper +[Bb]ackup/ +_UpgradeReport_Files/ +UpgradeLog.* +*.opensdf +*.sdf +ipch/ +x64/ +*.psess +*.vsp +*.vspx +*.gpState +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user +_TeamCity* +*.dotCover +*.ncrunch* +.*crunch*.local.xml +[Ee]xpress/ +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html +publish/ +*.Publish.xml +*.pubxml +csx +*.build.csdef +AppPackages/ +Generated_Code/ +App_Data/*.mdf +App_Data/*.ldf +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +packages/ +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +$RECYCLE.BIN/ +Thumbs.db +ehthumbs.db +Desktop.ini +*.ide/ +*.VisualState.xml +TestResult.xml +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c +$tf/ +*.mm.* +AutoTest.Net/ +*.rdl.data +*.bim.layout +*.bim_*.settings +FakesAssemblies/ +*.favdoc diff --git a/Sales.sln b/Sales.sln new file mode 100644 --- /dev/null +++ b/Sales.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sales", "Sales\Sales.csproj", "{142CDB0D-7277-4655-9AE7-70EA09B6BEF7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {142CDB0D-7277-4655-9AE7-70EA09B6BEF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142CDB0D-7277-4655-9AE7-70EA09B6BEF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142CDB0D-7277-4655-9AE7-70EA09B6BEF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142CDB0D-7277-4655-9AE7-70EA09B6BEF7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Sales/App.config b/Sales/App.config new file mode 100644 --- /dev/null +++ b/Sales/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Sales/Invoice.cs b/Sales/Invoice.cs new file mode 100644 --- /dev/null +++ b/Sales/Invoice.cs @@ -0,0 +1,83 @@ +/** + * Invoice.cs + * + * @author Markus Bröker + * @copyright Copyright(C) 2017 4Customers UG + * + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using static Sales.Payment; + +namespace Sales +{ + delegate double InvoiceDelegate(); + + class Invoice + { + private double value = 0; + private PaymentType till; + + public Invoice(double value, PaymentType till) + { + this.value = value; + this.till = till; + + InvoiceDelegate invoiceDelegateReference = this.Rabatt; + invoiceDelegateReference += this.AddTax; + invoiceDelegateReference += this.Skonto; + + invoiceDelegateReference(); + } + + public double getFinalResult() + { + return value; + } + + //Rabatt auf den Netto Preis + private double Rabatt() + { + if (value > 1000.0) + { + value *= 0.75; + } + else if (value > 500.0) + { + value *= 0.85; + } + + return value; + } + + // Steuern auf den rabattierten Nettopreis + private double AddTax() + { + value *= 1.19; + return value; + } + + // Skonto immer zum Schluss + private double Skonto() + { + switch (till) + { + case PaymentType.NOW: + value *= 0.97; + break; + case PaymentType.WEEK: + value *= 0.98; + break; + case PaymentType.MONTH: + value *= 0.99; + break; + } + + return value; + } + } +} diff --git a/Sales/Payment.cs b/Sales/Payment.cs new file mode 100644 --- /dev/null +++ b/Sales/Payment.cs @@ -0,0 +1,20 @@ +/** + * Payment.cs + * + * @author Markus Bröker + * @copyright Copyright(C) 2017 4Customers UG + * + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sales +{ + class Payment + { + public enum PaymentType { NOW, WEEK, MONTH }; + } +} diff --git a/Sales/Program.cs b/Sales/Program.cs new file mode 100644 --- /dev/null +++ b/Sales/Program.cs @@ -0,0 +1,32 @@ +/** + * Program.cs + * + * @author Markus Bröker + * @copyright Copyright(C) 2017 4Customers UG + * + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using static Sales.Payment; + +namespace Sales +{ + class Program + { + static void Main(string[] args) + { + Console.OutputEncoding = Encoding.Default; + + Program p = new Program(); + + Invoice invoice = new Sales.Invoice(599.99, PaymentType.NOW); + Console.WriteLine("Die Endsumme beträgt {0:C}", invoice.getFinalResult()); + + Console.ReadKey(); + } + } +} diff --git a/Sales/Properties/AssemblyInfo.cs b/Sales/Properties/AssemblyInfo.cs new file mode 100644 --- /dev/null +++ b/Sales/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Delegates")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Delegates")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("142cdb0d-7277-4655-9ae7-70ea09b6bef7")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Sales/Sales.csproj b/Sales/Sales.csproj new file mode 100644 --- /dev/null +++ b/Sales/Sales.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {142CDB0D-7277-4655-9AE7-70EA09B6BEF7} + Exe + Properties + Delegates + Sales + v4.5.2 + 512 + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + False + Microsoft .NET Framework 4.5.2 %28x86 und x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + \ No newline at end of file