summaryrefslogtreecommitdiff
path: root/src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.cs')
-rw-r--r--src/app/Cmpp298.Assignment3.Desktop.UI/NewInvoiceView.cs66
1 files changed, 66 insertions, 0 deletions
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