diff options
Diffstat (limited to 'src/app')
68 files changed, 3971 insertions, 0 deletions
diff --git a/src/app/Cmpp298.Assignment3.DataAccess/Cmpp298.Assignment3.DataAccess.csproj b/src/app/Cmpp298.Assignment3.DataAccess/Cmpp298.Assignment3.DataAccess.csproj new file mode 100644 index 0000000..e797478 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/Cmpp298.Assignment3.DataAccess.csproj @@ -0,0 +1,59 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{48B09B0E-F2D5-463D-9FAB-C1781CA46D4D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.DataAccess</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.DataAccess</AssemblyName>
+ </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.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CommandParameter.cs" />
+ <Compile Include="DatabaseColumn.cs" />
+ <Compile Include="DatabaseConnectionFactory.cs" />
+ <Compile Include="DatabaseGateway.cs" />
+ <Compile Include="IDatabaseConnectionFactory.cs" />
+ <Compile Include="IDatabaseGateway.cs" />
+ <Compile Include="InnerJoin.cs" />
+ <Compile Include="InsertQueryBuilder.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SelectQueryBuilder.cs" />
+ <Compile Include="Tables.cs" />
+ <Compile Include="UpdateQueryBuilder.cs" />
+ <Compile Include="WhereClause.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/CommandParameter.cs b/src/app/Cmpp298.Assignment3.DataAccess/CommandParameter.cs new file mode 100644 index 0000000..134a5e6 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/CommandParameter.cs @@ -0,0 +1,19 @@ +namespace Cmpp298.Assignment3.DataAccess {
+ public class CommandParameter {
+ private readonly string _columnName;
+ private readonly object _value;
+
+ public CommandParameter( string columnName, object value ) {
+ _columnName = columnName;
+ _value = value;
+ }
+
+ public string ColumnName {
+ get { return _columnName; }
+ }
+
+ public object Value {
+ get { return _value; }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/DatabaseColumn.cs b/src/app/Cmpp298.Assignment3.DataAccess/DatabaseColumn.cs new file mode 100644 index 0000000..b8e4b13 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/DatabaseColumn.cs @@ -0,0 +1,23 @@ +namespace Cmpp298.Assignment3.DataAccess {
+ public class DatabaseColumn {
+ private readonly string _tableName;
+ private readonly string _columnName;
+
+ internal DatabaseColumn( string tableName, string columnName ) {
+ _tableName = tableName;
+ _columnName = columnName;
+ }
+
+ public string TableName {
+ get { return _tableName; }
+ }
+
+ public string ColumnName {
+ get { return _columnName; }
+ }
+
+ public override string ToString( ) {
+ return string.Format( "[{0}].[{1}]", _tableName, _columnName );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/DatabaseConnectionFactory.cs b/src/app/Cmpp298.Assignment3.DataAccess/DatabaseConnectionFactory.cs new file mode 100644 index 0000000..57e8373 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/DatabaseConnectionFactory.cs @@ -0,0 +1,21 @@ +using System.Configuration;
+using System.Data;
+using System.Data.Common;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public class DatabaseConnectionFactory : IDatabaseConnectionFactory {
+ private ConnectionStringSettings _settings;
+
+ public DatabaseConnectionFactory( ) : this( ConfigurationManager.ConnectionStrings[ "PayablesConnection" ] ) {}
+
+ public DatabaseConnectionFactory( ConnectionStringSettings connectionStringSettings ) {
+ _settings = connectionStringSettings;
+ }
+
+ public IDbConnection Create( ) {
+ IDbConnection connection = DbProviderFactories.GetFactory( _settings.ProviderName ).CreateConnection( );
+ connection.ConnectionString = _settings.ConnectionString;
+ return connection;
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/DatabaseGateway.cs b/src/app/Cmpp298.Assignment3.DataAccess/DatabaseGateway.cs new file mode 100644 index 0000000..55b0221 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/DatabaseGateway.cs @@ -0,0 +1,67 @@ +using System;
+using System.Collections.Generic;
+using System.Data;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public class DatabaseGateway : IDatabaseGateway {
+ private IDatabaseConnectionFactory _connectionFactory;
+
+ public DatabaseGateway( ) : this( new DatabaseConnectionFactory( ) ) {}
+
+ public DatabaseGateway( IDatabaseConnectionFactory connectionFactory ) {
+ _connectionFactory = connectionFactory;
+ }
+
+ public int InsertRowUsing( InsertQueryBuilder builder ) {
+ return ExecuteBuilderQuery( builder.Parameters, builder.ToString( ) );
+ }
+
+ public void UpdateRowUsing( UpdateQueryBuilder builder ) {
+ ExecuteBuilderQuery( builder.Parameters, builder.ToString( ) );
+ }
+
+ public void Execute( string query ) {
+ using ( IDbConnection connection = _connectionFactory.Create( ) ) {
+ IDbCommand command = connection.CreateCommand( );
+ connection.Open( );
+ command.CommandText = query;
+ command.ExecuteNonQuery( );
+ }
+ }
+
+ public DataTable GetTableFrom( SelectQueryBuilder builder ) {
+ return GetTableFrom( builder.ToString( ) );
+ }
+
+ private DataTable GetTableFrom( string sqlQuery ) {
+ using ( IDbConnection connection = _connectionFactory.Create( ) ) {
+ IDbCommand command = connection.CreateCommand( );
+ command.CommandText = sqlQuery;
+ connection.Open( );
+ IDataReader reader = command.ExecuteReader( );
+ DataTable table = new DataTable( );
+ table.Load( reader );
+ return table;
+ }
+ }
+
+ private int ExecuteBuilderQuery( ICollection< CommandParameter > parameters, string commandText ) {
+ object scalar;
+ using ( IDbConnection connection = _connectionFactory.Create( ) ) {
+ IDbCommand command = connection.CreateCommand( );
+
+ foreach ( CommandParameter parameter in parameters ) {
+ IDataParameter commandParameter = command.CreateParameter( );
+ commandParameter.ParameterName = "@" + parameter.ColumnName;
+ commandParameter.Value = parameter.Value;
+ command.Parameters.Add( commandParameter );
+ }
+
+ command.CommandText = commandText;
+ connection.Open( );
+ scalar = command.ExecuteScalar( );
+ }
+ return DBNull.Value != scalar ? Convert.ToInt32( scalar ) : -1;
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/IDatabaseConnectionFactory.cs b/src/app/Cmpp298.Assignment3.DataAccess/IDatabaseConnectionFactory.cs new file mode 100644 index 0000000..5460f87 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/IDatabaseConnectionFactory.cs @@ -0,0 +1,7 @@ +using System.Data;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public interface IDatabaseConnectionFactory {
+ IDbConnection Create( );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/IDatabaseGateway.cs b/src/app/Cmpp298.Assignment3.DataAccess/IDatabaseGateway.cs new file mode 100644 index 0000000..363dad4 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/IDatabaseGateway.cs @@ -0,0 +1,13 @@ +using System.Data;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public interface IDatabaseGateway {
+ DataTable GetTableFrom( SelectQueryBuilder builder );
+
+ int InsertRowUsing( InsertQueryBuilder builder );
+
+ void UpdateRowUsing( UpdateQueryBuilder builder );
+
+ void Execute( string query );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/InnerJoin.cs b/src/app/Cmpp298.Assignment3.DataAccess/InnerJoin.cs new file mode 100644 index 0000000..bff9fcc --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/InnerJoin.cs @@ -0,0 +1,23 @@ +namespace Cmpp298.Assignment3.DataAccess {
+ public class InnerJoin {
+ public InnerJoin( string leftTableName, string leftColumnName, string rightTableName, string rightColumnName )
+ : this( new DatabaseColumn( leftTableName, leftColumnName ), new DatabaseColumn( rightTableName, rightColumnName ) ) {}
+
+ public InnerJoin( DatabaseColumn leftColumn, DatabaseColumn rightColumn ) {
+ _leftColumn = leftColumn;
+ _rightColumn = rightColumn;
+ }
+
+ public override string ToString( ) {
+ return
+ string.Format( "INNER JOIN [{0}] ON [{0}].[{1}] = [{2}].[{3}]",
+ _leftColumn.TableName,
+ _leftColumn.ColumnName,
+ _rightColumn.TableName,
+ _rightColumn.ColumnName );
+ }
+
+ private readonly DatabaseColumn _leftColumn;
+ private readonly DatabaseColumn _rightColumn;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/InsertQueryBuilder.cs b/src/app/Cmpp298.Assignment3.DataAccess/InsertQueryBuilder.cs new file mode 100644 index 0000000..bbb3d9c --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/InsertQueryBuilder.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic;
+using System.Text;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public class InsertQueryBuilder {
+ private readonly string _tableName;
+ private IList< CommandParameter > _parameters;
+
+ public InsertQueryBuilder( string tableName ) {
+ _tableName = tableName;
+ _parameters = new List< CommandParameter >( );
+ }
+
+ public IList< CommandParameter > Parameters {
+ get { return _parameters; }
+ }
+
+ public void Add( DatabaseColumn column, string value ) {
+ _parameters.Add( new CommandParameter( column.ColumnName, value ) );
+ }
+
+ public override string ToString( ) {
+ StringBuilder builder = new StringBuilder( );
+ builder.AppendFormat( "INSERT INTO {0} ({1}) VALUES ({2});SELECT @@IDENTITY;", _tableName,
+ GetParameterNames( string.Empty ),
+ GetParameterNames( "@" ) );
+ return builder.ToString( );
+ }
+
+ private string GetParameterNames( string prefix ) {
+ StringBuilder builder = new StringBuilder( );
+ foreach ( CommandParameter parameter in _parameters ) {
+ builder.AppendFormat( "{0}{1},", prefix, parameter.ColumnName );
+ }
+ builder.Remove( builder.Length - 1, 1 );
+ return builder.ToString( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.DataAccess/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4b3d3f1 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Cmpp298.Assignment3.DataAccess")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.DataAccess")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("6900dc95-1e04-424e-8c9d-f18dbb9c8251")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.DataAccess/SelectQueryBuilder.cs b/src/app/Cmpp298.Assignment3.DataAccess/SelectQueryBuilder.cs new file mode 100644 index 0000000..a91e657 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/SelectQueryBuilder.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic;
+using System.Text;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public class SelectQueryBuilder {
+ private readonly string _tableName;
+ private IList< DatabaseColumn > _selectColumns;
+ private IList< InnerJoin > _innerJoins;
+ private WhereClause _whereClause;
+
+ public SelectQueryBuilder( string tableName ) {
+ _tableName = tableName;
+ _innerJoins = new List< InnerJoin >( );
+ _selectColumns = new List< DatabaseColumn >( );
+ }
+
+ public void AddColumn( DatabaseColumn column ) {
+ _selectColumns.Add( column );
+ }
+
+ public void InnerJoin( DatabaseColumn leftColumn, DatabaseColumn rightColumn ) {
+ _innerJoins.Add( new InnerJoin( leftColumn, rightColumn ) );
+ }
+
+ public void Where( DatabaseColumn column, string value ) {
+ _whereClause = new WhereClause( column, value );
+ }
+
+ public override string ToString( ) {
+ return string.Format( "SELECT {0} FROM {1} {2} {3};", GetColumnNames( ), _tableName, GetInnerJoins( ), _whereClause );
+ }
+
+ private string GetInnerJoins( ) {
+ StringBuilder builder = new StringBuilder( );
+ foreach ( InnerJoin innerJoin in _innerJoins ) {
+ builder.Append( innerJoin.ToString( ) );
+ }
+ return builder.ToString( );
+ }
+
+ private string GetColumnNames( ) {
+ StringBuilder builder = new StringBuilder( );
+ foreach ( DatabaseColumn selectColumn in _selectColumns ) {
+ builder.AppendFormat( "{0},", selectColumn );
+ }
+ builder.Remove( builder.Length - 1, 1 );
+ return builder.ToString( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/Tables.cs b/src/app/Cmpp298.Assignment3.DataAccess/Tables.cs new file mode 100644 index 0000000..549d7c8 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/Tables.cs @@ -0,0 +1,30 @@ +namespace Cmpp298.Assignment3.DataAccess {
+ public sealed class Tables {
+ public sealed class Invoices {
+ public const string TableName = "Invoices";
+ public static readonly DatabaseColumn InvoiceID = new DatabaseColumn( TableName, "InvoiceID" );
+ public static readonly DatabaseColumn InvoiceNumber = new DatabaseColumn( TableName, "InvoiceNumber" );
+ public static readonly DatabaseColumn InvoiceDate = new DatabaseColumn( TableName, "InvoiceDate" );
+ public static readonly DatabaseColumn InvoiceTotal = new DatabaseColumn( TableName, "InvoiceTotal" );
+ public static readonly DatabaseColumn PaymentTotal = new DatabaseColumn( TableName, "PaymentTotal" );
+ public static readonly DatabaseColumn CreditTotal = new DatabaseColumn( TableName, "CreditTotal" );
+ public static readonly DatabaseColumn DueDate = new DatabaseColumn( TableName, "DueDate" );
+ public static readonly DatabaseColumn PaymentDate = new DatabaseColumn( TableName, "PaymentDate" );
+ public static readonly DatabaseColumn TermsID = new DatabaseColumn( TableName, "TermsID" );
+ public static readonly DatabaseColumn VendorID = new DatabaseColumn( TableName, "VendorID" );
+ }
+
+ public sealed class Vendors {
+ public const string TableName = "Vendors";
+ public static readonly DatabaseColumn VendorID = new DatabaseColumn( TableName, "VendorID" );
+ public static readonly DatabaseColumn Name = new DatabaseColumn( TableName, "Name" );
+ }
+
+ public sealed class Terms {
+ public const string TableName = "Terms";
+ public static readonly DatabaseColumn TermsID = new DatabaseColumn( TableName, "TermsID" );
+ public static readonly DatabaseColumn Description = new DatabaseColumn( TableName, "Description" );
+ public static readonly DatabaseColumn DueDays = new DatabaseColumn( TableName, "DueDays" );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/UpdateQueryBuilder.cs b/src/app/Cmpp298.Assignment3.DataAccess/UpdateQueryBuilder.cs new file mode 100644 index 0000000..39654b1 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/UpdateQueryBuilder.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic;
+using System.Text;
+
+namespace Cmpp298.Assignment3.DataAccess {
+ public class UpdateQueryBuilder {
+ private IList< CommandParameter > _parameters;
+ private WhereClause _where;
+
+ public UpdateQueryBuilder( DatabaseColumn whereColumn, string whereValue )
+ : this( new List< CommandParameter >( ), new WhereClause( whereColumn, whereValue ) ) {}
+
+ public UpdateQueryBuilder( IList< CommandParameter > parameters, WhereClause where ) {
+ _parameters = parameters;
+ _where = where;
+ }
+
+ public IList< CommandParameter > Parameters {
+ get { return _parameters; }
+ }
+
+ public void Add( DatabaseColumn column, string value ) {
+ _parameters.Add( new CommandParameter( column.ColumnName, value ) );
+ }
+
+ public override string ToString( ) {
+ StringBuilder builder = new StringBuilder( );
+ builder.AppendFormat( "UPDATE [{0}] SET {1};", _where.Column.TableName, GetParameterNames( ) );
+
+ return builder.ToString( );
+ }
+
+ private string GetParameterNames( ) {
+ StringBuilder builder = new StringBuilder( );
+ foreach ( CommandParameter parameter in _parameters ) {
+ builder.AppendFormat( "[{0}].[{1}] = @{1},", _where.Column.TableName, parameter.ColumnName );
+ }
+ builder.Remove( builder.Length - 1, 1 );
+ builder.Append( _where );
+ return builder.ToString( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.DataAccess/WhereClause.cs b/src/app/Cmpp298.Assignment3.DataAccess/WhereClause.cs new file mode 100644 index 0000000..3912f09 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.DataAccess/WhereClause.cs @@ -0,0 +1,23 @@ +namespace Cmpp298.Assignment3.DataAccess {
+ public class WhereClause {
+ private readonly DatabaseColumn _column;
+ private readonly string _value;
+
+ public WhereClause( DatabaseColumn column, string value ) {
+ _column = column;
+ _value = value;
+ }
+
+ public DatabaseColumn Column {
+ get { return _column; }
+ }
+
+ public string Value {
+ get { return _value; }
+ }
+
+ public override string ToString( ) {
+ return string.Format( " WHERE [{0}].[{1}] = {2};", _column.TableName, _column.ColumnName, _value );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj new file mode 100644 index 0000000..f305b26 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj @@ -0,0 +1,54 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{097FDBD3-0339-4D79-AE80-1AD1407B15F0}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Desktop.Adapters</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Desktop.Adapters</AssemblyName>
+ </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.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DesktopDropDownList.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Dto\Cmpp298.Assignment3.Dto.csproj">
+ <Project>{29260A8E-3F7B-4D9B-BBE3-81210F4B9E5B}</Project>
+ <Name>Cmpp298.Assignment3.Dto</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs b/src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs new file mode 100644 index 0000000..1f3a2ee --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs @@ -0,0 +1,40 @@ +/*
+ * Created by: Mo
+ * Created: Sunday, August 12, 2007
+ */
+
+using System.Collections.Generic;
+using System.Windows.Forms;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Desktop.Adapters {
+ public class DesktopDropDownList : IDropDownListAdapter {
+ public DesktopDropDownList( ComboBox dropDown ) {
+ _dropDown = dropDown;
+ _pairs = new Dictionary< string, IDropDownListItem >( );
+ }
+
+ public void BindTo( IEnumerable< IDropDownListItem > pairs ) {
+ if ( pairs != null ) {
+ _pairs = new Dictionary< string, IDropDownListItem >( );
+
+ foreach ( IDropDownListItem pair in pairs ) {
+ _dropDown.Items.Add( pair.Text );
+ _pairs.Add( pair.Text, pair );
+ }
+ _dropDown.SelectedIndex = 0;
+ }
+ }
+
+ public IDropDownListItem SelectedItem {
+ get { return !string.IsNullOrEmpty( _dropDown.Text ) ? _pairs[ _dropDown.Text ] : null; }
+ }
+
+ public void SetSelectedItemTo( string text ) {
+ _dropDown.SelectedIndex = _dropDown.Items.IndexOf( text );
+ }
+
+ private ComboBox _dropDown;
+ private IDictionary< string, IDropDownListItem > _pairs;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eede991 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Cmpp298.Assignment3.Desktop.Adapters")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Desktop.Adapters")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("7ae97ab9-7f1b-4f1c-bf02-39a0f7c2fee1")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/Cmpp298.Assignment3.Desktop.Presentation.csproj b/src/app/Cmpp298.Assignment3.Desktop.Presentation/Cmpp298.Assignment3.Desktop.Presentation.csproj new file mode 100644 index 0000000..f32ce81 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/Cmpp298.Assignment3.Desktop.Presentation.csproj @@ -0,0 +1,68 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{62EA2002-B0ED-4E9C-945E-B77552A0669C}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Desktop.Presentation</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Desktop.Presentation</AssemblyName>
+ </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.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DeleteInvoicePresenter.cs" />
+ <Compile Include="EditInvoicePresenter.cs" />
+ <Compile Include="IDeleteInvoiceView.cs" />
+ <Compile Include="IEditInvoiceView.cs" />
+ <Compile Include="IInvoicesMainView.cs" />
+ <Compile Include="INewInvoiceView.cs" />
+ <Compile Include="InvoicesMainPresenter.cs" />
+ <Compile Include="NewInvoicePresenter.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Domain\Cmpp298.Assignment3.Domain.csproj">
+ <Project>{C11B2649-751A-4F49-B28D-AB36A8213674}</Project>
+ <Name>Cmpp298.Assignment3.Domain</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Dto\Cmpp298.Assignment3.Dto.csproj">
+ <Project>{29260A8E-3F7B-4D9B-BBE3-81210F4B9E5B}</Project>
+ <Name>Cmpp298.Assignment3.Dto</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Task\Cmpp298.Assignment3.Task.csproj">
+ <Project>{A747CA6E-EEA1-42E0-BA90-69317F8BF45D}</Project>
+ <Name>Cmpp298.Assignment3.Task</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/DeleteInvoicePresenter.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/DeleteInvoicePresenter.cs new file mode 100644 index 0000000..4912e30 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/DeleteInvoicePresenter.cs @@ -0,0 +1,36 @@ +using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Task;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public class DeleteInvoicePresenter {
+ private readonly string _invoiceId;
+ private readonly IDeleteInvoiceView _view;
+ private readonly IInvoiceTask _invoiceTask;
+
+ public DeleteInvoicePresenter( string invoiceId, IDeleteInvoiceView view )
+ : this( invoiceId, view, new InvoiceTask( ) ) {}
+
+ public DeleteInvoicePresenter( string invoiceId, IDeleteInvoiceView view, IInvoiceTask invoiceTask ) {
+ _invoiceId = invoiceId;
+ _view = view;
+ _invoiceTask = invoiceTask;
+ }
+
+ public void Initialize( ) {
+ DisplayInvoiceDto dto = _invoiceTask.GetInvoiceBy( _invoiceId );
+ _view.VendorName = dto.VendorName;
+ _view.InvoiceNumber = dto.InvoiceNumber;
+ _view.InvoiceDate = dto.InvoiceDate;
+ _view.InvoiceTotal = dto.InvoiceTotal;
+ _view.PaymentTotal = dto.PaymentTotal;
+ _view.CreditTotal = dto.CreditTotal;
+ _view.DueDate = dto.DueDate;
+ _view.PaymentDate = dto.PaymentDate;
+ _view.Terms = dto.Terms;
+ }
+
+ public void DeleteInvoice( ) {
+ _invoiceTask.DeleteInvoice( _invoiceId );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/EditInvoicePresenter.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/EditInvoicePresenter.cs new file mode 100644 index 0000000..eaaf8e6 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/EditInvoicePresenter.cs @@ -0,0 +1,62 @@ +using Cmpp298.Assignment3.Domain;
+using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Task;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public class EditInvoicePresenter {
+ private readonly string _invoiceId;
+ private readonly IEditInvoiceView _view;
+ private readonly IInvoiceTask _task;
+ private readonly ITermTask _termTask;
+
+ public EditInvoicePresenter( string invoiceId, IEditInvoiceView view )
+ : this( invoiceId, view, new InvoiceTask( ), new TermTask( ) ) {}
+
+ public EditInvoicePresenter( string invoiceId, IEditInvoiceView view, IInvoiceTask task, ITermTask termTask ) {
+ _view = view;
+ _task = task;
+ _termTask = termTask;
+ _invoiceId = invoiceId;
+ }
+
+ public void Initialize( ) {
+ _view.TermsDropDown.BindTo( _termTask.GetAll( ) );
+ UpdateViewFrom( _task.GetInvoiceBy( _invoiceId ) );
+ }
+
+ public void UpdateInvoice( ) {
+ if ( IsValidInput( ) ) {
+ _task.UpdateInvoice( CreateDtoFromView( ) );
+ }
+ else {
+ _view.ShowError( "Invalid input detected" );
+ }
+ }
+
+ private void UpdateViewFrom( DisplayInvoiceDto dto ) {
+ _view.VendorName = dto.VendorName;
+ _view.InvoiceNumber = dto.InvoiceNumber;
+ _view.InvoiceDate = dto.InvoiceDate;
+ _view.InvoiceTotal = dto.InvoiceTotal;
+ _view.PaymentTotal = dto.PaymentTotal;
+ _view.CreditTotal = dto.CreditTotal;
+ _view.DueDate = dto.DueDate;
+ _view.PaymentDate = dto.PaymentDate;
+ _view.TermsDropDown.SetSelectedItemTo( dto.Terms );
+ }
+
+ private bool IsValidInput( ) {
+ AmountEntrySpecification specification = new AmountEntrySpecification( );
+ return
+ specification.IsSatisfiedBy( _view.CreditTotal )
+ && specification.IsSatisfiedBy( _view.PaymentTotal )
+ && specification.IsSatisfiedBy( _view.InvoiceTotal );
+ }
+
+ private UpdateInvoiceDto CreateDtoFromView( ) {
+ return
+ new UpdateInvoiceDto( _invoiceId, _view.InvoiceNumber, _view.InvoiceDate, _view.InvoiceTotal, _view.PaymentTotal,
+ _view.CreditTotal, _view.DueDate, _view.PaymentDate, _view.TermsDropDown.SelectedItem.Value );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/IDeleteInvoiceView.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/IDeleteInvoiceView.cs new file mode 100644 index 0000000..fb547bf --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/IDeleteInvoiceView.cs @@ -0,0 +1,13 @@ +namespace Cmpp298.Assignment3.Presentation {
+ public interface IDeleteInvoiceView {
+ string VendorName { set; }
+ string InvoiceNumber { set; }
+ string InvoiceDate { set; }
+ string InvoiceTotal { set; }
+ string PaymentTotal { set; }
+ string CreditTotal { set; }
+ string DueDate { set; }
+ string PaymentDate { set; }
+ string Terms { set; }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/IEditInvoiceView.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/IEditInvoiceView.cs new file mode 100644 index 0000000..d9c195e --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/IEditInvoiceView.cs @@ -0,0 +1,25 @@ +using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public interface IEditInvoiceView {
+ IDropDownListAdapter TermsDropDown { get; }
+
+ string VendorName { get; set; }
+
+ string InvoiceNumber { get; set; }
+
+ string InvoiceDate { get; set; }
+
+ string InvoiceTotal { get; set; }
+
+ string PaymentTotal { get; set; }
+
+ string CreditTotal { get; set; }
+
+ string DueDate { get; set; }
+
+ string PaymentDate { get; set; }
+
+ void ShowError( string message );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/IInvoicesMainView.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/IInvoicesMainView.cs new file mode 100644 index 0000000..bdb3fc2 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/IInvoicesMainView.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public interface IInvoicesMainView {
+ IDropDownListAdapter VendorNames { get; }
+ void BindTo( IEnumerable< DisplayInvoiceDto > invoices );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/INewInvoiceView.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/INewInvoiceView.cs new file mode 100644 index 0000000..9b74a93 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/INewInvoiceView.cs @@ -0,0 +1,25 @@ +using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public interface INewInvoiceView {
+ void BindTo( DisplayVendorNameDto displayVendorNameDto );
+
+ IDropDownListAdapter Terms { get; }
+
+ string InvoiceNumber { get; set; }
+
+ string InvoiceDate { get; }
+
+ string InvoiceTotal { get; }
+
+ string PaymentTotal { get; }
+
+ string CreditTotal { get; }
+
+ string DueDate { get; }
+
+ string PaymentDate { get; }
+
+ void ShowError( string message );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/InvoicesMainPresenter.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/InvoicesMainPresenter.cs new file mode 100644 index 0000000..39286d0 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/InvoicesMainPresenter.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic;
+using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Task;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public class InvoicesMainPresenter {
+ private readonly IInvoiceTask _invoiceTask;
+ private readonly IInvoicesMainView _view;
+ private readonly IVendorTask _vendorsTask;
+
+ public InvoicesMainPresenter( IInvoicesMainView view ) : this( view, new VendorTask( ), new InvoiceTask( ) ) {}
+
+ public InvoicesMainPresenter( IInvoicesMainView view, IVendorTask vendorsTask, IInvoiceTask invoiceTask ) {
+ _view = view;
+ _vendorsTask = vendorsTask;
+ _invoiceTask = invoiceTask;
+ }
+
+ public void Initialize( ) {
+ _view.VendorNames.BindTo( _vendorsTask.GetAllVendorNames( ) );
+ }
+
+ public void LoadInvoices( ) {
+ IDropDownListItem selectedItem = _view.VendorNames.SelectedItem;
+ if ( selectedItem != null ) {
+ IEnumerable< DisplayInvoiceDto > enumerable = _invoiceTask.GetAllInvoices( selectedItem.Value );
+ _view.BindTo( enumerable );
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/NewInvoicePresenter.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/NewInvoicePresenter.cs new file mode 100644 index 0000000..83f30dc --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/NewInvoicePresenter.cs @@ -0,0 +1,54 @@ +using System;
+using Cmpp298.Assignment3.Domain;
+using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Task;
+
+namespace Cmpp298.Assignment3.Presentation {
+ public class NewInvoicePresenter {
+ private readonly string _vendorId;
+ private readonly INewInvoiceView _view;
+ private readonly IInvoiceTask _invoiceTask;
+ private readonly IVendorTask _vendorTask;
+ private readonly ITermTask _termTask;
+
+ public NewInvoicePresenter( string vendorId, INewInvoiceView view )
+ : this( vendorId, view, new InvoiceTask( ), new VendorTask( ), new TermTask( ) ) {}
+
+ public NewInvoicePresenter( string vendorId, INewInvoiceView view, IInvoiceTask invoiceTask, IVendorTask vendorTask,
+ ITermTask termTask ) {
+ _vendorId = vendorId;
+ _view = view;
+ _invoiceTask = invoiceTask;
+ _vendorTask = vendorTask;
+ _termTask = termTask;
+ }
+
+ public void Load( ) {
+ _view.BindTo( _vendorTask.FindVendorNameBy( _vendorId ) );
+ _view.InvoiceNumber = Guid.NewGuid( ).ToString( );
+ _view.Terms.BindTo( _termTask.GetAll( ) );
+ }
+
+ public void SaveInvoice( ) {
+ if ( IsValidInput( ) ) {
+ _invoiceTask.SaveNewInvoice( CreateDtoFromView( ) );
+ }
+ else {
+ _view.ShowError( "Invalid input detected!" );
+ }
+ }
+
+ private bool IsValidInput( ) {
+ AmountEntrySpecification specification = new AmountEntrySpecification( );
+ return
+ specification.IsSatisfiedBy( _view.CreditTotal )
+ && specification.IsSatisfiedBy( _view.PaymentTotal )
+ && specification.IsSatisfiedBy( _view.InvoiceTotal );
+ }
+
+ private SaveInvoiceDto CreateDtoFromView( ) {
+ return new SaveInvoiceDto( _vendorId, _view.InvoiceNumber, _view.InvoiceDate, _view.InvoiceTotal, _view.PaymentTotal,
+ _view.CreditTotal, _view.DueDate, _view.PaymentDate, _view.Terms.SelectedItem.Value );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.Presentation/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Desktop.Presentation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b2a7f1d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.Presentation/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Cmpp298.Assignment3.Desktop.Presentation")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Desktop.Presentation")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("38eca514-6401-4b26-b3bf-19b7ae2f8b80")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/App.config b/src/app/Cmpp298.Assignment3.Desktop.UI/App.config new file mode 100644 index 0000000..9f94d59 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/App.config @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <connectionStrings>
+ <add name="PayablesConnection"
+ connectionString="data source=(local);Integrated Security=SSPI;Initial Catalog=Payables;"
+ providerName="System.Data.SqlClient" />
+ </connectionStrings>
+</configuration>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Cmpp298.Assignment3.Desktop.UI.csproj b/src/app/Cmpp298.Assignment3.Desktop.UI/Cmpp298.Assignment3.Desktop.UI.csproj new file mode 100644 index 0000000..b744172 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Cmpp298.Assignment3.Desktop.UI.csproj @@ -0,0 +1,124 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{21D2672E-ED28-4AFF-BD5F-8D80469EA681}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Desktop.UI</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Desktop.UI</AssemblyName>
+ </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.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DeleteInvoiceView.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="DeleteInvoiceView.Designer.cs">
+ <DependentUpon>DeleteInvoiceView.cs</DependentUpon>
+ </Compile>
+ <Compile Include="EditInvoiceView.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="EditInvoiceView.Designer.cs">
+ <DependentUpon>EditInvoiceView.cs</DependentUpon>
+ </Compile>
+ <Compile Include="NewInvoiceView.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="NewInvoiceView.Designer.cs">
+ <DependentUpon>NewInvoiceView.cs</DependentUpon>
+ </Compile>
+ <Compile Include="InvoicesMainView.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="InvoicesMainView.Designer.cs">
+ <DependentUpon>InvoicesMainView.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="DeleteInvoiceView.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>DeleteInvoiceView.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="EditInvoiceView.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>EditInvoiceView.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="NewInvoiceView.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>NewInvoiceView.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="InvoicesMainView.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>InvoicesMainView.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ <DesignTime>True</DesignTime>
+ </Compile>
+ <None Include="App.config" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Desktop.Adapters\Cmpp298.Assignment3.Desktop.Adapters.csproj">
+ <Project>{097FDBD3-0339-4D79-AE80-1AD1407B15F0}</Project>
+ <Name>Cmpp298.Assignment3.Desktop.Adapters</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Desktop.Presentation\Cmpp298.Assignment3.Desktop.Presentation.csproj">
+ <Project>{62EA2002-B0ED-4E9C-945E-B77552A0669C}</Project>
+ <Name>Cmpp298.Assignment3.Desktop.Presentation</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Dto\Cmpp298.Assignment3.Dto.csproj">
+ <Project>{29260A8E-3F7B-4D9B-BBE3-81210F4B9E5B}</Project>
+ <Name>Cmpp298.Assignment3.Dto</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.Designer.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.Designer.cs new file mode 100644 index 0000000..dda1628 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.Designer.cs @@ -0,0 +1,297 @@ +namespace Cmpp298.Assignment3.Desktop.UI
+{
+ partial class DeleteInvoiceView
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if ( disposing && ( components != null ) )
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label9 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.uxDeleteButton = new System.Windows.Forms.Button();
+ this.uxCancelButton = new System.Windows.Forms.Button();
+ this.uxCreditTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxPaymentTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxInvoiceTotalTextBox = new System.Windows.Forms.TextBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.uxVendorNameTextBox = new System.Windows.Forms.TextBox();
+ this.uxInvoiceNumberTextBox = new System.Windows.Forms.TextBox();
+ this.uxInvoiceDateTextBox = new System.Windows.Forms.TextBox();
+ this.uxTermsTextBox = new System.Windows.Forms.TextBox();
+ this.uxPaymentDateTextBox = new System.Windows.Forms.TextBox();
+ this.uxDueDateTextBox = new System.Windows.Forms.TextBox();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(6, 200);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(39, 13);
+ this.label9.TabIndex = 8;
+ this.label9.Text = "Terms:";
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(6, 177);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(77, 13);
+ this.label8.TabIndex = 7;
+ this.label8.Text = "Payment Date:";
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(6, 154);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(56, 13);
+ this.label7.TabIndex = 6;
+ this.label7.Text = "Due Date:";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(6, 131);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(64, 13);
+ this.label6.TabIndex = 5;
+ this.label6.Text = "Credit Total:";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(6, 108);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(78, 13);
+ this.label5.TabIndex = 4;
+ this.label5.Text = "Payment Total:";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(6, 85);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(72, 13);
+ this.label4.TabIndex = 3;
+ this.label4.Text = "Invoice Total:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(6, 62);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(71, 13);
+ this.label3.TabIndex = 2;
+ this.label3.Text = "Invoice Date:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(6, 39);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(55, 13);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "Invoice #:";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(6, 16);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(75, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Vendor Name:";
+ //
+ // uxDeleteButton
+ //
+ this.uxDeleteButton.Location = new System.Drawing.Point(155, 243);
+ this.uxDeleteButton.Name = "uxDeleteButton";
+ this.uxDeleteButton.Size = new System.Drawing.Size(75, 23);
+ this.uxDeleteButton.TabIndex = 19;
+ this.uxDeleteButton.Text = "&Delete";
+ this.uxDeleteButton.UseVisualStyleBackColor = true;
+ //
+ // uxCancelButton
+ //
+ this.uxCancelButton.Location = new System.Drawing.Point(236, 243);
+ this.uxCancelButton.Name = "uxCancelButton";
+ this.uxCancelButton.Size = new System.Drawing.Size(75, 23);
+ this.uxCancelButton.TabIndex = 18;
+ this.uxCancelButton.Text = "&Cancel";
+ this.uxCancelButton.UseVisualStyleBackColor = true;
+ //
+ // uxCreditTotalTextBox
+ //
+ this.uxCreditTotalTextBox.Location = new System.Drawing.Point(111, 124);
+ this.uxCreditTotalTextBox.Name = "uxCreditTotalTextBox";
+ this.uxCreditTotalTextBox.ReadOnly = true;
+ this.uxCreditTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxCreditTotalTextBox.TabIndex = 17;
+ //
+ // uxPaymentTotalTextBox
+ //
+ this.uxPaymentTotalTextBox.Location = new System.Drawing.Point(111, 101);
+ this.uxPaymentTotalTextBox.Name = "uxPaymentTotalTextBox";
+ this.uxPaymentTotalTextBox.ReadOnly = true;
+ this.uxPaymentTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxPaymentTotalTextBox.TabIndex = 16;
+ //
+ // uxInvoiceTotalTextBox
+ //
+ this.uxInvoiceTotalTextBox.Location = new System.Drawing.Point(111, 78);
+ this.uxInvoiceTotalTextBox.Name = "uxInvoiceTotalTextBox";
+ this.uxInvoiceTotalTextBox.ReadOnly = true;
+ this.uxInvoiceTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceTotalTextBox.TabIndex = 15;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.uxVendorNameTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceNumberTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceDateTextBox);
+ this.groupBox1.Controls.Add(this.uxTermsTextBox);
+ this.groupBox1.Controls.Add(this.uxPaymentDateTextBox);
+ this.groupBox1.Controls.Add(this.uxDueDateTextBox);
+ this.groupBox1.Controls.Add(this.uxDeleteButton);
+ this.groupBox1.Controls.Add(this.uxCancelButton);
+ this.groupBox1.Controls.Add(this.uxCreditTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxPaymentTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceTotalTextBox);
+ this.groupBox1.Controls.Add(this.label9);
+ this.groupBox1.Controls.Add(this.label8);
+ this.groupBox1.Controls.Add(this.label7);
+ this.groupBox1.Controls.Add(this.label6);
+ this.groupBox1.Controls.Add(this.label5);
+ this.groupBox1.Controls.Add(this.label4);
+ this.groupBox1.Controls.Add(this.label3);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Location = new System.Drawing.Point(12, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(325, 281);
+ this.groupBox1.TabIndex = 1;
+ this.groupBox1.TabStop = false;
+ //
+ // uxVendorNameTextBox
+ //
+ this.uxVendorNameTextBox.Location = new System.Drawing.Point(111, 13);
+ this.uxVendorNameTextBox.Name = "uxVendorNameTextBox";
+ this.uxVendorNameTextBox.ReadOnly = true;
+ this.uxVendorNameTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxVendorNameTextBox.TabIndex = 25;
+ //
+ // uxInvoiceNumberTextBox
+ //
+ this.uxInvoiceNumberTextBox.Location = new System.Drawing.Point(111, 32);
+ this.uxInvoiceNumberTextBox.Name = "uxInvoiceNumberTextBox";
+ this.uxInvoiceNumberTextBox.ReadOnly = true;
+ this.uxInvoiceNumberTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceNumberTextBox.TabIndex = 24;
+ //
+ // uxInvoiceDateTextBox
+ //
+ this.uxInvoiceDateTextBox.Location = new System.Drawing.Point(111, 55);
+ this.uxInvoiceDateTextBox.Name = "uxInvoiceDateTextBox";
+ this.uxInvoiceDateTextBox.ReadOnly = true;
+ this.uxInvoiceDateTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceDateTextBox.TabIndex = 23;
+ //
+ // uxTermsTextBox
+ //
+ this.uxTermsTextBox.Location = new System.Drawing.Point(111, 197);
+ this.uxTermsTextBox.Name = "uxTermsTextBox";
+ this.uxTermsTextBox.ReadOnly = true;
+ this.uxTermsTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxTermsTextBox.TabIndex = 22;
+ //
+ // uxPaymentDateTextBox
+ //
+ this.uxPaymentDateTextBox.Location = new System.Drawing.Point(111, 174);
+ this.uxPaymentDateTextBox.Name = "uxPaymentDateTextBox";
+ this.uxPaymentDateTextBox.ReadOnly = true;
+ this.uxPaymentDateTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxPaymentDateTextBox.TabIndex = 21;
+ //
+ // uxDueDateTextBox
+ //
+ this.uxDueDateTextBox.Location = new System.Drawing.Point(111, 151);
+ this.uxDueDateTextBox.Name = "uxDueDateTextBox";
+ this.uxDueDateTextBox.ReadOnly = true;
+ this.uxDueDateTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxDueDateTextBox.TabIndex = 20;
+ //
+ // DeleteInvoiceView
+ //
+ this.AcceptButton = this.uxDeleteButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.uxCancelButton;
+ this.ClientSize = new System.Drawing.Size(352, 310);
+ this.Controls.Add(this.groupBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "DeleteInvoiceView";
+ this.Text = "DeleteInvoiceView";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button uxDeleteButton;
+ private System.Windows.Forms.Button uxCancelButton;
+ private System.Windows.Forms.TextBox uxCreditTotalTextBox;
+ private System.Windows.Forms.TextBox uxPaymentTotalTextBox;
+ private System.Windows.Forms.TextBox uxInvoiceTotalTextBox;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.TextBox uxDueDateTextBox;
+ private System.Windows.Forms.TextBox uxPaymentDateTextBox;
+ private System.Windows.Forms.TextBox uxTermsTextBox;
+ private System.Windows.Forms.TextBox uxInvoiceDateTextBox;
+ private System.Windows.Forms.TextBox uxInvoiceNumberTextBox;
+ private System.Windows.Forms.TextBox uxVendorNameTextBox;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.cs new file mode 100644 index 0000000..c707956 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.cs @@ -0,0 +1,59 @@ +using System.Windows.Forms;
+using Cmpp298.Assignment3.Presentation;
+
+namespace Cmpp298.Assignment3.Desktop.UI {
+ public partial class DeleteInvoiceView : Form, IDeleteInvoiceView {
+ private DeleteInvoicePresenter _presenter;
+
+ public DeleteInvoiceView( string invoiceId ) {
+ InitializeComponent( );
+ _presenter = new DeleteInvoicePresenter( invoiceId, this );
+
+ uxCancelButton.Click += delegate { Close( ); };
+ uxDeleteButton.Click += delegate { DeleteAndCloseWindow( ); };
+
+ _presenter.Initialize( );
+ }
+
+ public string VendorName {
+ set { uxVendorNameTextBox.Text = value; }
+ }
+
+ public string InvoiceNumber {
+ set { uxInvoiceNumberTextBox.Text = value; }
+ }
+
+ public string InvoiceDate {
+ set { uxInvoiceDateTextBox.Text = value; }
+ }
+
+ public string InvoiceTotal {
+ set { uxInvoiceTotalTextBox.Text = value; }
+ }
+
+ public string PaymentTotal {
+ set { uxPaymentTotalTextBox.Text = value; }
+ }
+
+ public string CreditTotal {
+ set { uxCreditTotalTextBox.Text = value; }
+ }
+
+ public string DueDate {
+ set { uxDueDateTextBox.Text = value; }
+ }
+
+ public string PaymentDate {
+ set { uxPaymentDateTextBox.Text = value; }
+ }
+
+ public string Terms {
+ set { uxTermsTextBox.Text = value; }
+ }
+
+ private void DeleteAndCloseWindow( ) {
+ _presenter.DeleteInvoice( );
+ Close( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.resx b/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/DeleteInvoiceView.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.Designer.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.Designer.cs new file mode 100644 index 0000000..e25e1b2 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.Designer.cs @@ -0,0 +1,287 @@ +namespace Cmpp298.Assignment3.Desktop.UI
+{
+ partial class EditInvoiceView
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if ( disposing && ( components != null ) )
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.uxTermsDropDownList = new System.Windows.Forms.ComboBox();
+ this.label9 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.uxInvoiceDatePicker = new System.Windows.Forms.DateTimePicker();
+ this.uxVendorNameTextBox = new System.Windows.Forms.TextBox();
+ this.uxInvoiceNumberTextBox = new System.Windows.Forms.TextBox();
+ this.uxUpdateButton = new System.Windows.Forms.Button();
+ this.uxCancelButton = new System.Windows.Forms.Button();
+ this.uxCreditTotalTextBox = new System.Windows.Forms.TextBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.uxPaymentTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxInvoiceTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxPaymentDatePicker = new System.Windows.Forms.DateTimePicker();
+ this.uxDueDatePicker = new System.Windows.Forms.DateTimePicker();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // uxTermsDropDownList
+ //
+ this.uxTermsDropDownList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.uxTermsDropDownList.FormattingEnabled = true;
+ this.uxTermsDropDownList.Location = new System.Drawing.Point(111, 192);
+ this.uxTermsDropDownList.Name = "uxTermsDropDownList";
+ this.uxTermsDropDownList.Size = new System.Drawing.Size(200, 21);
+ this.uxTermsDropDownList.TabIndex = 9;
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(6, 200);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(39, 13);
+ this.label9.TabIndex = 8;
+ this.label9.Text = "Terms:";
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(6, 177);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(77, 13);
+ this.label8.TabIndex = 7;
+ this.label8.Text = "Payment Date:";
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(6, 154);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(56, 13);
+ this.label7.TabIndex = 6;
+ this.label7.Text = "Due Date:";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(6, 131);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(64, 13);
+ this.label6.TabIndex = 5;
+ this.label6.Text = "Credit Total:";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(6, 108);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(78, 13);
+ this.label5.TabIndex = 4;
+ this.label5.Text = "Payment Total:";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(6, 85);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(72, 13);
+ this.label4.TabIndex = 3;
+ this.label4.Text = "Invoice Total:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(6, 62);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(71, 13);
+ this.label3.TabIndex = 2;
+ this.label3.Text = "Invoice Date:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(6, 39);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(55, 13);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "Invoice #:";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(6, 16);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(75, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Vendor Name:";
+ //
+ // uxInvoiceDatePicker
+ //
+ this.uxInvoiceDatePicker.Location = new System.Drawing.Point(111, 55);
+ this.uxInvoiceDatePicker.Name = "uxInvoiceDatePicker";
+ this.uxInvoiceDatePicker.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceDatePicker.TabIndex = 12;
+ //
+ // uxVendorNameTextBox
+ //
+ this.uxVendorNameTextBox.Location = new System.Drawing.Point(111, 13);
+ this.uxVendorNameTextBox.Name = "uxVendorNameTextBox";
+ this.uxVendorNameTextBox.ReadOnly = true;
+ this.uxVendorNameTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxVendorNameTextBox.TabIndex = 21;
+ //
+ // uxInvoiceNumberTextBox
+ //
+ this.uxInvoiceNumberTextBox.Location = new System.Drawing.Point(111, 32);
+ this.uxInvoiceNumberTextBox.Name = "uxInvoiceNumberTextBox";
+ this.uxInvoiceNumberTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceNumberTextBox.TabIndex = 20;
+ //
+ // uxUpdateButton
+ //
+ this.uxUpdateButton.Location = new System.Drawing.Point(155, 243);
+ this.uxUpdateButton.Name = "uxUpdateButton";
+ this.uxUpdateButton.Size = new System.Drawing.Size(75, 23);
+ this.uxUpdateButton.TabIndex = 19;
+ this.uxUpdateButton.Text = "&Update";
+ this.uxUpdateButton.UseVisualStyleBackColor = true;
+ //
+ // uxCancelButton
+ //
+ this.uxCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.uxCancelButton.Location = new System.Drawing.Point(236, 243);
+ this.uxCancelButton.Name = "uxCancelButton";
+ this.uxCancelButton.Size = new System.Drawing.Size(75, 23);
+ this.uxCancelButton.TabIndex = 18;
+ this.uxCancelButton.Text = "&Cancel";
+ this.uxCancelButton.UseVisualStyleBackColor = true;
+ //
+ // uxCreditTotalTextBox
+ //
+ this.uxCreditTotalTextBox.Location = new System.Drawing.Point(111, 124);
+ this.uxCreditTotalTextBox.Name = "uxCreditTotalTextBox";
+ this.uxCreditTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxCreditTotalTextBox.TabIndex = 17;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.uxVendorNameTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceNumberTextBox);
+ this.groupBox1.Controls.Add(this.uxUpdateButton);
+ this.groupBox1.Controls.Add(this.uxCancelButton);
+ this.groupBox1.Controls.Add(this.uxCreditTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxPaymentTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxPaymentDatePicker);
+ this.groupBox1.Controls.Add(this.uxDueDatePicker);
+ this.groupBox1.Controls.Add(this.uxInvoiceDatePicker);
+ this.groupBox1.Controls.Add(this.uxTermsDropDownList);
+ this.groupBox1.Controls.Add(this.label9);
+ this.groupBox1.Controls.Add(this.label8);
+ this.groupBox1.Controls.Add(this.label7);
+ this.groupBox1.Controls.Add(this.label6);
+ this.groupBox1.Controls.Add(this.label5);
+ this.groupBox1.Controls.Add(this.label4);
+ this.groupBox1.Controls.Add(this.label3);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Location = new System.Drawing.Point(12, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(324, 283);
+ this.groupBox1.TabIndex = 1;
+ this.groupBox1.TabStop = false;
+ //
+ // uxPaymentTotalTextBox
+ //
+ this.uxPaymentTotalTextBox.Location = new System.Drawing.Point(111, 101);
+ this.uxPaymentTotalTextBox.Name = "uxPaymentTotalTextBox";
+ this.uxPaymentTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxPaymentTotalTextBox.TabIndex = 16;
+ //
+ // uxInvoiceTotalTextBox
+ //
+ this.uxInvoiceTotalTextBox.Location = new System.Drawing.Point(111, 78);
+ this.uxInvoiceTotalTextBox.Name = "uxInvoiceTotalTextBox";
+ this.uxInvoiceTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceTotalTextBox.TabIndex = 15;
+ //
+ // uxPaymentDatePicker
+ //
+ this.uxPaymentDatePicker.Location = new System.Drawing.Point(111, 170);
+ this.uxPaymentDatePicker.Name = "uxPaymentDatePicker";
+ this.uxPaymentDatePicker.Size = new System.Drawing.Size(200, 20);
+ this.uxPaymentDatePicker.TabIndex = 14;
+ //
+ // uxDueDatePicker
+ //
+ this.uxDueDatePicker.Location = new System.Drawing.Point(111, 147);
+ this.uxDueDatePicker.Name = "uxDueDatePicker";
+ this.uxDueDatePicker.Size = new System.Drawing.Size(200, 20);
+ this.uxDueDatePicker.TabIndex = 13;
+ //
+ // EditInvoiceView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(348, 307);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "EditInvoiceView";
+ this.Text = "Edit Invoice";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ComboBox uxTermsDropDownList;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.DateTimePicker uxInvoiceDatePicker;
+ private System.Windows.Forms.TextBox uxVendorNameTextBox;
+ private System.Windows.Forms.TextBox uxInvoiceNumberTextBox;
+ private System.Windows.Forms.Button uxUpdateButton;
+ private System.Windows.Forms.Button uxCancelButton;
+ private System.Windows.Forms.TextBox uxCreditTotalTextBox;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.TextBox uxPaymentTotalTextBox;
+ private System.Windows.Forms.TextBox uxInvoiceTotalTextBox;
+ private System.Windows.Forms.DateTimePicker uxPaymentDatePicker;
+ private System.Windows.Forms.DateTimePicker uxDueDatePicker;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.cs new file mode 100644 index 0000000..fac853c --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.cs @@ -0,0 +1,77 @@ +using System;
+using System.Windows.Forms;
+using Cmpp298.Assignment3.Desktop.Adapters;
+using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Presentation;
+
+namespace Cmpp298.Assignment3.Desktop.UI {
+ public partial class EditInvoiceView : Form, IEditInvoiceView {
+ private DesktopDropDownList _termsDropDown;
+ private EditInvoicePresenter _presenter;
+
+ public EditInvoiceView( string invoiceId ) {
+ InitializeComponent( );
+
+ _termsDropDown = new DesktopDropDownList( uxTermsDropDownList );
+ _presenter = new EditInvoicePresenter( invoiceId, this );
+
+ uxUpdateButton.Click += delegate { UpdateAndCloseWindow( ); };
+ uxCancelButton.Click += delegate { Close( ); };
+
+ _presenter.Initialize( );
+ }
+
+ public IDropDownListAdapter TermsDropDown {
+ get { return _termsDropDown; }
+ }
+
+ public string VendorName {
+ get { return uxVendorNameTextBox.Text; }
+ set { uxVendorNameTextBox.Text = value; }
+ }
+
+ public string InvoiceNumber {
+ get { return uxInvoiceNumberTextBox.Text; }
+ set { uxInvoiceNumberTextBox.Text = value; }
+ }
+
+ public string InvoiceDate {
+ get { return uxInvoiceDatePicker.Value.ToString( ); }
+ set { uxInvoiceDatePicker.Value = Convert.ToDateTime( value ); }
+ }
+
+ public string InvoiceTotal {
+ get { return uxInvoiceTotalTextBox.Text; }
+ set { uxInvoiceTotalTextBox.Text = value; }
+ }
+
+ public string PaymentTotal {
+ get { return uxPaymentTotalTextBox.Text; }
+ set { uxPaymentTotalTextBox.Text = value; }
+ }
+
+ public string CreditTotal {
+ get { return uxCreditTotalTextBox.Text; }
+ set { uxCreditTotalTextBox.Text = value; }
+ }
+
+ public string DueDate {
+ get { return uxDueDatePicker.Value.ToString( ); }
+ set { uxDueDatePicker.Value = Convert.ToDateTime( value ); }
+ }
+
+ public string PaymentDate {
+ get { return uxPaymentDatePicker.Value.ToString( ); }
+ set { uxPaymentDatePicker.Value = Convert.ToDateTime( value ); }
+ }
+
+ public void ShowError( string message ) {
+ MessageBox.Show( message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error );
+ }
+
+ private void UpdateAndCloseWindow( ) {
+ _presenter.UpdateInvoice( );
+ Close( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.resx b/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/EditInvoiceView.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.Designer.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.Designer.cs new file mode 100644 index 0000000..db43e55 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.Designer.cs @@ -0,0 +1,162 @@ +namespace Cmpp298.Assignment3.Desktop.UI
+{
+ public partial class InvoicesMainView
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if ( disposing && ( components != null ) )
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.uxVendorsDropDown = new System.Windows.Forms.ComboBox();
+ this.uxInvoicesGridView = new System.Windows.Forms.DataGridView();
+ this.uxNewButton = new System.Windows.Forms.Button();
+ this.uxEditButton = new System.Windows.Forms.Button();
+ this.uxDeleteButton = new System.Windows.Forms.Button();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.uxRefreshButton = new System.Windows.Forms.Button();
+ ( (System.ComponentModel.ISupportInitialize)( this.uxInvoicesGridView ) ).BeginInit();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 14);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(44, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Vendor:";
+ //
+ // uxVendorsDropDown
+ //
+ this.uxVendorsDropDown.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left )
+ | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.uxVendorsDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.uxVendorsDropDown.FormattingEnabled = true;
+ this.uxVendorsDropDown.Location = new System.Drawing.Point(75, 23);
+ this.uxVendorsDropDown.Name = "uxVendorsDropDown";
+ this.uxVendorsDropDown.Size = new System.Drawing.Size(413, 21);
+ this.uxVendorsDropDown.TabIndex = 1;
+ //
+ // uxInvoicesGridView
+ //
+ this.uxInvoicesGridView.AllowUserToAddRows = false;
+ this.uxInvoicesGridView.AllowUserToDeleteRows = false;
+ this.uxInvoicesGridView.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( ( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom )
+ | System.Windows.Forms.AnchorStyles.Left )
+ | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.uxInvoicesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.uxInvoicesGridView.Location = new System.Drawing.Point(18, 50);
+ this.uxInvoicesGridView.Name = "uxInvoicesGridView";
+ this.uxInvoicesGridView.ReadOnly = true;
+ this.uxInvoicesGridView.Size = new System.Drawing.Size(551, 354);
+ this.uxInvoicesGridView.TabIndex = 2;
+ //
+ // uxNewButton
+ //
+ this.uxNewButton.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.uxNewButton.Location = new System.Drawing.Point(320, 398);
+ this.uxNewButton.Name = "uxNewButton";
+ this.uxNewButton.Size = new System.Drawing.Size(75, 23);
+ this.uxNewButton.TabIndex = 3;
+ this.uxNewButton.Text = "&New...";
+ this.uxNewButton.UseVisualStyleBackColor = true;
+ //
+ // uxEditButton
+ //
+ this.uxEditButton.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.uxEditButton.Location = new System.Drawing.Point(401, 398);
+ this.uxEditButton.Name = "uxEditButton";
+ this.uxEditButton.Size = new System.Drawing.Size(75, 23);
+ this.uxEditButton.TabIndex = 4;
+ this.uxEditButton.Text = "&Edit...";
+ this.uxEditButton.UseVisualStyleBackColor = true;
+ //
+ // uxDeleteButton
+ //
+ this.uxDeleteButton.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.uxDeleteButton.Location = new System.Drawing.Point(482, 398);
+ this.uxDeleteButton.Name = "uxDeleteButton";
+ this.uxDeleteButton.Size = new System.Drawing.Size(75, 23);
+ this.uxDeleteButton.TabIndex = 5;
+ this.uxDeleteButton.Text = "&Delete...";
+ this.uxDeleteButton.UseVisualStyleBackColor = true;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( ( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom )
+ | System.Windows.Forms.AnchorStyles.Left )
+ | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.groupBox1.Controls.Add(this.uxRefreshButton);
+ this.groupBox1.Controls.Add(this.uxNewButton);
+ this.groupBox1.Controls.Add(this.uxEditButton);
+ this.groupBox1.Controls.Add(this.uxDeleteButton);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Location = new System.Drawing.Point(12, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(563, 427);
+ this.groupBox1.TabIndex = 6;
+ this.groupBox1.TabStop = false;
+ //
+ // uxRefreshButton
+ //
+ this.uxRefreshButton.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
+ this.uxRefreshButton.Location = new System.Drawing.Point(482, 11);
+ this.uxRefreshButton.Name = "uxRefreshButton";
+ this.uxRefreshButton.Size = new System.Drawing.Size(75, 23);
+ this.uxRefreshButton.TabIndex = 6;
+ this.uxRefreshButton.Text = "&Refresh";
+ this.uxRefreshButton.UseVisualStyleBackColor = true;
+ //
+ // InvoicesMainView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(587, 451);
+ this.Controls.Add(this.uxInvoicesGridView);
+ this.Controls.Add(this.uxVendorsDropDown);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "InvoicesMainView";
+ this.Text = "InvoicesMainView";
+ ( (System.ComponentModel.ISupportInitialize)( this.uxInvoicesGridView ) ).EndInit();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.ComboBox uxVendorsDropDown;
+ private System.Windows.Forms.DataGridView uxInvoicesGridView;
+ private System.Windows.Forms.Button uxNewButton;
+ private System.Windows.Forms.Button uxEditButton;
+ private System.Windows.Forms.Button uxDeleteButton;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Button uxRefreshButton;
+ }
+}
+
diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.cs new file mode 100644 index 0000000..809d6d7 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic;
+using System.Windows.Forms;
+using Cmpp298.Assignment3.Desktop.Adapters;
+using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Presentation;
+
+namespace Cmpp298.Assignment3.Desktop.UI {
+ public partial class InvoicesMainView : Form, IInvoicesMainView {
+ private DesktopDropDownList _vendorsDropDown;
+ private InvoicesMainPresenter _presenter;
+
+ public InvoicesMainView( ) {
+ InitializeComponent( );
+ _vendorsDropDown = new DesktopDropDownList( uxVendorsDropDown );
+ _presenter = new InvoicesMainPresenter( this );
+ _presenter.Initialize( );
+
+ HookupEventHandlers( );
+ _presenter.LoadInvoices( );
+ }
+
+ public IDropDownListAdapter VendorNames {
+ get { return _vendorsDropDown; }
+ }
+
+ public void BindTo( IEnumerable< DisplayInvoiceDto > invoices ) {
+ uxInvoicesGridView.DataSource = invoices;
+ }
+
+ private delegate void Callback( string invoiceId );
+
+ private void OpenDeleteScreen( ) {
+ OpenScreen( delegate( string invoiceId ) { new DeleteInvoiceView( invoiceId ).ShowDialog( ); } );
+ }
+
+ private void OpenEditScreen( ) {
+ OpenScreen( delegate( string invoiceId ) { new EditInvoiceView( invoiceId ).ShowDialog( ); } );
+ }
+
+ private void OpenScreen( Callback callback ) {
+ if ( uxInvoicesGridView.SelectedRows.Count == 1 ) {
+ string invoiceId = uxInvoicesGridView.SelectedRows[ 0 ].Cells[ "InvoiceId" ].Value.ToString( );
+ callback( invoiceId );
+ _presenter.LoadInvoices( );
+ }
+ else {
+ MessageBox.Show( "Please select a single row", "Select a Row", MessageBoxButtons.OK, MessageBoxIcon.Error );
+ }
+ }
+
+ private void HookupEventHandlers( ) {
+ uxNewButton.Click += delegate { OpenNewWindow( ); };
+ uxEditButton.Click += delegate { OpenEditScreen( ); };
+ uxDeleteButton.Click += delegate { OpenDeleteScreen( ); };
+ uxRefreshButton.Click += delegate { _presenter.LoadInvoices( ); };
+ uxVendorsDropDown.SelectedIndexChanged += delegate { _presenter.LoadInvoices( ); };
+ }
+
+ private void OpenNewWindow( ) {
+ new NewInvoiceView( _vendorsDropDown.SelectedItem.Value ).ShowDialog( );
+ _presenter.LoadInvoices( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.resx b/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/InvoicesMainView.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.Designer.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.Designer.cs new file mode 100644 index 0000000..ba7346d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.Designer.cs @@ -0,0 +1,294 @@ +
+namespace Cmpp298.Assignment3.Desktop.UI
+{
+ partial class NewInvoiceView
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if ( disposing && ( components != null ) )
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.uxSaveButton = new System.Windows.Forms.Button();
+ this.uxCancelButton = new System.Windows.Forms.Button();
+ this.uxCreditTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxPaymentTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxInvoiceTotalTextBox = new System.Windows.Forms.TextBox();
+ this.uxPaymentDatePicker = new System.Windows.Forms.DateTimePicker();
+ this.uxDueDatePicker = new System.Windows.Forms.DateTimePicker();
+ this.uxInvoiceDatePicker = new System.Windows.Forms.DateTimePicker();
+ this.uxTermsDropDownList = new System.Windows.Forms.ComboBox();
+ this.label9 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.uxInvoiceNumberTextBox = new System.Windows.Forms.TextBox();
+ this.uxVendorNameTextBox = new System.Windows.Forms.TextBox();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.uxVendorNameTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceNumberTextBox);
+ this.groupBox1.Controls.Add(this.uxSaveButton);
+ this.groupBox1.Controls.Add(this.uxCancelButton);
+ this.groupBox1.Controls.Add(this.uxCreditTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxPaymentTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxInvoiceTotalTextBox);
+ this.groupBox1.Controls.Add(this.uxPaymentDatePicker);
+ this.groupBox1.Controls.Add(this.uxDueDatePicker);
+ this.groupBox1.Controls.Add(this.uxInvoiceDatePicker);
+ this.groupBox1.Controls.Add(this.uxTermsDropDownList);
+ this.groupBox1.Controls.Add(this.label9);
+ this.groupBox1.Controls.Add(this.label8);
+ this.groupBox1.Controls.Add(this.label7);
+ this.groupBox1.Controls.Add(this.label6);
+ this.groupBox1.Controls.Add(this.label5);
+ this.groupBox1.Controls.Add(this.label4);
+ this.groupBox1.Controls.Add(this.label3);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Location = new System.Drawing.Point(12, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(325, 281);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ //
+ // uxSaveButton
+ //
+ this.uxSaveButton.Location = new System.Drawing.Point(155, 243);
+ this.uxSaveButton.Name = "uxSaveButton";
+ this.uxSaveButton.Size = new System.Drawing.Size(75, 23);
+ this.uxSaveButton.TabIndex = 19;
+ this.uxSaveButton.Text = "&Save";
+ this.uxSaveButton.UseVisualStyleBackColor = true;
+ //
+ // uxCancelButton
+ //
+ this.uxCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.uxCancelButton.Location = new System.Drawing.Point(236, 243);
+ this.uxCancelButton.Name = "uxCancelButton";
+ this.uxCancelButton.Size = new System.Drawing.Size(75, 23);
+ this.uxCancelButton.TabIndex = 18;
+ this.uxCancelButton.Text = "&Cancel";
+ this.uxCancelButton.UseVisualStyleBackColor = true;
+ //
+ // uxCreditTotalTextBox
+ //
+ this.uxCreditTotalTextBox.Location = new System.Drawing.Point(111, 124);
+ this.uxCreditTotalTextBox.Name = "uxCreditTotalTextBox";
+ this.uxCreditTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxCreditTotalTextBox.TabIndex = 17;
+ //
+ // uxPaymentTotalTextBox
+ //
+ this.uxPaymentTotalTextBox.Location = new System.Drawing.Point(111, 101);
+ this.uxPaymentTotalTextBox.Name = "uxPaymentTotalTextBox";
+ this.uxPaymentTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxPaymentTotalTextBox.TabIndex = 16;
+ //
+ // uxInvoiceTotalTextBox
+ //
+ this.uxInvoiceTotalTextBox.Location = new System.Drawing.Point(111, 78);
+ this.uxInvoiceTotalTextBox.Name = "uxInvoiceTotalTextBox";
+ this.uxInvoiceTotalTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceTotalTextBox.TabIndex = 15;
+ //
+ // uxPaymentDatePicker
+ //
+ this.uxPaymentDatePicker.Location = new System.Drawing.Point(111, 170);
+ this.uxPaymentDatePicker.Name = "uxPaymentDatePicker";
+ this.uxPaymentDatePicker.Size = new System.Drawing.Size(200, 20);
+ this.uxPaymentDatePicker.TabIndex = 14;
+ //
+ // uxDueDatePicker
+ //
+ this.uxDueDatePicker.Location = new System.Drawing.Point(111, 147);
+ this.uxDueDatePicker.Name = "uxDueDatePicker";
+ this.uxDueDatePicker.Size = new System.Drawing.Size(200, 20);
+ this.uxDueDatePicker.TabIndex = 13;
+ //
+ // uxInvoiceDatePicker
+ //
+ this.uxInvoiceDatePicker.Location = new System.Drawing.Point(111, 55);
+ this.uxInvoiceDatePicker.Name = "uxInvoiceDatePicker";
+ this.uxInvoiceDatePicker.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceDatePicker.TabIndex = 12;
+ //
+ // uxTermsDropDownList
+ //
+ this.uxTermsDropDownList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.uxTermsDropDownList.FormattingEnabled = true;
+ this.uxTermsDropDownList.Location = new System.Drawing.Point(111, 192);
+ this.uxTermsDropDownList.Name = "uxTermsDropDownList";
+ this.uxTermsDropDownList.Size = new System.Drawing.Size(200, 21);
+ this.uxTermsDropDownList.TabIndex = 9;
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(6, 200);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(39, 13);
+ this.label9.TabIndex = 8;
+ this.label9.Text = "Terms:";
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(6, 177);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(77, 13);
+ this.label8.TabIndex = 7;
+ this.label8.Text = "Payment Date:";
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(6, 154);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(56, 13);
+ this.label7.TabIndex = 6;
+ this.label7.Text = "Due Date:";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(6, 131);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(64, 13);
+ this.label6.TabIndex = 5;
+ this.label6.Text = "Credit Total:";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(6, 108);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(78, 13);
+ this.label5.TabIndex = 4;
+ this.label5.Text = "Payment Total:";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(6, 85);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(72, 13);
+ this.label4.TabIndex = 3;
+ this.label4.Text = "Invoice Total:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(6, 62);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(71, 13);
+ this.label3.TabIndex = 2;
+ this.label3.Text = "Invoice Date:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(6, 39);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(55, 13);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "Invoice #:";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(6, 16);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(75, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Vendor Name:";
+ //
+ // uxInvoiceNumberTextBox
+ //
+ this.uxInvoiceNumberTextBox.Location = new System.Drawing.Point(111, 32);
+ this.uxInvoiceNumberTextBox.Name = "uxInvoiceNumberTextBox";
+ this.uxInvoiceNumberTextBox.ReadOnly = true;
+ this.uxInvoiceNumberTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxInvoiceNumberTextBox.TabIndex = 20;
+ //
+ // uxVendorNameTextBox
+ //
+ this.uxVendorNameTextBox.Location = new System.Drawing.Point(111, 13);
+ this.uxVendorNameTextBox.Name = "uxVendorNameTextBox";
+ this.uxVendorNameTextBox.ReadOnly = true;
+ this.uxVendorNameTextBox.Size = new System.Drawing.Size(200, 20);
+ this.uxVendorNameTextBox.TabIndex = 21;
+ //
+ // NewInvoiceView
+ //
+ this.AcceptButton = this.uxSaveButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.uxCancelButton;
+ this.ClientSize = new System.Drawing.Size(349, 305);
+ this.Controls.Add(this.groupBox1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "NewInvoiceView";
+ this.Text = "Create a New Invoice";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.ComboBox uxTermsDropDownList;
+ private System.Windows.Forms.DateTimePicker uxInvoiceDatePicker;
+ private System.Windows.Forms.DateTimePicker uxDueDatePicker;
+ private System.Windows.Forms.DateTimePicker uxPaymentDatePicker;
+ private System.Windows.Forms.TextBox uxInvoiceTotalTextBox;
+ private System.Windows.Forms.TextBox uxPaymentTotalTextBox;
+ private System.Windows.Forms.TextBox uxCreditTotalTextBox;
+ private System.Windows.Forms.Button uxCancelButton;
+ private System.Windows.Forms.Button uxSaveButton;
+ private System.Windows.Forms.TextBox uxInvoiceNumberTextBox;
+ private System.Windows.Forms.TextBox uxVendorNameTextBox;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.cs new file mode 100644 index 0000000..ae2135f --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.cs @@ -0,0 +1,66 @@ +using System.Windows.Forms;
+using Cmpp298.Assignment3.Desktop.Adapters;
+using Cmpp298.Assignment3.Dto;
+using Cmpp298.Assignment3.Presentation;
+
+namespace Cmpp298.Assignment3.Desktop.UI {
+ public partial class NewInvoiceView : Form, INewInvoiceView {
+ private NewInvoicePresenter _presenter;
+ private DesktopDropDownList _termsDropDown;
+
+ public NewInvoiceView( string vendorId ) {
+ InitializeComponent( );
+ _termsDropDown = new DesktopDropDownList( uxTermsDropDownList );
+ _presenter = new NewInvoicePresenter( vendorId, this );
+ _presenter.Load( );
+ uxCancelButton.Click += delegate { Close( ); };
+ uxSaveButton.Click += delegate { SaveAndCloseScreen( ); };
+ }
+
+ public IDropDownListAdapter Terms {
+ get { return _termsDropDown; }
+ }
+
+ public string InvoiceNumber {
+ get { return uxInvoiceNumberTextBox.Text; }
+ set { uxInvoiceNumberTextBox.Text = value; }
+ }
+
+ public string InvoiceDate {
+ get { return uxInvoiceDatePicker.Value.ToString( ); }
+ }
+
+ public string InvoiceTotal {
+ get { return uxInvoiceTotalTextBox.Text; }
+ }
+
+ public string PaymentTotal {
+ get { return uxPaymentTotalTextBox.Text; }
+ }
+
+ public string CreditTotal {
+ get { return uxCreditTotalTextBox.Text; }
+ }
+
+ public string DueDate {
+ get { return uxDueDatePicker.Value.ToString( ); }
+ }
+
+ public string PaymentDate {
+ get { return uxPaymentDatePicker.Value.ToString( ); }
+ }
+
+ public void ShowError( string message ) {
+ MessageBox.Show( message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error );
+ }
+
+ public void BindTo( DisplayVendorNameDto displayVendorNameDto ) {
+ uxVendorNameTextBox.Text = displayVendorNameDto.VendorName;
+ }
+
+ private void SaveAndCloseScreen( ) {
+ _presenter.SaveInvoice( );
+ Close( );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.resx b/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Program.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/Program.cs new file mode 100644 index 0000000..1b6f16b --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Program.cs @@ -0,0 +1,20 @@ +using System;
+using System.Windows.Forms;
+
+namespace Cmpp298.Assignment3.Desktop.UI {
+ internal static class Program {
+ /// <summary>The main entry point for the application.</summary>
+ [STAThread]
+ private static void Main( ) {
+ try {
+ Application.EnableVisualStyles( );
+ Application.SetCompatibleTextRenderingDefault( false );
+ Application.Run( new InvoicesMainView( ) );
+ }
+ catch {
+ MessageBox.Show( "I'm sorry but an unexpected error has occurred.", "Ooops!", MessageBoxButtons.OK,
+ MessageBoxIcon.Error );
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..619912c --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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("Cmpp298.Assignment3.Desktop.UI")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Desktop.UI")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("a0b2b859-9d29-40fd-9ba5-c08949290739")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Resources.Designer.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ff74f57 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.832
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Cmpp298.Assignment3.Desktop.UI.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Cmpp298.Assignment3.Desktop.UI.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Resources.resx b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Resources.resx new file mode 100644 index 0000000..c40a448 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Settings.Designer.cs b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..7f9ee92 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.832
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Cmpp298.Assignment3.Desktop.UI.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Settings.settings b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Desktop.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/src/app/Cmpp298.Assignment3.Domain/AmountEntrySpecification.cs b/src/app/Cmpp298.Assignment3.Domain/AmountEntrySpecification.cs new file mode 100644 index 0000000..d7bfe18 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Domain/AmountEntrySpecification.cs @@ -0,0 +1,9 @@ +using System.Text.RegularExpressions;
+
+namespace Cmpp298.Assignment3.Domain {
+ public class AmountEntrySpecification : ISpecification< string > {
+ public bool IsSatisfiedBy( string input ) {
+ return Regex.IsMatch( input, @"(^\d*\.?\d*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$)" );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Domain/Cmpp298.Assignment3.Domain.csproj b/src/app/Cmpp298.Assignment3.Domain/Cmpp298.Assignment3.Domain.csproj new file mode 100644 index 0000000..35e09f9 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Domain/Cmpp298.Assignment3.Domain.csproj @@ -0,0 +1,48 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C11B2649-751A-4F49-B28D-AB36A8213674}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Domain</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Domain</AssemblyName>
+ </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.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AmountEntrySpecification.cs" />
+ <Compile Include="ISpecification.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Domain/ISpecification.cs b/src/app/Cmpp298.Assignment3.Domain/ISpecification.cs new file mode 100644 index 0000000..3de13bd --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Domain/ISpecification.cs @@ -0,0 +1,5 @@ +namespace Cmpp298.Assignment3.Domain {
+ internal interface ISpecification< T > {
+ bool IsSatisfiedBy( T item );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Domain/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Domain/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a28526c --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Domain/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Cmpp298.Assignment3.Domain")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Domain")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("16058903-5893-4699-8a08-4bfb99649482")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.Dto/Cmpp298.Assignment3.Dto.csproj b/src/app/Cmpp298.Assignment3.Dto/Cmpp298.Assignment3.Dto.csproj new file mode 100644 index 0000000..ca9b231 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/Cmpp298.Assignment3.Dto.csproj @@ -0,0 +1,53 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{29260A8E-3F7B-4D9B-BBE3-81210F4B9E5B}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Dto</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Dto</AssemblyName>
+ </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.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DisplayVendorNameDto.cs" />
+ <Compile Include="IDropDownListAdapter.cs" />
+ <Compile Include="IDropDownListItem.cs" />
+ <Compile Include="DisplayInvoiceDto.cs" />
+ <Compile Include="DropDownListItem.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SaveInvoiceDto.cs" />
+ <Compile Include="UpdateInvoiceDto.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/DisplayInvoiceDto.cs b/src/app/Cmpp298.Assignment3.Dto/DisplayInvoiceDto.cs new file mode 100644 index 0000000..60a6739 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/DisplayInvoiceDto.cs @@ -0,0 +1,68 @@ +namespace Cmpp298.Assignment3.Dto {
+ public class DisplayInvoiceDto {
+ public DisplayInvoiceDto( string invoiceId, string vendorName, string invoiceNumber, string invoiceDate, string invoiceTotal,
+ string paymentTotal, string creditTotal, string terms, string dueDate, string paymentDate ) {
+ _invoiceId = invoiceId;
+ _vendorName = vendorName;
+ _invoiceNumber = invoiceNumber;
+ _invoiceDate = invoiceDate;
+ _invoiceTotal = invoiceTotal;
+ _paymentTotal = paymentTotal;
+ _creditTotal = creditTotal;
+ _terms = terms;
+ _dueDate = dueDate;
+ _paymentDate = paymentDate;
+ }
+
+ public string InvoiceId {
+ get { return _invoiceId; }
+ }
+
+ public string VendorName {
+ get { return _vendorName; }
+ }
+
+ public string InvoiceNumber {
+ get { return _invoiceNumber; }
+ }
+
+ public string InvoiceDate {
+ get { return _invoiceDate; }
+ }
+
+ public string InvoiceTotal {
+ get { return _invoiceTotal; }
+ }
+
+ public string PaymentTotal {
+ get { return _paymentTotal; }
+ }
+
+ public string CreditTotal {
+ get { return _creditTotal; }
+ }
+
+ public string Terms {
+ get { return _terms; }
+ }
+
+ public string DueDate {
+ get { return _dueDate; }
+ }
+
+ public string PaymentDate {
+ get { return _paymentDate; }
+ }
+
+ private readonly string _invoiceId;
+ private readonly string _vendorName;
+ private readonly string _invoiceNumber;
+ private readonly string _invoiceDate;
+ private readonly string _invoiceTotal;
+ private readonly string _paymentTotal;
+ private readonly string _creditTotal;
+ private readonly string _terms;
+ private readonly string _dueDate;
+ private readonly string _paymentDate;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/DisplayVendorNameDto.cs b/src/app/Cmpp298.Assignment3.Dto/DisplayVendorNameDto.cs new file mode 100644 index 0000000..8c75007 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/DisplayVendorNameDto.cs @@ -0,0 +1,19 @@ +namespace Cmpp298.Assignment3.Dto {
+ public class DisplayVendorNameDto {
+ public DisplayVendorNameDto( string vendorId, string vendorName ) {
+ _vendorId = vendorId;
+ _vendorName = vendorName;
+ }
+
+ public string VendorId {
+ get { return _vendorId; }
+ }
+
+ public string VendorName {
+ get { return _vendorName; }
+ }
+
+ private readonly string _vendorId;
+ private readonly string _vendorName;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/DropDownListItem.cs b/src/app/Cmpp298.Assignment3.Dto/DropDownListItem.cs new file mode 100644 index 0000000..de35116 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/DropDownListItem.cs @@ -0,0 +1,19 @@ +namespace Cmpp298.Assignment3.Dto {
+ public class DropDownListItem : IDropDownListItem {
+ public DropDownListItem( string text, string value ) {
+ _text = text;
+ _value = value;
+ }
+
+ public string Text {
+ get { return _text; }
+ }
+
+ public string Value {
+ get { return _value; }
+ }
+
+ private readonly string _text;
+ private readonly string _value;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/IDropDownListAdapter.cs b/src/app/Cmpp298.Assignment3.Dto/IDropDownListAdapter.cs new file mode 100644 index 0000000..49276c4 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/IDropDownListAdapter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic;
+
+namespace Cmpp298.Assignment3.Dto {
+ public interface IDropDownListAdapter {
+ void BindTo( IEnumerable< IDropDownListItem > pairs );
+
+ IDropDownListItem SelectedItem { get; }
+
+ void SetSelectedItemTo( string text );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/IDropDownListItem.cs b/src/app/Cmpp298.Assignment3.Dto/IDropDownListItem.cs new file mode 100644 index 0000000..7f7b61c --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/IDropDownListItem.cs @@ -0,0 +1,6 @@ +namespace Cmpp298.Assignment3.Dto {
+ public interface IDropDownListItem {
+ string Text { get; }
+ string Value { get; }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Dto/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c2d57cf --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Cmpp298.Assignment3.Dto")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Dto")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("553070cd-fb1c-428a-8463-877bd5bbcbb8")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.Dto/SaveInvoiceDto.cs b/src/app/Cmpp298.Assignment3.Dto/SaveInvoiceDto.cs new file mode 100644 index 0000000..be496ba --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/SaveInvoiceDto.cs @@ -0,0 +1,113 @@ +namespace Cmpp298.Assignment3.Dto {
+ public class SaveInvoiceDto {
+ public SaveInvoiceDto( string vendorId, string invoiceNumber, string invoiceDate, string invoiceTotal,
+ string paymentTotal, string creditTotal, string dueDate, string paymentDate, string termsId ) {
+ _vendorId = vendorId;
+ _invoiceNumber = invoiceNumber;
+ _invoiceDate = invoiceDate;
+ _invoiceTotal = invoiceTotal;
+ _paymentTotal = paymentTotal;
+ _creditTotal = creditTotal;
+ _dueDate = dueDate;
+ _paymentDate = paymentDate;
+ _termsId = termsId;
+ }
+
+ public string VendorId {
+ get { return _vendorId; }
+ }
+
+ public string InvoiceNumber {
+ get { return _invoiceNumber; }
+ }
+
+ public string InvoiceDate {
+ get { return _invoiceDate; }
+ }
+
+ public string InvoiceTotal {
+ get { return _invoiceTotal; }
+ }
+
+ public string PaymentTotal {
+ get { return _paymentTotal; }
+ }
+
+ public string CreditTotal {
+ get { return _creditTotal; }
+ }
+
+ public string DueDate {
+ get { return _dueDate; }
+ }
+
+ public string PaymentDate {
+ get { return _paymentDate; }
+ }
+
+ public string TermsId {
+ get { return _termsId; }
+ }
+
+ public override bool Equals( object obj ) {
+ if ( this == obj ) {
+ return true;
+ }
+ SaveInvoiceDto saveInvoiceDto = obj as SaveInvoiceDto;
+ if ( saveInvoiceDto == null ) {
+ return false;
+ }
+ if ( !Equals( _vendorId, saveInvoiceDto._vendorId ) ) {
+ return false;
+ }
+ if ( !Equals( _invoiceNumber, saveInvoiceDto._invoiceNumber ) ) {
+ return false;
+ }
+ if ( !Equals( _invoiceDate, saveInvoiceDto._invoiceDate ) ) {
+ return false;
+ }
+ if ( !Equals( _invoiceTotal, saveInvoiceDto._invoiceTotal ) ) {
+ return false;
+ }
+ if ( !Equals( _paymentTotal, saveInvoiceDto._paymentTotal ) ) {
+ return false;
+ }
+ if ( !Equals( _creditTotal, saveInvoiceDto._creditTotal ) ) {
+ return false;
+ }
+ if ( !Equals( _dueDate, saveInvoiceDto._dueDate ) ) {
+ return false;
+ }
+ if ( !Equals( _paymentDate, saveInvoiceDto._paymentDate ) ) {
+ return false;
+ }
+ if ( !Equals( _termsId, saveInvoiceDto._termsId ) ) {
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode( ) {
+ int result = _vendorId != null ? _vendorId.GetHashCode( ) : 0;
+ result = 29*result + ( _invoiceNumber != null ? _invoiceNumber.GetHashCode( ) : 0 );
+ result = 29*result + ( _invoiceDate != null ? _invoiceDate.GetHashCode( ) : 0 );
+ result = 29*result + ( _invoiceTotal != null ? _invoiceTotal.GetHashCode( ) : 0 );
+ result = 29*result + ( _paymentTotal != null ? _paymentTotal.GetHashCode( ) : 0 );
+ result = 29*result + ( _creditTotal != null ? _creditTotal.GetHashCode( ) : 0 );
+ result = 29*result + ( _dueDate != null ? _dueDate.GetHashCode( ) : 0 );
+ result = 29*result + ( _paymentDate != null ? _paymentDate.GetHashCode( ) : 0 );
+ result = 29*result + ( _termsId != null ? _termsId.GetHashCode( ) : 0 );
+ return result;
+ }
+
+ private readonly string _vendorId;
+ private readonly string _invoiceNumber;
+ private readonly string _invoiceDate;
+ private readonly string _invoiceTotal;
+ private readonly string _paymentTotal;
+ private readonly string _creditTotal;
+ private readonly string _dueDate;
+ private readonly string _paymentDate;
+ private readonly string _termsId;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Dto/UpdateInvoiceDto.cs b/src/app/Cmpp298.Assignment3.Dto/UpdateInvoiceDto.cs new file mode 100644 index 0000000..ba4c88e --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Dto/UpdateInvoiceDto.cs @@ -0,0 +1,113 @@ +namespace Cmpp298.Assignment3.Dto {
+ public class UpdateInvoiceDto {
+ public UpdateInvoiceDto( string invoiceId, string invoiceNumber, string invoiceDate, string invoiceTotal,
+ string paymentTotal, string creditTotal, string dueDate, string paymentDate, string termsId ) {
+ _invoiceId = invoiceId;
+ _invoiceNumber = invoiceNumber;
+ _invoiceDate = invoiceDate;
+ _invoiceTotal = invoiceTotal;
+ _paymentTotal = paymentTotal;
+ _creditTotal = creditTotal;
+ _dueDate = dueDate;
+ _paymentDate = paymentDate;
+ _termsId = termsId;
+ }
+
+ public string InvoiceId {
+ get { return _invoiceId; }
+ }
+
+ public string InvoiceNumber {
+ get { return _invoiceNumber; }
+ }
+
+ public string InvoiceDate {
+ get { return _invoiceDate; }
+ }
+
+ public string InvoiceTotal {
+ get { return _invoiceTotal; }
+ }
+
+ public string PaymentTotal {
+ get { return _paymentTotal; }
+ }
+
+ public string CreditTotal {
+ get { return _creditTotal; }
+ }
+
+ public string DueDate {
+ get { return _dueDate; }
+ }
+
+ public string PaymentDate {
+ get { return _paymentDate; }
+ }
+
+ public string TermsId {
+ get { return _termsId; }
+ }
+
+ public override bool Equals( object obj ) {
+ if ( this == obj ) {
+ return true;
+ }
+ UpdateInvoiceDto updateInvoiceDto = obj as UpdateInvoiceDto;
+ if ( updateInvoiceDto == null ) {
+ return false;
+ }
+ if ( !Equals( _invoiceId, updateInvoiceDto._invoiceId ) ) {
+ return false;
+ }
+ if ( !Equals( _invoiceNumber, updateInvoiceDto._invoiceNumber ) ) {
+ return false;
+ }
+ if ( !Equals( _invoiceDate, updateInvoiceDto._invoiceDate ) ) {
+ return false;
+ }
+ if ( !Equals( _invoiceTotal, updateInvoiceDto._invoiceTotal ) ) {
+ return false;
+ }
+ if ( !Equals( _paymentTotal, updateInvoiceDto._paymentTotal ) ) {
+ return false;
+ }
+ if ( !Equals( _creditTotal, updateInvoiceDto._creditTotal ) ) {
+ return false;
+ }
+ if ( !Equals( _dueDate, updateInvoiceDto._dueDate ) ) {
+ return false;
+ }
+ if ( !Equals( _paymentDate, updateInvoiceDto._paymentDate ) ) {
+ return false;
+ }
+ if ( !Equals( _termsId, updateInvoiceDto._termsId ) ) {
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode( ) {
+ int result = _invoiceId != null ? _invoiceId.GetHashCode( ) : 0;
+ result = 29*result + ( _invoiceNumber != null ? _invoiceNumber.GetHashCode( ) : 0 );
+ result = 29*result + ( _invoiceDate != null ? _invoiceDate.GetHashCode( ) : 0 );
+ result = 29*result + ( _invoiceTotal != null ? _invoiceTotal.GetHashCode( ) : 0 );
+ result = 29*result + ( _paymentTotal != null ? _paymentTotal.GetHashCode( ) : 0 );
+ result = 29*result + ( _creditTotal != null ? _creditTotal.GetHashCode( ) : 0 );
+ result = 29*result + ( _dueDate != null ? _dueDate.GetHashCode( ) : 0 );
+ result = 29*result + ( _paymentDate != null ? _paymentDate.GetHashCode( ) : 0 );
+ result = 29*result + ( _termsId != null ? _termsId.GetHashCode( ) : 0 );
+ return result;
+ }
+
+ private readonly string _invoiceId;
+ private readonly string _invoiceNumber;
+ private readonly string _invoiceDate;
+ private readonly string _invoiceTotal;
+ private readonly string _paymentTotal;
+ private readonly string _creditTotal;
+ private readonly string _dueDate;
+ private readonly string _paymentDate;
+ private readonly string _termsId;
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/Cmpp298.Assignment3.Task.csproj b/src/app/Cmpp298.Assignment3.Task/Cmpp298.Assignment3.Task.csproj new file mode 100644 index 0000000..415d8e7 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/Cmpp298.Assignment3.Task.csproj @@ -0,0 +1,63 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A747CA6E-EEA1-42E0-BA90-69317F8BF45D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Task</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Task</AssemblyName>
+ </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.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="IInvoiceTask.cs" />
+ <Compile Include="InvoiceTask.cs" />
+ <Compile Include="ITermTask.cs" />
+ <Compile Include="IVendorTask.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TermTask.cs" />
+ <Compile Include="VendorTask.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Cmpp298.Assignment3.DataAccess\Cmpp298.Assignment3.DataAccess.csproj">
+ <Project>{48B09B0E-F2D5-463D-9FAB-C1781CA46D4D}</Project>
+ <Name>Cmpp298.Assignment3.DataAccess</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Dto\Cmpp298.Assignment3.Dto.csproj">
+ <Project>{29260A8E-3F7B-4D9B-BBE3-81210F4B9E5B}</Project>
+ <Name>Cmpp298.Assignment3.Dto</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/IInvoiceTask.cs b/src/app/Cmpp298.Assignment3.Task/IInvoiceTask.cs new file mode 100644 index 0000000..43d6244 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/IInvoiceTask.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Task {
+ public interface IInvoiceTask {
+ int SaveNewInvoice( SaveInvoiceDto saveInvoiceDto );
+ IEnumerable< DisplayInvoiceDto > GetAllInvoices( string forVendorId );
+ DisplayInvoiceDto GetInvoiceBy(string invoiceId);
+ void DeleteInvoice( string invoiceId );
+ void UpdateInvoice( UpdateInvoiceDto dto );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/ITermTask.cs b/src/app/Cmpp298.Assignment3.Task/ITermTask.cs new file mode 100644 index 0000000..9ed735f --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/ITermTask.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Task {
+ public interface ITermTask {
+ IEnumerable< IDropDownListItem > GetAll( );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/IVendorTask.cs b/src/app/Cmpp298.Assignment3.Task/IVendorTask.cs new file mode 100644 index 0000000..56900e8 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/IVendorTask.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Task {
+ public interface IVendorTask {
+ IEnumerable< IDropDownListItem > GetAllVendorNames( );
+ DisplayVendorNameDto FindVendorNameBy( string vendorId );
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/InvoiceTask.cs b/src/app/Cmpp298.Assignment3.Task/InvoiceTask.cs new file mode 100644 index 0000000..dee8d5d --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/InvoiceTask.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic;
+using System.Data;
+using System.Text;
+using Cmpp298.Assignment3.DataAccess;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Task {
+ public class InvoiceTask : IInvoiceTask {
+ public InvoiceTask( ) : this( new DatabaseGateway( ) ) {}
+
+ public InvoiceTask( IDatabaseGateway gateway ) {
+ _gateway = gateway;
+ }
+
+ public int SaveNewInvoice( SaveInvoiceDto saveInvoiceDto ) {
+ InsertQueryBuilder builder = new InsertQueryBuilder( Tables.Invoices.TableName );
+ builder.Add( Tables.Invoices.VendorID, saveInvoiceDto.VendorId );
+ builder.Add( Tables.Invoices.InvoiceNumber, saveInvoiceDto.InvoiceNumber );
+ builder.Add( Tables.Invoices.InvoiceDate, saveInvoiceDto.InvoiceDate );
+ builder.Add( Tables.Invoices.InvoiceTotal, saveInvoiceDto.InvoiceTotal );
+ builder.Add( Tables.Invoices.PaymentTotal, saveInvoiceDto.PaymentTotal );
+ builder.Add( Tables.Invoices.CreditTotal, saveInvoiceDto.CreditTotal );
+ builder.Add( Tables.Invoices.TermsID, saveInvoiceDto.TermsId );
+ builder.Add( Tables.Invoices.DueDate, saveInvoiceDto.DueDate );
+ builder.Add( Tables.Invoices.PaymentDate, saveInvoiceDto.PaymentDate );
+
+ return _gateway.InsertRowUsing( builder );
+ }
+
+ public IEnumerable< DisplayInvoiceDto > GetAllInvoices( string forVendorId ) {
+ SelectQueryBuilder builder = new SelectQueryBuilder( Tables.Invoices.TableName );
+ builder.AddColumn( Tables.Invoices.InvoiceID );
+ builder.AddColumn( Tables.Invoices.InvoiceNumber );
+ builder.AddColumn( Tables.Invoices.InvoiceDate );
+ builder.AddColumn( Tables.Invoices.InvoiceTotal );
+ builder.AddColumn( Tables.Invoices.PaymentTotal );
+ builder.AddColumn( Tables.Invoices.CreditTotal );
+ builder.AddColumn( Tables.Invoices.DueDate );
+ builder.AddColumn( Tables.Invoices.PaymentDate );
+ builder.AddColumn( Tables.Terms.Description );
+ builder.AddColumn( Tables.Vendors.Name );
+ builder.InnerJoin( Tables.Terms.TermsID, Tables.Invoices.TermsID );
+ builder.InnerJoin( Tables.Vendors.VendorID, Tables.Invoices.VendorID );
+ builder.Where( Tables.Invoices.VendorID, forVendorId );
+
+ IList< DisplayInvoiceDto > dtos = new List< DisplayInvoiceDto >( );
+ foreach ( DataRow row in _gateway.GetTableFrom( builder ).Rows ) {
+ dtos.Add( CreateFrom( row ) );
+ }
+ return dtos;
+ }
+
+ public DisplayInvoiceDto GetInvoiceBy( string invoiceId ) {
+ SelectQueryBuilder builder = new SelectQueryBuilder( Tables.Invoices.TableName );
+ builder.AddColumn( Tables.Invoices.InvoiceID );
+ builder.AddColumn( Tables.Invoices.InvoiceNumber );
+ builder.AddColumn( Tables.Invoices.InvoiceDate );
+ builder.AddColumn( Tables.Invoices.InvoiceTotal );
+ builder.AddColumn( Tables.Invoices.PaymentTotal );
+ builder.AddColumn( Tables.Invoices.CreditTotal );
+ builder.AddColumn( Tables.Invoices.DueDate );
+ builder.AddColumn( Tables.Invoices.PaymentDate );
+ builder.AddColumn( Tables.Terms.Description );
+ builder.AddColumn( Tables.Vendors.Name );
+ builder.InnerJoin( Tables.Terms.TermsID, Tables.Invoices.TermsID );
+ builder.InnerJoin( Tables.Vendors.VendorID, Tables.Invoices.VendorID );
+ builder.Where( Tables.Invoices.InvoiceID, invoiceId );
+ DataTable table = _gateway.GetTableFrom( builder );
+ return table.Rows.Count == 1 ? CreateFrom( table.Rows[ 0 ] ) : null;
+ }
+
+ public void DeleteInvoice( string invoiceId ) {
+ StringBuilder builder = new StringBuilder( );
+
+ builder.AppendFormat( "DELETE FROM [{0}] WHERE [{0}].[{1}] = {2}",
+ Tables.Invoices.TableName,
+ Tables.Invoices.InvoiceID.ColumnName,
+ invoiceId );
+
+ _gateway.Execute( builder.ToString( ) );
+ }
+
+ public void UpdateInvoice( UpdateInvoiceDto dto ) {
+ UpdateQueryBuilder builder = new UpdateQueryBuilder( Tables.Invoices.InvoiceID, dto.InvoiceId );
+ builder.Add( Tables.Invoices.CreditTotal, dto.CreditTotal );
+ builder.Add( Tables.Invoices.DueDate, dto.DueDate );
+ builder.Add( Tables.Invoices.InvoiceDate, dto.InvoiceDate );
+ builder.Add( Tables.Invoices.InvoiceNumber, dto.InvoiceNumber );
+ builder.Add( Tables.Invoices.InvoiceTotal, dto.InvoiceTotal );
+ builder.Add( Tables.Invoices.PaymentDate, dto.PaymentDate );
+ builder.Add( Tables.Invoices.PaymentTotal, dto.PaymentTotal );
+ builder.Add( Tables.Invoices.TermsID, dto.TermsId );
+
+ _gateway.UpdateRowUsing( builder );
+ }
+
+ private IDatabaseGateway _gateway;
+
+ private static DisplayInvoiceDto CreateFrom( DataRow row ) {
+ return
+ new DisplayInvoiceDto( row[ Tables.Invoices.InvoiceID.ColumnName ].ToString( ),
+ row[ Tables.Vendors.Name.ColumnName ].ToString( ),
+ row[ Tables.Invoices.InvoiceNumber.ColumnName ].ToString( ),
+ row[ Tables.Invoices.InvoiceDate.ColumnName ].ToString( ),
+ row[ Tables.Invoices.InvoiceTotal.ColumnName ].ToString( ),
+ row[ Tables.Invoices.PaymentTotal.ColumnName ].ToString( ),
+ row[ Tables.Invoices.CreditTotal.ColumnName ].ToString( ),
+ row[ Tables.Terms.Description.ColumnName ].ToString( ),
+ row[ Tables.Invoices.DueDate.ColumnName ].ToString( ),
+ row[ Tables.Invoices.PaymentDate.ColumnName ].ToString( ) );
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Task/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a2fe345 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("Cmpp298.Assignment3.Task")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Task")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("3987eab5-54b9-4396-81ae-cab8bdbbad27")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/app/Cmpp298.Assignment3.Task/TermTask.cs b/src/app/Cmpp298.Assignment3.Task/TermTask.cs new file mode 100644 index 0000000..826d5ec --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/TermTask.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic;
+using System.Data;
+using Cmpp298.Assignment3.DataAccess;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Task {
+ public class TermTask : ITermTask {
+ private IDatabaseGateway _gateway;
+
+ public TermTask( ) : this( new DatabaseGateway( ) ) {}
+
+ public TermTask( IDatabaseGateway gateway ) {
+ _gateway = gateway;
+ }
+
+ public IEnumerable< IDropDownListItem > GetAll( ) {
+ SelectQueryBuilder builder = new SelectQueryBuilder( Tables.Terms.TableName );
+ builder.AddColumn( Tables.Terms.TermsID );
+ builder.AddColumn( Tables.Terms.Description );
+ return CreateFrom( _gateway.GetTableFrom( builder ) );
+ }
+
+ private static IEnumerable< IDropDownListItem > CreateFrom( DataTable table ) {
+ foreach ( DataRow row in table.Rows ) {
+ yield return
+ new DropDownListItem( row[ Tables.Terms.Description.ColumnName ].ToString( ),
+ row[ Tables.Terms.TermsID.ColumnName ].ToString( ) );
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/app/Cmpp298.Assignment3.Task/VendorTask.cs b/src/app/Cmpp298.Assignment3.Task/VendorTask.cs new file mode 100644 index 0000000..2c69016 --- /dev/null +++ b/src/app/Cmpp298.Assignment3.Task/VendorTask.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic;
+using System.Data;
+using Cmpp298.Assignment3.DataAccess;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Task {
+ public class VendorTask : IVendorTask {
+ private IDatabaseGateway _gateway;
+
+ public VendorTask( ) : this( new DatabaseGateway( ) ) {}
+
+ public VendorTask( IDatabaseGateway gateway ) {
+ _gateway = gateway;
+ }
+
+ public IEnumerable< IDropDownListItem > GetAllVendorNames( ) {
+ SelectQueryBuilder builder = new SelectQueryBuilder( Tables.Vendors.TableName );
+ builder.AddColumn( Tables.Vendors.VendorID );
+ builder.AddColumn( Tables.Vendors.Name );
+ return CreateItemsFrom( _gateway.GetTableFrom( builder ) );
+ }
+
+ public DisplayVendorNameDto FindVendorNameBy( string vendorId ) {
+ SelectQueryBuilder builder = new SelectQueryBuilder( Tables.Vendors.TableName );
+ builder.AddColumn( Tables.Vendors.VendorID );
+ builder.AddColumn( Tables.Vendors.Name );
+ builder.Where( Tables.Vendors.VendorID, vendorId );
+ return CreateDtoFrom( _gateway.GetTableFrom( builder ) );
+ }
+
+ private static DisplayVendorNameDto CreateDtoFrom( DataTable resultSet ) {
+ return new DisplayVendorNameDto( resultSet.Rows[ 0 ][ Tables.Vendors.VendorID.ColumnName ].ToString( ),
+ resultSet.Rows[ 0 ][ Tables.Vendors.Name.ColumnName ].ToString( ) );
+ }
+
+ private static IEnumerable< IDropDownListItem > CreateItemsFrom( DataTable table ) {
+ foreach ( DataRow row in table.Rows ) {
+ yield return
+ new DropDownListItem( row[ Tables.Vendors.Name.ColumnName ].ToString( ),
+ row[ Tables.Vendors.VendorID.ColumnName ].ToString( ) );
+ }
+ }
+ }
+}
\ No newline at end of file |
