Home

Example Application: Solas Property Rental

 

Introduction

Solas Property Rental is a fictitious company that manages various types of real estate properties and rents them to customers. The types of properties include apartments, townhouses, and single families. In this application, we simulate various customer-oriented transactions, including registering the potential tenants, assigning the properties to them, and collecting payments.

This application was created to illustrate the various techniques of performing operations on XML elements: creating the elements, locating the values, and displaying them.

 

Practical LearningPractical Learning: Introducing the Application

  1. Start Microsoft Visual C++ and create a new Windows Forms Application named SolasPropertyRental1
  2. To add a new form to the application, in the Solution Explorer, right-click SolasPropertyRental1 -> Add -> New Item...
  3. In the Templates list, click Windows Form
  4. Set the Name to Tenants and click Add
  5. From the Toolbox, add a ListView to the form
  6. While the new list view is still selected, in the Properties window, click the ellipsis button of the Columns field and create the columns as follows:
     
    (Name) Text TextAlign Width
    colAccountNumber Account #   65
    colFullName Full Name   120
    colMaritalStatus Marital Status   85
    colPhoneNumber Phone # Center 85
  7. Design the form as follows: 
     
    Solas Property Rental: Customers
     
    Control Text Name Other Properties
    ListView   lvwTenants Anchor: Top, Bottom, Left, Right
    FullRowSelect: True
    GridLines: True
    View: Details
    Button New Tenant... btnNewTenant Anchor: Bottom, Right
    Button Close btnClose Anchor: Bottom, Right
  8. Right-click the Tenants form and click View Code
  9. Add the System.IO and the System.Xml namespaces to the list of used namespaces:
     
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  10. Define a new function as follows: 
    void ShowTenants()
    {
        String ^ Filename = L"C:\\Solas Property Rental\\tenants.xml";
        XmlDocument ^ DOMDocument = gcnew XmlDocument;
    
        if( File::Exists(Filename) )
        {
            lvwTenants->Items->Clear();
    
            DOMDocument->Load(Filename);
            XmlElement ^ ElementTenant = DOMDocument->DocumentElement;
            XmlNodeList ^ ListOfTenants = ElementTenant->ChildNodes;
    
            for each(XmlNode ^ Node in ListOfTenants)
            {
                ListViewItem ^ lviTenant = gcnew ListViewItem(Node->FirstChild->InnerText); // Account Number
    
                lviTenant->SubItems->Add(Node->FirstChild->NextSibling->InnerText); // Full Name
                lviTenant->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->InnerText); // Phone Number
                lviTenant->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->InnerText); // Marital Status
                lvwTenants->Items->Add(lviTenant);
            }
        }
    }
  11. Display the Tenants form again and double-click an unoccupied area of its body
  12. Implement the Load event as follows:
     
    Void Tenants_Load(System::Object^  sender, System::EventArgs^  e)
    {
        ShowTenants();
    }
  13. To add another form to the application, in the Solution Explorer, right-click SolasPropertyRental1 -> Add -> New Item...
  14. In the Templates list, make sure Windows Form is selected.
    Set the Name to TenantEditor and click Add
  15. Design the form as follows: 
     
    Solas Property Rental: Customer Editor
     
    Control Text Name Properties
    Label &Account #:    
    MaskedTextBox   txtAccountNumber Mask: 00-00-00
    Modifiers: public
    Label &Full Name:    
    TextBox   txtFullName Modifiers: public
    Label Marital Status:    
    ComboBox   txtMaritalStatus Modifiers: public
    Items:
    Single
    Widow
    Married
    Divorced
    Separated
    Label &Phone #:    
    MaskedTextBox   txtPhoneNumber Mask: (999) 000-0000
    Modifiers: public
    Button OK btnOK DialogResult: OK
    Button Cancel btnCancel DialogResult: Cancel
    Form     AcceptButton: btnOK
    CancelButton: btnCancel
    FormBorderStyle: FixedDialog
    MaximizeBox: False
    MinimizeBox: False
    ShowInTaskbar: False
  16. To add a new form to the application, in the Solution Explorer, right-click SolasPropertyRental1 -> Add -> New Item
  17. In the Templates list, make sure Windows Form is select.
    Set the Name to RentalProperties and press Enter
  18. From the Toolbox, add a ListView to the form
  19. While the new list view is still selected, in the Properties window, click the ellipsis button of the Columns field and create the columns as follows:
     
    (Name) Text TextAlign Width
    colPropertyCode Prop Code   65
    colPropertyType Property Type   85
    colBedrooms Bedrooms Right 65
    colBathrooms Bathrooms Right 65
    colMonthlyRent Monthly Rent Right 75
    colStatus Status   65
  20. Design the form as follows: 
     
    Solas Property Rental: Properties
     
    Control Text Name Other Properties
    ListView   lvwProperties View: Details
    GridLines: True
    FullRowSelect: True
    Anchor: Top, Bottom, Left, Right
    Button New Property... btnNewProperty Anchor: Bottom, Right
    Button Close btnClose Anchor: Bottom, Right
  21. Right-click the form form and click View Code
  22. Add the System.IO and the System.Xml namespaces to the list of used namespaces:
     
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  23. Define a new function as follows: 
    void ShowProperties()
    {
        XmlDocument ^ docProperties = gcnew XmlDocument;
        String ^ Filename = L"C:\\Solas Property Rental\\properties.xml";
    
        if( File::Exists(Filename) )
        {
            lvwProperties->Items->Clear();
    
            docProperties->Load(Filename);
            XmlElement ^ ElementProperty = docProperties->DocumentElement;
            XmlNodeList ^ ListOfProperties = ElementProperty->ChildNodes;
    
            for each(XmlNode ^ Node in ListOfProperties)
            {
                ListViewItem ^ lviProperty = gcnew ListViewItem(Node->FirstChild->InnerText); // Property Code
    
                lviProperty->SubItems->Add(Node->FirstChild->NextSibling->InnerText); // Property Type
                lviProperty->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->InnerText); // Bedrooms
                lviProperty->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->InnerText); // Bathrooms
                lviProperty->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Monthly Rent
                lviProperty->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Status
                lvwProperties->Items->Add(lviProperty);
            }
        }
    }
  24. Return to the form again and double-click an unoccupied area of its body
  25. Implement the Load event as follows:
     
    Void RentalProperties_Load(System::Object^  sender, System::EventArgs^  e)
    {
        ShowProperties();
    }
  26. To add another form to the application, in the Solution Explorer, right-click SolasPropertyRental1 -> Add -> New Item...
  27. In the Templates list, make sure Windows Form is select.
    Set the Name to PropertyEditor and click Add
  28. Design the form as follows: 
     
    Solas Property Rental: Property Editor
     
    Control Text Name Properties
    Label Property Code:    
    MaskedTextBox   txtPropertyCode Mask: 000-000
    Modifiers: Public
    Button OK btnOK DialogResult: OK
    Label Property Type:    
    ComboBox   cbxPropertyTypes Modifiers: Public
    Items: Unknown
    Apartment
    Townhouse
    Single Family
    Button Cancel btnCancel DialogResult: Cancel
    Label Bedrooms:    
    TextBox 0 txtBedrooms TextAlign: Right
    Modifiers: Public
    Label Bathrooms:    
    TextBox 0.00 txtBathrooms TextAlign: Right
    Modifiers: Public
    Label Monthly Rent:    
    TextBox 0.00 txtMonthlyRent TextAlign: Right
    Modifiers: Public
    Label Occupancy Status:    
    ComboBox Unknown cbxStatus Modifiers: Public
    Items:
    Unknown
    Available
    Occupied
    Needs Repair
    Form     AcceptButton: btnOK
    CancelButton: btnCancel
    FormBorderStyle: FixedDialog
    MaximizeBox: False
    MinimizeBox: False
    ShowInTaskbar: False
  29. To add a new form to the application, in the Solution Explorer, right-click SolasPropertyRental1 -> Add -> New Item...
  30. In the Templates list, make sure Windows Form is selected and set the Name to RentalAllocation
  31. Click Add
  32. Design the form as follows:
     
    Solas Property Rental: Rental Allocation
    Control Text Name Other Properties
    Label Rent Allocation   AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Allocation Code:    
    MaskedTextBox   TextAllocationCode Mask: 0000-9999
    Modifiers: Public
    Label Date Allocated:    
    DateTimePicker   dtpDateAllocated Format: Short
    Modifiers: Public
    Label Tenant   AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Property   AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
           
    Label Account #:    
    MaskedTextBox   txtTenantAcntNbr Mask: 00-00-00
    Modifiers: Public
    Label Property #:    
    MaskedTextBox   txtPropertyCode Mask: 000-000
    Modifiers: Public
    Label Tenant Name    
    TextBox   txtTenantName Modifiers: Public
    Label Property Type:    
    TextBox   txtPropertyType Modifiers: Public
    Label Marital Status:    
    TextBox   txtMaritalStatus Modifiers: Public
    Label Monthly Rent:    
    TextBox   txtMonthlyRent  
    Label Allocation Evaluation   AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Contract Length:    
    ComboBox   cbxContractLength Items:
    Monthly
    3 Months
    6 Months
    12 Months
    Modifiers: Public
    Label Rent Start Date:    
    DateTimePicker   dtpRentStartDate Modifiers: Public
    Button OK btnOK DialogResult: OK
    Button Close btnClose DialogResult: Cancel
    Form     AcceptButton: btnOK
    CancelButton: btnClose
    FormBorderStyle: FixedDialog
    MaximizeBox: False
    MinimizeBox: False
    ShowInTaskbar: False
  33. Right-click the form and click View Code
  34. Add the System.IO and the System.Xml namespaces to the list of used namespaces:
     
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  35. Return to the form and click the Account # text box
  36. In the Properties window, click the Events button and double-click Leave
  37. Implement the event as follows: 
    Void txtTenantAcntNbr_Leave(System::Object^  sender, System::EventArgs^  e)
    {
        String ^ Filename = L"C:\\Solas Property Rental\\tenants.xml";
        XmlDocument ^ DOMDocument = gcnew XmlDocument;
    
        if( File::Exists(Filename) )
        {
            DOMDocument->Load(Filename);
            XmlElement ^ ElementTenant = DOMDocument->DocumentElement;
            XmlNodeList ^ ListOfTenants = ElementTenant->ChildNodes;
            bool TenantFound = false;
    
            for (int i = 0; i < ListOfTenants->Count; i++)
            {
                XmlNode ^ Node = ListOfTenants[i];
    
                if (Node->FirstChild->InnerText == txtTenantAcntNber->Text)
                {
                    TenantFound = true;
                    txtTenantName->Text = Node->FirstChild->NextSibling->InnerText;
                    txtMaritalStatus->Text = Node->FirstChild->NextSibling->NextSibling->InnerText;
                }
            }
    
            if( TenantFound == false )
            {
                MessageBox::Show(L"There is no tenant with that account number");
                txtTenantAcntNber->Text = L"";
            }
        }
        else
            MessageBox::Show(L"There is no list of tenants to check.");
    }
  38. Return to the Rent Allocation form and click the Property Code text box
  39. In the Events section of the Properties window, double-click Leave
  40. Implement the event as follows: 
    Void txtPropertyCode_Leave(System::Object^  sender, System::EventArgs^  e)
    {
        String ^ Filename = L"C:\\Solas Property Rental\\properties.xml";
        XmlDocument ^ docProperties = gcnew XmlDocument;
    
        if( File::Exists(Filename) )
        {
            docProperties->Load(Filename);
            XmlElement ^ ElementProperty = docProperties->DocumentElement;
            XmlNodeList ^ ListOfProperties = ElementProperty->ChildNodes;
            bool PropertyFound = false;
    
            for (int i = 0; i < ListOfProperties->Count; i++)
            {
                XmlNode ^ Node = ListOfProperties[i];
    
                if( Node->FirstChild->InnerText == txtPropertyCode->Text )
                {
                    PropertyFound = true;
                    txtPropertyType->Text = Node->FirstChild->NextSibling->InnerText;
                    txtMonthlyRent->Text = Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->InnerText;
                }
            }
    
            if (PropertyFound == false)
            {
                MessageBox::Show(L"There is no Property with that code");
                txtPropertyType->Text = L"";
            }
        }
        else
            MessageBox::Show(L"There is no list of properties to check.");
    }
  41. To add a new form to the application, in the Solution Explorer, right- click SolasPropertyRental1 -> Add -> New Item...
  42. In the Templates list, make sure Windows Form is selected and set the Name to RentalAllocations
  43. Click Add
  44. From the Toolbox, add a ListView to the form
  45. While the new list view is still selected, in the Properties window, click the ellipsis button of the Columns field and create the columns as follows:
     
    (Name) Text TextAlign Width
    colAllocationCode Alloc Code   65
    colDateAllocated Date Allocated Center 85
    colTenantAccount Tenant # Center 65
    colTenantName Tenant Name   100
    colPropertyCode Prop Code Center 65
    colPropertyType Prop Type   75
    colContractLength Contract Length   88
    colRentStartDate Rent Start Date Center 88
    colMonthlyRent Monthly Rent Right 76
  46. Design the form as follows: 
     
    Solas Property Rental: Rental Allocations
     
    Control Text Name Other Properties
    ListView   lvwAllocations View: Details
    GridLines: True
    FullRowSelect: True
    Anchor: Top, Bottom, Left, Right
    Button New Rental Allocation... btnNewAllocation Anchor: Bottom, Right
    Button Close btnClose  
  47. Right-click the form and click View Code
  48. Add the System.IO and the System.Xml namespaces to the list of used namespaces:
     
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  49. Define a new function as follows: 
    void ShowRentalAllocations()
    {
        String ^ Filename = L"C:\\Solas Property Rental\\contracts.xml";
        XmlDocument ^ DOMAllocations = gcnew XmlDocument;
    
        if( File::Exists(Filename) )
        {
            lvwAllocations->Items->Clear();
    
            DOMAllocations->Load(Filename);
            XmlElement ^ ElementAllocation = DOMAllocations->DocumentElement;
            XmlNodeList ^ ListOfAllocations = ElementAllocation->ChildNodes;
    
            for each(XmlNode ^ Node in ListOfAllocations)
            {
                ListViewItem ^ lviAllocation = gcnew ListViewItem(Node->FirstChild->InnerText); // Allocation Code
    
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->InnerText); // Date Allocated
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->InnerText); // Tenant Account Number
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->InnerText); // Tenant Name
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Property Code
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Property Type
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Contract Length
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Rent Start Date
                lviAllocation->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Monthly Rent
                lvwAllocations->Items->Add(lviAllocation);
            }
        }
    }
  50. Return to the Rental Allocations form and double-click an unoccupied area of its body
  51. Implement the Load event as follows:
     
    Void RentalAllocations_Load(System::Object^  sender, System::EventArgs^  e)
    {
        ShowRentalAllocations();
    }
  52. To add a new form to the application, in the Solution Explorer, right-click SolasPropertyRental1 -> Add -> New Item...
  53. In the Templates list, make sure Windows Form is selected.
    Set the Name to RentPayment and click Add
  54. Design the form as follows:
     
    Solas Property Rental: Rent Payment
    Control Text Name Other Properties
    Label Rent Allocation   AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Date Received:    
    DateTimePicker   dtpDateReceived Format: Short
    Modifiers: Public
    Label Allocation Code:    
    MaskedTextBox   txtAllocationCode Mask: 0000-9999
    Modifiers: Public
    Label Receipt #:    
    TextBox   txtReceiptNumber Modifiers: Public
    Label Tenant Account #:    
    TextBox   txtTenantAcntNber Modifiers: Public
    Label Property Code:    
    TextBox   txtPropertyCode Modifiers: Public
    Label Tenant Name:    
    TextBox   txtTenantName Modifiers: Public
    Label Property Type:    
    TextBox   txtPropertyType Modifiers: Public
    Label Payment Summary   AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Month:    
    Label Year:    
    Label Payment For:    
    ComboBox   cbxMonths Modifiers: Public
    Items:
    January
    February
    March
    April
    May
    June
    July
    August
    September
    October
    November
    December
    TextBox   txtYear Modifiers: Public
    Label Amount Received:    
    TextBox 0.00 txtAmountReceived TextAlign: Right
    Modifiers: Public
    Button OK btnOK DialogResult: OK
    Button Close btnClose DialogResult: Cancel
    Form     AcceptButton: btnOK
    CancelButton: btnClose
    FormBorderStyle: FixedDialog
    MaximizeBox: False
    MinimizeBox: False
    ShowInTaskbar: False
  55. Right-click the form and click View Code
  56. Add the System.IO and the System.Xml namespaces to the list of used namespaces:
     
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  57. Return to the Rent Payment form and click the Allocation Code text box
  58. In the Properties window, click the Events button and double-click Leave
  59. Implement the event as follows: 
    Void txtAllocationCode_Leave(System::Object^  sender, System::EventArgs^  e)
    {
        String ^ Filename = L"C:\\Solas Property Rental\\contracts.xml";
        XmlDocument ^ DOMAllocations = gcnew XmlDocument;
    
        if( File::Exists(Filename) )
        {
            DOMAllocations->Load(Filename);
            XmlElement ^ ElementAllocation = DOMAllocations->DocumentElement;
            XmlNodeList ^ ListOfAllocations = ElementAllocation->ChildNodes;
            bool ContractFound = false;
    
            for (int i = 0; i < ListOfAllocations->Count; i++)
            {
                XmlNode ^ Node = ListOfAllocations[i];
    
                if (Node->FirstChild->InnerText == txtAllocationCode->Text)
                {
                    ContractFound = true;
                    txtTenantAcntNber->Text = Node->FirstChild->NextSibling->NextSibling->InnerText;
                    txtTenantName->Text = Node->FirstChild->NextSibling->NextSibling->NextSibling->InnerText;
                    txtPropertyCode->Text = Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText;
                    txtPropertyType->Text = Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText;
                    txtAmountReceived->Text = Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText;
                }
            }
    
            if (ContractFound == false)
            {
                MessageBox::Show(L"There is no rental contral with that number");
                txtTenantAcntNber->Text = L"";
            }
        }
        else
            MessageBox::Show(L"There is no list of rental contracts to check.");
    }
  60. To add a new form to the application, in the Solution Explorer, right- click SolasPropertyRental1 -> Add -> New Item...
  61. In the Templates list, make sure Windows Form is selected.
    Set the Name to RentPayments and click Add
  62. From the Toolbox, add a ListView to the form
  63. While the new list view is still selected, in the Properties window, click the ellipsis button of the Columns field and create the columns as follows:
     
    (Name) Text TextAlign Width
    colReceiptNumber Receipt # Right  
    colDateReceived Date Received Center 85
    colAllocationCode Alloc Code Center 65
    colTenantAccount Tenant # Center 65
    colTenantName Tenant Name   100
    colPropertyCode Prop Code Center 65
    colPropertyType Prop Type   75
    colPaymentFor Payment For   88
    colAmountReceived Amount Right 50
  64. Design the form as follows: 
     
    Solas Property Rental: Rent Payments
     
    Control Text Name Other Properties
    ListView   lvwRentPayments View: Details
    GridLines: True
    FullRowSelect: True
    Anchor: Top, Bottom, Left, Right
    Button New Rent Payment... btnNewPayment Anchor: Bottom,  Right
    Button Close btnClose Anchor: Bottom, Right
  65. Right-click the form and click View Code
  66. Add the System.IO and the System.Xml namespaces to the list of used namespaces:
     
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  67. Define a new function as follows: 
    void ShowRentPayments()
    {
        String ^ Filename = L"C:\\Solas Property Rental\\payments.xml";
        XmlDocument ^ DocumentPayments = gcnew XmlDocument();
    
        if( File::Exists(Filename) )
        {
            lvwRentPayments->Items->Clear();
    
            DocumentPayments->Load(Filename);
            XmlElement ^ ElementAllocation = DocumentPayments->DocumentElement;
            XmlNodeList ^ ListOfAllocations = ElementAllocation->ChildNodes;
    
            for each(XmlNode ^ Node in ListOfAllocations)
            {
                ListViewItem ^ lviPayment = gcnew ListViewItem(Node->FirstChild->InnerText); // Receipt Number
    
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->InnerText); // Date Received
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->InnerText); // Allocation Code
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->InnerText); // Tenant Account Number
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->InnerText);  // Tenant Name
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Property Code
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Property Type
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Payment For
                lviPayment->SubItems->Add(Node->FirstChild->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->NextSibling->InnerText); // Amount
                lvwRentPayments->Items->Add(lviPayment);
            }
        }
    }
  68. Return to the Rent Payments form and double-click an unoccupied area of its body
  69. Implement the Load event as follows:
     
    Void RentPayments_Load(System::Object^  sender, System::EventArgs^  e)
    {
        ShowRentPayments();
    }
  70. In the Solution Explorer, double-click Form1.h
  71. Design the form as follows:
     
    Solas Property Rental
    Control Text Name
    Button Tenants btnTenants
    Button Rental Properties btnRentalProperties
    Button Rental Allocations btnRentalAllocations
    Button C&lose btnClose
  72. Right-click the form and click View Code
  73. Include the header files of the forms that will be called:
     
    #pragma once
    
    #include "RentPayments.h"
    #include "RentalAllocations.h"
    #include "Tenants.h"
    #include "RentalProperties.h"
    
    namespace SolasPropertyRental1 {
  74. Return to the form
  75. Double-click the Rent Payment button and implement its event as follows:
     
    Void btnRentPayments_Click(System::Object^  sender, System::EventArgs^  e)
    {
        RentPayments ^ frmPayment = gcnew RentPayments;
        frmPayment->Show();
    } 
  76. Return to the form
  77. Double-click the Rental Allocations button and implement its event as follows:
     
    Void btnRentalAllocations_Click(System::Object^  sender, System::EventArgs^  e)
    {
        RentalAllocations ^ frmAllocations = gcnew RentalAllocations;
        frmAllocations->ShowDialog();
    }
  78. Return to the form
  79. Double-click the Tenants button and implement its event as follows:
     
    Void btnTenants_Click(System::Object^  sender, System::EventArgs^  e)
    {
        Tenants ^ frmTenants = gcnew Tenants;
        frmTenants->ShowDialog();
    }     
  80. Return to the form
  81. Double-click the Rental Properties button and implement its event as follows:
     
    Void btnRentalProperties_Click(System::Object^  sender, System::EventArgs^  e)
    {
        RentalProperties ^ frmProperties = gcnew RentalProperties;
        frmProperties->ShowDialog();
    }
  82. Return to the form
  83. Double-click the Close button and implement its event as follows:
     
    Void btnClose_Click(System::Object^  sender, System::EventArgs^  e)
    {
        Close();
    }
  84. Save all

Practical LearningPractical Learning: Adding a Tenant

  1. In the Solutions Explorer, double-click Tenants.h and double-click the New Tenant button
  2. In the top section of the file, include the TenantEditor.h header file:
     
    #pragma once
    
    #include "TenantEditor.h"
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  3. Scroll down and implement the Click event as follows:
     
    Void btnNewTenant_Click(System::Object^  sender, System::EventArgs^  e)
    {
        String ^ AccountNumber;
        String ^ FullName, ^ MaritalStatus, ^ PhoneNumber;
    
        // If this directory doesn't exist, create it
        Directory::CreateDirectory(L"C:\\Solas Property Rental");
        // This is the XML file that holds the list of tenants
        String ^ Filename = L"C:\\Solas Property Rental\\tenants.xml";
        // This is the dialog box from where a tenant is created
        TenantEditor ^ Editor = gcnew TenantEditor();
    
        // Display the Tenant Editor Dialog and find out if the 
        // user clicked OK after filling its controls
        if( Editor->ShowDialog() == System::Windows::Forms::DialogResult::OK )
        {
            // We will need a reference to the XML document
            XmlDocument ^ docTenant = gcnew XmlDocument();
    
            // Find out if the file exists already
            // If it doesn't, then create it
            if (!File::Exists(Filename))
            {
                docTenant->LoadXml(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                                   L"<Tenants></Tenants>");
                docTenant->Save(Filename);
            }
    
            // At this time, we have a Tenants.xml file. Open it
            docTenant->Load(Filename);
    
            // Get a reference to the root node
            XmlElement ^ RootNode = docTenant->DocumentElement;
    
            // Prepare the values of the XML element
            AccountNumber = Editor->txtAccountNumber->Text;
            FullName = Editor->txtFullName->Text;
            MaritalStatus = Editor->cbxMaritalStatus->Text;
            PhoneNumber = Editor->txtPhoneNumber->Text;
    
            // Create an element named Tenant
            XmlElement ^ Element = docTenant->CreateElement(L"Tenant");
            // Create the XML code of the child element of Tenant
            String ^ strNewCustomer = L"<AccountNumber>" + AccountNumber +
                                      L"</AccountNumber>"
                                      L"<FullName>" + FullName +
                                      L"</FullName>"
                                      L"<MaritalStatus>" + MaritalStatus +
                                      L"</MaritalStatus>"
                                      L"<PhoneNumber>" + PhoneNumber +
    				                  L"</PhoneNumber>";
            Element->InnerXml = strNewCustomer;
            // Append the new element as a child of Tenant
            docTenant->DocumentElement->AppendChild(Element);
    
            // Save the XML file
            docTenant->Save(L"C:\\Solas Property Rental\tenants.xml");
            // Since the content of the XML file has just been changed,
            // re-display the list of tenants
            ShowTenants();
        }
    }
  4. Return to the Tenants form and double-click the Close button
  5. Implement its Click event as follows:
     
    System::Void btnClose_Click(System::Object^  sender, System::EventArgs^  e)
    {
        Close();
    }
  6. Access the RentalProperties.h [Design] tab and double-click the New Property button
  7. In the top section of the file, include the PropertyEditor.h header file:
     
    #pragma once
    
    #include "PropertyEditor.h"
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  8. Scroll down and implement the Click event as follows:
     
    Void btnNewProperty_Click(System::Object^  sender, System::EventArgs^  e)
    {
        // If this directory doesn't exist, create it
        Directory::CreateDirectory(L"C:\\Solas Property Rental");
        // This is the XML file that holds the list of proeprties
        String ^ Filename = L"C:\\Solas Property Rental\\properties.xml";
        PropertyEditor ^ Editor = gcnew PropertyEditor;
    
        Random ^ RandomNumber = gcnew Random;
        Editor->txtPropertyCode->Text = 
    	RandomNumber->Next(100000, 999999).ToString();
    
        if( Editor->ShowDialog() == System::Windows::Forms::DialogResult::OK )
        {
            String ^ PropertyCode, ^ PropertyType, ^ Status;
            int Bedrooms;
            float Bathrooms;
            double MonthlyRent;
    
            // We will need a reference to the XML document
            XmlDocument ^ DocumentProperty = gcnew XmlDocument;
    
            // Find out if the file exists already
            // If it doesn't, then create it
            if (!File::Exists(Filename))
            {
       DocumentProperty->LoadXml(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                                          L"<Properties></Properties>");
                DocumentProperty->Save(Filename);
            }
    
            // Open the XML file
            DocumentProperty->Load(Filename);
    
            // Get a reference to the root node
            XmlElement ^ RootNode = DocumentProperty->DocumentElement;
    
            PropertyCode = Editor->txtPropertyCode->Text;
            PropertyType = Editor->cbxPropertyTypes->Text;
            Bedrooms = int::Parse(Editor->txtBedrooms->Text);
            Bathrooms = float::Parse(Editor->txtBathrooms->Text);
            MonthlyRent = double::Parse(Editor->txtMonthlyRent->Text);
            Status = Editor->cbxStatus->Text;
    
            XmlElement ^ Element = DocumentProperty->CreateElement(L"Property");
            String ^ strNewCustomer = L"<PropertyCode>" + PropertyCode +
                                      L"</PropertyCode>" + L"<PropertyType>" +
                                      PropertyType + L"</PropertyType>" +
                                    L"<Bedrooms>" + Bedrooms + L"</Bedrooms>" +
                                    L"<Bathrooms>" + Bathrooms.ToString(L"F") +
    				  L"</Bathrooms>" + L"<MonthlyRent>" +
    			  	  MonthlyRent.ToString(L"F") + 
    				  L"</MonthlyRent>" +
                                      L"<Status>" + Status + L"</Status>";
    
            Element->InnerXml = strNewCustomer;
            DocumentProperty->DocumentElement->AppendChild(Element);
    
          DocumentProperty->Save(L"C:\\Solas Property Rental\\properties.xml");
            ShowProperties();
        }
    }
  9. Return to the Rental Properties form and double-click the Close button
  10. Implement its Click event as follows:
     
    Void btnClose_Click(System::Object^  sender, System::EventArgs^  e)
    {
        Close();
    }
  11. Execute the application
  12. Use the Tenants button and its New Tenant button to create the following Tenants:
     
    Account # Full Name Marital Status Phone #
    20-48-46 Lenny Crandon Single (240) 975-9093
    57-97-15 Joan Ramey Married (301) 304-5845
    19-38-84 Peter Sellars Married (240) 801-7974
    24-68-84 Alberta Sanson Separated (202) 917-0095
    47-80-95 Urlus Flack Single (703) 203-7947
  13. Use the Rental Properties button and its New Property button to create the following properties:
     
    Prop Code Property Types Bedrooms Bathrooms Monthly Rent Status
    527-992 Apartment 1 1 925 Available
    726-454 Apartment 2 1 1150.5 Available
    476-473 Single Family 5 3.5 2250.85 Occupied
    625-936 Townhouse 3 2.5 1750 Available
    179-738 Townhouse 4 2.5 1920.5 Available
    727-768 Single Family 4 2.5 2140.5 Needs Repair
    371-801 Apartment 3 2 1250.25 Available
    241-536 Townhouse 3 1.5 1650.5 Occupied
     
  14. Close the forms and return to your programming environment

 

Practical LearningPractical Learning: Assigning a Property

  1. Access the Rental Allocations form and double-click the New Rental Allocation button
  2. In the top section of the file, include the RentalAllocation.h header file:
     
    #pragma once
    
    #include "RentalAllocation.h"
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  3. Scroll down and implement the event as follows:
     
    Void btnNewAllocation_Click(System::Object^  sender, System::EventArgs^  e)
    {
        String ^ AllocationCode, ^TenantAccountNumber,
               ^ TenantName, ^ MaritalStatus,
               ^ PropertyCode, ^ PropertyType, ^ ContractLength;
        DateTime DateAllocated, RentStartDate;
        double MonthlyRent;
    
        RentalAllocation ^ Editor = gcnew RentalAllocation;
        Directory::CreateDirectory(L"C:\\Solas Property Rental");
        String ^ Filename = L"C:\\Solas Property Rental\\contracts.xml";
    
        if( Editor->ShowDialog() == System::Windows::Forms::DialogResult::OK )
        {
            XmlDocument ^ DOMAllocation = gcnew XmlDocument;
    
            if( !File::Exists(Filename) )
            {
        DOMAllocation->LoadXml(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                               L"<Allocations></Allocations>");
                DOMAllocation->Save(Filename);
            }
    
            DOMAllocation->Load(Filename);
    
            XmlElement ^ RootNode = DOMAllocation->DocumentElement;
    
            AllocationCode = Editor->txtAllocationCode->Text;
            DateAllocated = Editor->dtpDateAllocated->Value;
            TenantAccountNumber = Editor->txtTenantAcntNber->Text;
            TenantName = Editor->txtTenantName->Text;
            MaritalStatus = Editor->txtMaritalStatus->Text;
            PropertyCode = Editor->txtPropertyCode->Text;
            PropertyType = Editor->txtPropertyType->Text;
            MonthlyRent = double::Parse(Editor->txtMonthlyRent->Text);
            ContractLength = Editor->cbxContractLengths->Text;
            RentStartDate = Editor->dtpRentStartDate->Value;
    
            XmlElement ^ RootElement = DOMAllocation->DocumentElement;
            XmlElement ^ ElementAllocation =
    		DOMAllocation->CreateElement(L"RentalAllocation");
            RootElement->AppendChild(ElementAllocation);
    
            RootElement = DOMAllocation->DocumentElement;
    
            ElementAllocation = DOMAllocation->CreateElement(L"AllocationCode");
            XmlText ^ TextAllocation = DOMAllocation->CreateTextNode(AllocationCode);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"DateAllocated");
            TextAllocation =
    		DOMAllocation->CreateTextNode(DateAllocated.ToString(L"d"));
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"TenantAccountNumber");
            TextAllocation = DOMAllocation->CreateTextNode(TenantAccountNumber);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"TenantName");
            TextAllocation = DOMAllocation->CreateTextNode(TenantName);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"MaritalStatus");
            TextAllocation = DOMAllocation->CreateTextNode(MaritalStatus);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"PropertyCode");
            TextAllocation = DOMAllocation->CreateTextNode(PropertyCode);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"PropertyType");
            TextAllocation = DOMAllocation->CreateTextNode(PropertyType);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"ContractLength");
            TextAllocation = DOMAllocation->CreateTextNode(ContractLength);
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"RentStartDate");
            TextAllocation =
    		DOMAllocation->CreateTextNode(RentStartDate.ToString(L"d"));
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            ElementAllocation = DOMAllocation->CreateElement(L"MonthlyRent");
            TextAllocation =
    		DOMAllocation->CreateTextNode(MonthlyRent.ToString(L"F"));
            RootElement->LastChild->AppendChild(ElementAllocation);
            RootElement->LastChild->LastChild->AppendChild(TextAllocation);
    
            DOMAllocation->Save(Filename);
            ShowRentalAllocations();
        }
    }
  4. Return to the Rental Allocation form and double-click the Close button
  5. Implement the event as follows:
     
    Void btnClose_Click(System::Object^  sender, System::EventArgs^  e)
    {
        Close();
    }
  6. Access the Rent Payments form and double-click the New Rent Payment button
  7. In the top section of the file, include the RentPayment.h header file:
     
    #pragma once
    
    #include "RentPayment.h"
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Xml;
  8. Scroll down and implement the event as follows:
     
    Void btnNewPayment_Click(System::Object^  sender, System::EventArgs^  e)
    {
        int      ReceiptNumber;
        String ^ AllocationCode;
        String ^ TenantAccountNumber;
        String ^ TenantName;
        String ^ PaymentFor;
        String ^ PropertyCode;
        String ^ PropertyType;
        DateTime DateReceived;
        double   AmountReceived;
    
        RentPayment ^ Editor = gcnew RentPayment;
        XmlDocument ^ DOMPayments = gcnew XmlDocument;
        Directory::CreateDirectory(L"C:\\Solas Property Rental");
        String ^ Filename = L"C:\\Solas Property Rental\\payments.xml";
    
        // If some payments were previously made
        if( File::Exists(Filename) )
        {
            // Open the payments.xml file
            DOMPayments->Load(Filename);
    
            // Locate the root element
            XmlElement ^ ElementAllocation = DOMPayments->DocumentElement;
            // Get a list of the child nodes
            XmlNodeList ^ ListOfAllocations = ElementAllocation->ChildNodes;
    
            // Get the last receipt number
            ReceiptNumber =
                int::Parse(ListOfAllocations[ListOfAllocations->Count
                                        - 1]->FirstChild->InnerText) + 1;
    
            Editor->txtReceiptNumber->Text = ReceiptNumber.ToString();
        }
        else
        {
            // If no payment has ever been made,
            // create a new XML file for the payments
            DOMPayments->LoadXml(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                               L"<RentPayments></RentPayments>");
    
            // We will start the receipt numbers at 101
            ReceiptNumber = 101;
    
            Editor->txtReceiptNumber->Text = ReceiptNumber.ToString();
        }
    
        // Display the Rent Payment dialog box
        if( Editor->ShowDialog() == System::Windows::Forms::DialogResult::OK )
        {
            // If the user had clicked OK,
            // Prepare the elements of the XML file
            ReceiptNumber = int::Parse(Editor->txtReceiptNumber->Text);
            DateReceived = Editor->dtpDateReceived->Value;
            AllocationCode = Editor->txtAllocationCode->Text;
            TenantAccountNumber = Editor->txtTenantAcntNber->Text;
            TenantName = Editor->txtTenantName->Text;
            PropertyCode = Editor->txtPropertyCode->Text;
            PropertyType = Editor->txtPropertyType->Text;
            PaymentFor = Editor->cbxMonths->Text + L" " + Editor->txtYear->Text;
            AmountReceived = double::Parse(Editor->txtAmountReceived->Text);
    
            // Get a reference to the root element
            XmlElement ^ RootElement = DOMPayments->DocumentElement;
            // Create an element named Payment
            XmlElement ^ ElementPayment = DOMPayments->CreateElement(L"Payment");
            // Add the new element as the last node of the root element
            RootElement->AppendChild(ElementPayment);
    
            // Get a reference to the root element
            RootElement = DOMPayments->DocumentElement;
    
            // Create an element
            ElementPayment = DOMPayments->CreateElement(L"ReceiptNumber");
            // Create the value of the new element
            XmlText ^ TextPayment = DOMPayments->CreateTextNode(ReceiptNumber.ToString());
            // Add the new element as a child of the Payment element
            RootElement->LastChild->AppendChild(ElementPayment);
            // Specify the value of the new element
            RootElement->LastChild->LastChild->AppendChild(TextPayment);
    
    	// Follow the same logic for the other elements
    
            ElementPayment = DOMPayments->CreateElement(L"DateReceived");
            TextPayment = DOMPayments->CreateTextNode(DateReceived.ToString(L"d"));
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(TextPayment);
    
            ElementPayment = DOMPayments->CreateElement(L"AllocationCode");
            XmlText ^ txtAllocation = DOMPayments->CreateTextNode(AllocationCode);
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            ElementPayment = DOMPayments->CreateElement(L"TenantAccountNumber");
            txtAllocation = DOMPayments->CreateTextNode(TenantAccountNumber);
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            ElementPayment = DOMPayments->CreateElement(L"TenantName");
            txtAllocation = DOMPayments->CreateTextNode(TenantName);
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            ElementPayment = DOMPayments->CreateElement(L"PropertyCode");
            txtAllocation = DOMPayments->CreateTextNode(PropertyCode);
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            ElementPayment = DOMPayments->CreateElement(L"PropertyType");
            txtAllocation = DOMPayments->CreateTextNode(PropertyType);
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            ElementPayment = DOMPayments->CreateElement(L"PaymentFor");
            txtAllocation = DOMPayments->CreateTextNode(PaymentFor);
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            ElementPayment = DOMPayments->CreateElement(L"AmountReceived");
            txtAllocation = DOMPayments->CreateTextNode(AmountReceived.ToString(L"F"));
            RootElement->LastChild->AppendChild(ElementPayment);
            RootElement->LastChild->LastChild->AppendChild(txtAllocation);
    
            DOMPayments->Save(Filename);
            ShowRentPayments();
        }
    }
  9. Return to the Rental Allocation form and double-click the Close button
  10. Implement the event as follows:
     
    Void btnClose_Click(System::Object^  sender, System::EventArgs^  e)
    {
        Close();
    }
  11. Execute the application
  12. Create the following Rental Allocations:
     
      Allocation 1 Allocation 2 Allocation 3 Allocation 4
    Allocation Code 4205-8274 5920-9417 2792-4075 7957-7294
    Date Allocated 8/12/2002 2/18/2004 3/24/2004 10/26/2007
    Account # 24-68-84 57-97-15 19-38-84 20-48-46
    Prop Code 726-454 625-936 371-801 727-768
    Contract Length 12 Months 3 Months 12 Months 6 Months
    Start Date 10/1/2002 4/1/2004 6/1/2004 2/1/2008
     
  13. Create the following Rent Payments:
     
      Date Received Allocation Code Payment For Amount
    Month Year
    Payment 1 10/25/2002 4205-8274 October 2002 1150.50
    Payment 2 11/28/2002 4205-8274 November 2002 1150.50
    Payment 3 4/28/2004 5920-9417 April 2004 1750.00
    Payment 4 7/5/2004 2792-4075 June 2004 1250.25
    Payment 5 6/3/2004 5920-9417 May 2004 1750.00
    Payment 6 7/30/2004 2792-4075 July 2004 1250.25
    Payment 7 7/5/2004 5920-9417 June 2004 1750.00
    Payment 8 12/30/2002 4205-8274 December 2002 1150.50
     
    Solas Property Rental
  14. Close the DOS window
 

Exercises

 

Solas Property Rental

  1. Open the Solas Property Rental database from this lesson
  2. Configure the Rental Allocations form so that, after the user has entered a property code and press Tab (or when the control looses focus), the database will first check the status of the property. If the property is occupied, a message box will be displayed to the user and that particular property cannot be selected (the property code text box should be set empty)
  3. Configure the Rent Payments so that the user can decide to see only the payments for one particular tenant (you can create a contextual menu so that if the user right-clicks a certain row and click View Tenant's Payments, the list view would display only that tenant's payments. Of course, make sure the user has a way to display all payments again)
 

Home Copyright © 2008-2012 FunctionX