Added tutorial projects

This commit is contained in:
2021-09-14 12:31:36 +12:00
parent aaed2e6560
commit 544ae9c070
106 changed files with 5249 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F3A4E792-4405-45A5-953D-93E3618E3E46}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AppLogic</RootNamespace>
<AssemblyName>AppLogic</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IProduct.cs" />
<Compile Include="IStoreFront.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CompetitorStoreFront.cs" />
<Compile Include="VTNZ_StoreFront.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VTNZ_Immutable\VTNZ_Immutable.csproj">
<Project>{6665e064-a51f-4e18-9333-157f41d29152}</Project>
<Name>VTNZ_Immutable</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AppLogic
{
public class CompetitorStoreFront : IStoreFront
{
string _storefrontName;
string _storefrontAddress;
string _storefrontPhoneNumber;
string[] _storefrontOpenDays;
TimeSpan[] _storefrontTimeOpen;
List<IProduct> _storeProducts;
public string GetName => _storefrontName;
public string GetAddress => _storefrontAddress;
public string[] GetOpenDays => _storefrontOpenDays;
public TimeSpan[] GetOpenTime => _storefrontTimeOpen;
public string GetPhoneNumber => _storefrontPhoneNumber;
public List<IProduct> GetProducts => _storeProducts;
public CompetitorStoreFront(string name, string location, string phone, string[] workingDays, TimeSpan[] dayLengths)
{
_storefrontName = name;
_storefrontAddress = location;
_storefrontPhoneNumber = phone;
_storefrontOpenDays = workingDays;
_storefrontTimeOpen = dayLengths;
_storeProducts = new List<IProduct>();
}
public override string ToString()
{
return _storefrontName;
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AppLogic
{
public interface IProduct
{
string Name { get; }
decimal Value { get; }
// Extra definitions here
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AppLogic
{
public interface IStoreFront
{
string GetName { get; }
string GetAddress { get; }
string GetPhoneNumber { get; }
string[] GetOpenDays { get; }
TimeSpan[] GetOpenTime { get; }
List<IProduct> GetProducts { get; }
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppLogic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AppLogic")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f3a4e792-4405-45a5-953d-93e3618e3e46")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+121
View File
@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AppLogic
{
public class VTNZ_StoreFront : IStoreFront
{
string _storefrontName;
string _storefrontAddress;
string _storefrontPhoneNumber;
string[] _storefrontOpenDays;
TimeSpan[] _storefrontTimeOpen;
List<IProduct> _storeProducts;
public string GetName => _storefrontName;
public string GetAddress => _storefrontAddress;
public string[] GetOpenDays => _storefrontOpenDays;
public TimeSpan[] GetOpenTime => _storefrontTimeOpen;
public string GetPhoneNumber => _storefrontPhoneNumber;
public List<IProduct> GetProducts => _storeProducts;
public VTNZ_StoreFront(string name, string location, string phone, string[] workingDays, TimeSpan[] dayLengths)
{
_storefrontName = name;
_storefrontAddress = location;
_storefrontPhoneNumber = phone;
_storefrontOpenDays = workingDays;
_storefrontTimeOpen = dayLengths;
_storeProducts = new List<IProduct>
{
new WofInspectionWrap(new VTNZ_Immutable.General("Wof", 25)),
new ModifiedInspectionWrap(new VTNZ_Immutable.ModifiedInspection()),
new PrePurchaseInspectionWrap(new VTNZ_Immutable.PrePurchaseInspection()),
new CoFInspectionWrap(new VTNZ_Immutable.CoFInspection())
};
}
public override string ToString()
{
return _storefrontName;
}
}
public class WofInspectionWrap : IProduct
{
VTNZ_Immutable.General _inspection;
public string Name => _inspection.Name;
public decimal Value => _inspection.Value;
public WofInspectionWrap(VTNZ_Immutable.General inspection)
{
this._inspection = inspection;
}
public override string ToString()
{
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "") + Value;
}
}
public class ModifiedInspectionWrap : IProduct
{
VTNZ_Immutable.ModifiedInspection _inspection;
public string Name => _inspection.InspectionType;
public decimal Value => _inspection.Value;
public ModifiedInspectionWrap(VTNZ_Immutable.ModifiedInspection inspection)
{
this._inspection = inspection;
}
public override string ToString()
{
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "")+ Value;
}
}
public class PrePurchaseInspectionWrap : IProduct
{
VTNZ_Immutable.PrePurchaseInspection _inspection;
public string Name => _inspection.Name;
public decimal Value => _inspection.Value;
public PrePurchaseInspectionWrap(VTNZ_Immutable.PrePurchaseInspection inspection)
{
this._inspection = inspection;
}
public override string ToString()
{
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "")+ Value;
}
}
public class CoFInspectionWrap : IProduct
{
VTNZ_Immutable.CoFInspection _inspection;
public string Name => _inspection.Name;
public decimal Value => _inspection.Value;
public CoFInspectionWrap(VTNZ_Immutable.CoFInspection inspection)
{
this._inspection = inspection;
}
public override string ToString()
{
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "") + Value;
}
}
}