Home

Collection-Based Application:
Lambda Square Apartments

     

Introduction

Managing an apartment building is a typical way of running a database with various forms of data entry and performing transactions.

In this exercise, we will create a file-based application that is used to manage rental needs of an apartment building. Our application will use four simple lists: a list of the apartments to rent, a list of employees who manage the transactions, a list that holds the tenants information and apartment allocations (or registration), and a list of rent payments.

Practical LearningPractical Learning: Introducing Collection Iteration

  1. Start Microsoft Visual Studio and create a new Windows Application named LambdaSquareApartments1
  2. To create a new class, in the Solution Explorer, right-click LambdaSquareApartments1 -> Add -> Class
  3. Set the Name to Employee and click Add
  4. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace LambdaSquareApartments1
    {
        [Serializable]
        public class Employee
        {
            public string EmployeeNumber { get; set; }
            public string FirstName      { get; set; }
            public string LastName       { get; set; }
            public string Title          { get; set; }
    
            public Employee()
            {
            }
    
            public Employee(string emplNbr,
            		string fname,
            		string lname,
            		string title)
            {
                EmployeeNumber = emplNbr;
                FirstName      = fname;
                LastName       = lname;
                Title          = title;
            }
        }
    }
  5. To create a new dialog box, on the main menu, click PROJECT -> Add Windows Form...
  6. Set the name to NewEmployee and click Add
  7. Design the form as follows:
     
    Lambda Square Apartments - New Employee
    Control (Name) Text Other Properties
    Label Label   Employee #:  
    TextBox Text Box txtEmployeeNumber   Modifiers: Public
    Label Label   First Name:  
    TextBox Text Box txtFirstName   Modifiers: Public
    Label Label   Last Name:  
    TextBox Text Box txtLastName   Modifiers: Public
    Label Label   Title:  
    TextBox Text Box txtTitle   Modifiers: Public
    Button Button &OK btnOK DialogResult: OK
    Button Button &Cancel btnCancel DialogResult: Cancel
    Form Property Value
    FormBorderStyle FixedDialog
    StartPosition CenterScreen
    AcceptButton btnOK
    CancelButton btnCancel
    MaximizeBox False
    MinimizeBox False
    ShowInTaskbar False
  8. To create a new form, on the main menu, click PROJECT -> Add Windows Form...
  9. Set the name to Employees and click Add
  10. Design the form as follows:
     
    Lambda Square Apartments - Employees
     
    Control (Name) Text Other Properties
    ListView List View   lvwEmployees View: Details
    FullRowSelect: True
    GridLines: True
    Columns
    (Name) Text TextAlign Width
    colEmployeeNumber Empl #   45
    colIFirstName First Name   65
    colLastName Last Name   65
    colTitle Title   120
    Button Button btnNewStoreItem New Employee...  
    Button Button btnClose Close  
  11. To create a new class, in the Solution Explorer, right-click LambdaSquareApartments1 -> Add -> Class
  12. Set the Name to Apartment and click Add
  13. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace LambdaSquareApartments1
    {
        [Serializable]
        public class Apartment
        {
            public string UnitCode	      { get; set; }
            public string ApartmentNumber { get; set; }
            public int    Bedrooms	      { get; set; }
            public float  Bathrooms	      { get; set; }
            public double MonthlyRate     { get; set; }
            public double SecurityDeposit { get; set; }
            public string OccupancyStatus { get; set; }
    
            public override bool Equals(object obj)
            {
                Apartment apart = (Apartment)obj;
    
                /* We will consider that two apartments are equal if they have
                   * The same number of bedrooms (such as 2 apartments  that each has 2 bedrooms),
                   * The same setting for the bathroom(s) (such as 2 apartments that have 1 bathroom each),
                   * Therefore the same monthly rate (such 2 apartments that cost $1250/month each), and
                   * Consequently the same security deposit (such as $750 each) */
                return (Bedrooms        == apart.Bedrooms)    &&
                       (Bathrooms       == apart.Bathrooms)   &&
                       (MonthlyRate     == apart.MonthlyRate) &&
                       (SecurityDeposit == apart.SecurityDeposit);
            }
    
            public override int GetHashCode()
            {
                return base.GetHashCode();
            }
        }
    }
  14. To create a new dialog box, in the Solution Explorer, right-click LambdaSquareApartment1 -> Add -> Windows Form
  15. Set the Name to NewApartment and press Enter
  16. Design the form as follows:
     
    Lambda Square Apartments - New Apartment
    Control (Name) Text Other Properties
    Label Label   Unit Code:  
    TextBox Text Box txtUnitCode   Modifiers: Public
    Label Label   Apartment #:  
    TextBox Text Box txtApartmentNumber   Modifiers: Public
    Label Label   Bedrooms:  
    TextBox Text Box txtBedrooms   Modifiers: Public
    TextAlign: Right
    Label Label   Bathrooms:  
    TextBox Text Box txtBathrooms   Modifiers: Public
    TextAlign: Right
    Label Label   Monthly Rate:  
    TextBox Text Box txtMonthlyRate   Modifiers: Public
    TextAlign: Right
    Label Label   Security Deposit:  
    TextBox Text Box txtSecurityDeposit   Modifiers: Public
    TextAlign: Right
    Label Label   Occupancy Status:  
    ComboBox Combo Box cbxOccupanciesStatus   Modifiers: Public
    TextAlign: Right
    Items:
    Other
    Available
    Occupied
    Not Ready
    Needs Repair
    Button Button &OK btnOK DialogResult: OK
    Button Button &Cancel btnCancel DialogResult: Cancel
    Form Property Value
    FormBorderStyle FixedDialog
    StartPosition CenterScreen
    AcceptButton btnOK
    CancelButton btnCancel
    MaximizeBox False
    MinimizeBox False
    ShowInTaskbar False
  17. To create a new form, on the main menu, click PROJECT -> Add Windows Form...
  18. Set the name to Apartments and click Add
  19. Design the form as follows:
     
    Lambda Square Apartments - Apartments
     
    Control (Name) Text Other Properties
    ListView List View lvwApartments   View: Details
    FullRowSelect: True
    GridLines: True
    Columns
    (Name) Text TextAlign Width
    colUnitCode Code   45
    colApartmentNumber Apart #   50
    colBedrooms Beds Right 40
    colBathrooms Baths Right 45
    colMonthlyRate Rent/Mth Right  
    colSecurityDeposit Deposit Right  
    colOccupancyStatus Status    
    Button Button btnNewApartment New Apartment...  
    Button Button btnClose Close  
  20. To create a new class, in the Solution Explorer, right-click LambdaSquareApartments1 -> Add -> Class
  21. Set the Name to TenantRegistration and click Add
  22. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace LambdaSquareApartments1
    {
        [Serializable]
        public class TenantRegistration
        {
            public int      RegistrationNumber { get; set; }
            public string   RegistrationDate   { get; set; }
            public string   EmployeeNumber     { get; set; }
            public string   TenantCode         { get; set; }
            public string   FirstName          { get; set; }
            public string   LastName           { get; set; }
            public string   MaritalStatus      { get; set; }
            public ushort   NumberOfChildren   { get; set; }
            public string   PhoneNumber        { get; set; }
            public string   EmailAddress       { get; set; }
            public string   UnitCode           { get; set; }
            public DateTime RentStartDate      { get; set; }
        }
    }
  23. To create a new dialog box, in the Solution Explorer, right-click LambdaSquareApartment1 -> Add -> Windows Form
  24. Set the Name to NewTenantRegistration and press Enter
  25. Design the form as follows:
     
    Lambda Square Apartments - New Tenant Registration
    Control (Name) Text Other Properties
    Label Label   Registration Date:  
    DateTimePicker Date Time Picker dtpRegistrationDate   Modifiers: Public
    Label Label   Processed By AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Label   Employee #:  
    TextBox Text Box txtEmployeeNumber   Modifiers: Public
    TextBox Text Box txtEmployeeName    
    Label Label   Tenant Information AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Label   Tenant Code:  
    TextBox Text Box txtTenantCode   Modifiers: Public
    Label Label   First Name:  
    TextBox Text Box txtFirstName   Modifiers: Public
    Label Label   Last Name:  
    TextBox Text Box txtLastName   Modifiers: Public
    Label Label   Marital Status:  
    ComboBox Combo Box cbxMaritalsStatus   Modifiers: Public
    Items:
    Single
    Widow
    Married
    Divorced
    Separated
    Unspecified
    Label Label   Phone Number:  
    MaskedTextBox Masked Text Box txtPhone Number   Modifiers: Public
    Mask: (000) 000-0000
    Label Label   Number of Children  
    TextBox Text Box txtNumberOfChildren   Modifiers: Public
    TextAlign: Right
    Label Label   Email Address:  
    TextBox Text Box txtEmailAddress   Modifiers: Public
    Label Label   Apartment Allocation AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Label   Unit Code:  
    TextBox Text Box txtUnitCode   Modifiers: Public
    TextBox Text Box txtApartmentDetails    
    Label Label   Rent Start Date:  
    DateTimePicker Date Time Picker dtpRentStartDate   Modifiers: Public
    Label Label   Registration Number:  
    TextBox Text Box txtRegistrationNumber   Modifiers: Public
    Button Button btnSubmit Submit  
    Button Button btnClose Close  
  26. To create a new form, on the main menu, click PROJECT -> Add Windows Form...
  27. Set the name to TenantsRegistrations and click Add
  28. Design the form as follows:
     

    Lambda Square Apartments - Tenants Registrations

     
    Control (Name) Text Other Properties
    ListView List View lvwRegistrations   View: Details
    FullRowSelect: True
    GridLines: True
    Columns
    (Name) Text TextAlign Width
    colRegistrationNumber Regist #   55
    colRegistrationDate Regist Date Center 70
    colEmployee Processed By   140
    colTenantCode Tenant Code Center 75
    colFirstName First Name   65
    colLastName Last Name   65
    colMaritalStatus Marital Status   80
    colNumberOfChildren # of Children Right 75
    colPhoneNumber Phone #   85
    colEmailAddress Email Address   150
    colApartment Apartment   368
    colRentStartDate Rent Start Date Center 90
    Button Button btnNewApartment New Apartment...  
    Button Button btnClose Close  
  29. To create a new class, in the Solution Explorer, right-click LambdaSquareApartments1 -> Add -> Class
  30. Set the Name to Payment and click Add
  31. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace LambdaSquareApartments1
    {
        [Serializable]
        public class Payment
        {
            public int      ReceiptNumber      { get; set; }
            public DateTime PaymentDate        { get; set; }
            public string   EmployeeNumber     { get; set; }
            public int      RegistrationNumber { get; set; }
            public double   PaymentAmount      { get; set; }
            public string   Notes              { get; set; }
        }
    }
  32. To create a new dialog box, in the Solution Explorer, right-click LambdaSquareApartment1 -> Add -> Windows Form
  33. Set the Name to NewPayment and press Enter
  34. Design the form as follows:
     
    Lambda Square Apartments - New Payment
    Control (Name) Text Other Properties
    Label Label   Payment Date:  
    DateTimePicker Date Time Picker dtpPaymentDate   Modifiers: Public
    Label Label   Processed By AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Label   Employee #:  
    TextBox Text Box txtEmployeeNumber   Modifiers: Public
    TextBox Text Box txtEmployeeName    
    Label Label   Registration Information AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Label   Registration #:  
    TextBox Text Box txtRegistrationNumber   Modifiers: Public
    Label Label   Date Registered:  
    TextBox Text Box txtDateRegistered    
    Label Label   Start Date:  
    TextBox Text Box txtStartDate    
    Label Label   Tenant:  
    TextBox Text Box txtTenantInformation    
    Label Label   Apartment Info:  
    MaskedTextBox Masked Text Box txtApartmentInformation   Multiline: True
    ScrollBars: Vertical
    Label Label   Payment Details AutoSize: False
    BackColor: Gray
    BorderStyle: FixedSingle
    ForeColor: White
    TextAlign: MiddleLeft
    Label Label   Payment Amount:  
    TextBox Text Box txtPaymentAmount   Modifiers: Public
    Label Label   Notes:  
    TextBox Text Box txtNotes   Modifiers: Public
    Multiline: True
    ScrollBars: Vertical
    Label Label   Receipt Number:  
    TextBox Text Box txtReceiptNumber   Modifiers: Public
    Button Button btnSubmit Submit  
    Button Button btnClose Close  
  35. To create a new form, on the main menu, click PROJECT -> Add Windows Form...
  36. Set the name to Payments and click Add
  37. Design the form as follows:
     

    Lambda Square Apartments - Payments

     
    Control (Name) Text Other Properties
    ListView List View lvwRegistrations   View: Details
    FullRowSelect: True
    GridLines: True
    Columns
    (Name) Text TextAlign Width
    colReceiptNumber Receipt #    
    colPaymentDate Pmt Date Center 70
    colEmployee Processed By   120
    colRegistrationInformation Registration Information   150
    colPaymentAmount Pmt Amt Right 55
    colNotes Notes   200
    Button Button btnPayment New Payment...  
    Button Button btnClose Close  
  38. In the Solution Explorer, right-click Form1.cs and click Rename
  39. Change the name to LambdaSquareApartments and press Enter twice
  40. Design the form as follows:
     
    Lambda Square Apartments
     
    Control Name Text
    Button Button btnRegistrations Registrations ...
    Button Button btnPayments Payments ...
    Button Button btnApartments Apartments ...
    Button Button btnEmployees Employees ...
    Button Button Close btnClose
  41. Double-click an unoccupied area of the form
  42. Return to the form and double-click the Registrations button
  43. Return to the form and double-click the Payments button
  44. Return to the form and double-click the Apartments button
  45. Return to the form and double-click the Employees button
  46. Return to the form and double-click the Close button
  47. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    
    namespace LambdaSquareApartments1
    {
        public partial class LambdaSquareApartments : Form
        {
            public LambdaSquareApartments()
            {
                InitializeComponent();
            }
    
            private void LambdaSquareApartments_Load(object sender, EventArgs e)
            {
                Directory.CreateDirectory(@"C:\Microsoft Visual C# Application Design\Lambda Square Apartments");
            }
    
            private void btnRegistrations_Click(object sender, EventArgs e)
            {
                TenantsRegistrations trs = new TenantsRegistrations();
                trs.Show();
            }
    
            private void btnPayments_Click(object sender, EventArgs e)
            {
                Payments pmts = new Payments();
                pmts.Show();
            }
    
            private void btnApartments_Click(object sender, EventArgs e)
            {
                Apartments units = new Apartments();
                units.Show();
            }
    
            private void btnEmployees_Click(object sender, EventArgs e)
            {
                Employees empls = new Employees();
                empls.Show();
            }
    
            private void btnClose_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
  48. On the Standard toolbar, click the Save All button Save All
 
 
 

A Collection Class

A collection-based application starts from a collection class. To illustrate the ability to iterate through a list, we will create our own collection class. The class will have methods to add an object to the list and to remove an object from the list. Our collection class will also have an indexed property that can be used to locate an object and change its values.

Practical LearningPractical Learning: Enumerating a Collection

  1. To create a new class, in the Solution Explorer, right-click LambdaSquareApartments1 -> Add -> Class...
  2. Set the Name to Collector and click Add
  3. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace LambdaSquareApartments1
    {
        [Serializable]
        public class Collector<T>
        {
            T[] items;
            int size;
    
            public Collector()
            {
                size = 0;
                items = new T[1];
            }
    
            public int Count
            {
                get
                {
                    return size;
                }
            }
    
            public T this[int index]
            {
                get
                {
                    return items[index];
                }
                set
                {
                    items[index] = value;
                    size++;
                }
            }
    
            public static void IncreaseArray(ref T[] values, int increment)
            {
                T[] array = new T[values.Length + increment];
    
                values.CopyTo(array, 0);
    
                values = array;
            }
    
            public void Add(T str)
            {
                items[size] = str;
                size++;
                IncreaseArray(ref items, 1);
            }
    
            public int IndexOf(T item)
            {
                int index = -1;
    
                if (size > 0)
                {
                    for (int i = 0; i < Count; i++)
                    {
                        if (items[i].Equals(item))
                        {
                            index = i;
                            break;
                        }
                    }
    
                    return index;
                }
                else
                    return -1;
            }
    
            public void RemoveAt(int index)
            {
                if ((index >= 0) && (index < Count))
                {
                    for (int i = index; i < Count - 1; i++)
                        items[i] = items[i + 1];
    
                    size--;
                }
            }
    
            public void Remove(T item)
            {
                int index = IndexOf(item);
    
                if (index >= 0)
                {
                    RemoveAt(index);
                }
            }
    
            public IEnumerator<T> GetEnumerator()
            {
                int counter = 0;
    
                while (counter < Count)
                {
                    yield return items[counter];
                    counter++;
                }
            }
        }
    }
  4. Save all

The Apartments

Our application is used to manage rent transactions for an apartment building. An apartment has one or more bedrooms and bathrooms. Since this is a rental building, the information about an apartment must also include the amount to pay every month. A customer must also pay a security deposit to acquire the apartment.

Practical LearningPractical Learning: Creating Apartments Records

  1. Display the Apartments form and double-click the New Apartment button
  2. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace LambdaSquareApartments1
    {
        public partial class Apartments : Form
        {
            public Apartments()
            {
                InitializeComponent();
            }
    
    	private void ShowApartments()
    	{
    	}
    
            private void btnNewApartment_Click(object sender, EventArgs e)
            {
                Apartment apart = new Apartment();
                NewApartment na = new NewApartment();
                BinaryFormatter bfApartments = new BinaryFormatter();
                Collector<Apartment> apartments = new Collector<Apartment>();
                string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Apartments.apt";
    
                if (na.ShowDialog() == DialogResult.OK)
                {
                    if (string.IsNullOrEmpty(na.txtUnitCode.Text))
                    {
                        MessageBox.Show("You must specify the unit code.",
                                        "Lambda Square Apartments",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
    
                    if (File.Exists(strFileName))
                    {
                        using (FileStream fsApartments = new FileStream(strFileName, FileMode.Open))
                        {
                            apartments = (Collector<Apartment>)bfApartments.Deserialize(fsApartments);
                        }
                    }
    
                    apart.UnitCode = na.txtUnitCode.Text;
                    apart.ApartmentNumber = na.txtApartmentNumber.Text;
                    apart.Bedrooms = int.Parse(na.txtBedrooms.Text);
                    apart.Bathrooms = float.Parse(na.txtBathrooms.Text);
                    apart.MonthlyRate = double.Parse(na.txtMonthlyRate.Text);
                    apart.SecurityDeposit = double.Parse(na.txtSecurityDeposit.Text);
                    apart.OccupancyStatus = na.cbxOccupanciesStatus.Text;
                    apartments.Add(apart);
    
                    using (FileStream fsApartments = new FileStream(strFileName, FileMode.Create))
                    {
                        bfApartments.Serialize(fsApartments, apartments);
                    }
                }
            }
    
            ShowApartments();
        }
    }
  3. Return to the Apartments form and double-click an unoccupied area of the form
  4. Implement the event as follows:
    private void ShowApartments()
    {
        BinaryFormatter bfApartments = new BinaryFormatter();
        Collector<Apartment> apartments = new Collector<Apartment>();
        string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Apartments.apt";
    
        if (File.Exists(strFileName))
        {
            lvwApartments.Items.Clear();
    
            using (FileStream fsApartments = new FileStream(strFileName, FileMode.Open))
            {
                apartments = (Collector<Apartment>)bfApartments.Deserialize(fsApartments);
    
                foreach (Apartment apart in apartments)
                {
                    ListViewItem lviApartment = new ListViewItem(apart.UnitCode);
                    lviApartment.SubItems.Add(apart.ApartmentNumber);
                    lviApartment.SubItems.Add(apart.Bedrooms.ToString());
                    lviApartment.SubItems.Add(apart.Bathrooms.ToString());
                    lviApartment.SubItems.Add(apart.MonthlyRate.ToString());
                    lviApartment.SubItems.Add(apart.SecurityDeposit.ToString());
                    lviApartment.SubItems.Add(apart.OccupancyStatus);
                    lvwApartments.Items.Add(lviApartment);
                }
            }
        }
    }
    
    private void Apartments_Load(object sender, EventArgs e)
    {
        ShowApartments();
    }
  5. Return to the Apartments form and double-click the Close button
  6. Implement the event as follows:
    private void btnClose_Click(object sender, EventArgs e)
    {
        Close();
    }
  7. Save all

The Employees

The employees are in charge of creating records (for apartments and customers) and managing the transactions (such as rent payments). For a simple application, we will keep information to a minimum.

Practical LearningPractical Learning: Creating Employees Records

  1. Display the Employees form and double-click an unoccupied area of its body
  2. Return to the Employees form and double-click the New Employee button
  3. Return to the Employees form and double-click the Close button
  4. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace LambdaSquareApartments1
    {
        public partial class Employees : Form
        {
            public Employees()
            {
                InitializeComponent();
            }
    
            private void ShowEmployees()
            {
                BinaryFormatter bfEmployees = new BinaryFormatter();
                Collector<Employee> employees = new Collector<Employee>();
                string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Employees.apt";
    
                if (File.Exists(strFileName))
                {
                    lvwEmployees.Items.Clear();
    
                    using (FileStream fsEmployees = new FileStream(strFileName, FileMode.Open))
                    {
                        employees = (Collector<Employee>)bfEmployees.Deserialize(fsEmployees);
    
                        foreach (Employee empl in employees)
                        {
                            ListViewItem lviEmployee = new ListViewItem(empl.EmployeeNumber);
                            lviEmployee.SubItems.Add(empl.FirstName);
                            lviEmployee.SubItems.Add(empl.LastName);
                            lviEmployee.SubItems.Add(empl.Title);
                            lvwEmployees.Items.Add(lviEmployee);
                        }
                    }
                }
            }
    
            private void Employees_Load(object sender, EventArgs e)
            {
                ShowEmployees();
            }
    
            private void btnNewEmployee_Click(object sender, EventArgs e)
            {
                Employee empl = new Employee();
                NewEmployee ne = new NewEmployee();
                BinaryFormatter bfEmployees = new BinaryFormatter();
                Collector<Employee> employees = new Collector<Employee>();
                string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Employees.apt";
    
                if (ne.ShowDialog() == DialogResult.OK)
                {
                    if (string.IsNullOrEmpty(ne.txtEmployeeNumber.Text))
                    {
                        MessageBox.Show("You must enter the employee number.",
                                        "Lambda Square Apartments",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
    
                    if (File.Exists(strFileName))
                    {
                        using (FileStream fsEmployees = new FileStream(strFileName, FileMode.Open))
                        {
                            employees = (Collector<Employee>)bfEmployees.Deserialize(fsEmployees);
                        }
                    }
    
                    empl.EmployeeNumber = ne.txtEmployeeNumber.Text;
                    empl.FirstName = ne.txtFirstName.Text;
                    empl.LastName = ne.txtLastName.Text;
                    empl.Title = ne.txtTitle.Text;
                    employees.Add(empl);
    
                    using (FileStream fsEmployees = new FileStream(strFileName, FileMode.Create))
                    {
                        bfEmployees.Serialize(fsEmployees, employees);
                    }
                }
    
                ShowEmployees();
            }
    
            private void btnClose_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
  5. Save all

Tenants Registrations

To rent an apartment, a customer, also called a tenant, must fill an application to have an account created. The tenant must specify the type of desired apartment. The management would check the available apartments and allocate one.

Practical LearningPractical Learning: Registering Tenants

  1. Display the New Tenant Registration form and double-click an unoccupied area of its body
  2. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace LambdaSquareApartments1
    {
        public partial class NewTenantRegistration : Form
        {
            public NewTenantRegistration()
            {
                InitializeComponent();
            }
    
            private void InitializeTenantRegistration()
            {
                int iRegistrationNumber = 1000;
                BinaryFormatter bfTenantRegistrations = new BinaryFormatter();
                Collector<TenantRegistration> registrations = new Collector<TenantRegistration>();
                string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\TenantsRegistrations.apt";
                
                if (File.Exists(strFileName))
                {
                    using (FileStream fsApartments = new FileStream(strFileName, FileMode.Open))
                    {
                        registrations = (Collector<TenantRegistration>)bfTenantRegistrations.Deserialize(fsApartments);
    
                        foreach (TenantRegistration tr in registrations)
                        {
                            iRegistrationNumber = tr.RegistrationNumber;
                        }
                    }
                }
    
                txtRegistrationNumber.Text = (iRegistrationNumber + 1).ToString();
            }
    
            private void NewTenantRegistration_Load(object sender, EventArgs e)
            {
                InitializeTenantRegistration();
            }
        }
    }
  3. Return to the New Tenant Registration form and click the Employee # text box
  4. On the Properties window, click the Events button and double-click Leave
  5. Implement the event as follows:
     private void txtEmployeeNumber_Leave(object sender, EventArgs e)
    {
        BinaryFormatter bfEmployees = new BinaryFormatter();
        Collector<Employee> employees = new Collector<Employee>();
        string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Employees.apt";
    
        if (string.IsNullOrEmpty(txtEmployeeNumber.Text))
            return;
    
        if (File.Exists(strFileName))
        {
            using (FileStream fsEmployees = new FileStream(strFileName, FileMode.Open))
            {
                employees = (Collector<Employee>)bfEmployees.Deserialize(fsEmployees);
    
                foreach (Employee empl in employees)
                {
                    if (txtEmployeeNumber.Text == empl.EmployeeNumber)
                    {
                        txtEmployeeName.Text = empl.FirstName + " " + empl.LastName;
                        break;
                    }
                }
            }    
        }
    }
  6. Return to the New Tenant Registration form and click the Unit Code text box
  7. In the Events section of the Properties window, double-click Leave
  8. Implement the event as follows:
    private void txtUnitCode_Leave(object sender, EventArgs e)
    {
        BinaryFormatter bfApartments = new BinaryFormatter();
        Collector<Apartment> apartments = new Collector<Apartment>();
        string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Apartments.apt";
    
        if (string.IsNullOrEmpty(txtUnitCode.Text))
            return;
    
        if (File.Exists(strFileName))
        {
            using (FileStream fsApartments = new FileStream(strFileName, FileMode.Open))
            {
                apartments = (Collector<Apartment>)bfApartments.Deserialize(fsApartments);
    
                foreach(Apartment apart in apartments)
                {
                    if (apart.UnitCode == txtUnitCode.Text)
                    {
                        txtApartmentDetails.Text = "Bedroom(s):\t" + apart.Bedrooms.ToString() + Environment.NewLine +
                                                   "Bathroom(s):\t" + apart.Bathrooms.ToString("F") + Environment.NewLine +
                                                   "Monthly Rent:\t" + apart.MonthlyRate.ToString() + "\\month\n" + Environment.NewLine +
                                                   "Security Deposit:\t " + apart.SecurityDeposit.ToString();
                        break;
                    }
                }
            }
        }
    }
  9. Return to the New Tenant Registration form and double-click the Submit button
  10. Implement the event as follows:
    private void btnSubmit_Click(object sender, EventArgs e)
    {
        TenantRegistration tr = new TenantRegistration();
        BinaryFormatter bfTenantsRegistrations = new BinaryFormatter();
        Collector<TenantRegistration> registrations = new Collector<TenantRegistration>();
        string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\TenantsRegistrations.trs";
    
        if (string.IsNullOrEmpty(txtRegistrationNumber.Text))
        {
            MessageBox.Show("You must specify the registration number.",
                            "Lambda Square Apartments",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
            return;
        }
    
        if (File.Exists(strFileName))
        {
            using (FileStream fsTenantsRegistrations = new FileStream(strFileName, FileMode.Open))
            {
                registrations = (Collector<TenantRegistration>)bfTenantsRegistrations.Deserialize(fsTenantsRegistrations);
            }
        }
    
        tr.RegistrationNumber = int.Parse(txtRegistrationNumber.Text);
        tr.RegistrationDate = dtpRegistrationDate.Value;
        tr.EmployeeNumber = txtEmployeeNumber.Text;
        tr.TenantCode = txtTenantCode.Text;
        tr.FirstName = txtFirstName.Text;
        tr.LastName = txtLastName.Text;
        tr.MaritalStatus = cbxMaritalsStatus.Text;
        tr.NumberOfChildren = ushort.Parse(txtNumberOfChildren.Text);
        tr.PhoneNumber = txtPhoneNumber.Text;
        tr.EmailAddress = txtEmailAddress.Text;
        tr.UnitCode = txtUnitCode.Text;
        tr.RentStartDate = dtpRentStartDate.Value;
        registrations.Add(tr);
    
        using (FileStream fsTenantsRegistrations = new FileStream(strFileName, FileMode.Create))
        {
            bfTenantsRegistrations.Serialize(fsTenantsRegistrations, registrations);
        }
    
        Close();
    }
  11. Return to the New Tenant Registration form and click the Close button
  12. Implement the event as follows:
    private void btnClose_Click(object sender, EventArgs e)
    {
        Close();
    }
  13. Display the Tenants Registrations form and double-click an unoccupied area of its body
  14. Return to the Tenants Registrations form and double-click the New Registration button
  15. Return to the Tenants Registrations form and double-click the Close button
  16. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace LambdaSquareApartments1
    {
        public partial class TenantsRegistrations : Form
        {
            public TenantsRegistrations()
            {
                InitializeComponent();
            }
    
            private void ShowRegistrations()
            {
                lvwRegistrations.Items.Clear();
    
                string strEmployee = "", strApartment = "";
                BinaryFormatter bfEmployees = new BinaryFormatter();
                BinaryFormatter bfApartments = new BinaryFormatter();
                Collector<Employee> employees = new Collector<Employee>();
                Collector<Apartment> apartments = new Collector<Apartment>();
                BinaryFormatter bfTenantsRegistrations = new BinaryFormatter();
                Collector<TenantRegistration> registrations = new Collector<TenantRegistration>();
                string strEmployeesFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Employees.mpl";
                string strApartmentsFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Apartments.apt";
                string strTenantsRegistrationsFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\TenantsRegistrations.trs";
    
                if (File.Exists(strTenantsRegistrationsFile))
                {
                    using (FileStream fsTenantsRegistrations = new FileStream(strTenantsRegistrationsFile, FileMode.Open))
                    {
                        registrations = (Collector<TenantRegistration>)bfTenantsRegistrations.Deserialize(fsTenantsRegistrations);
    
                        foreach (TenantRegistration tr in registrations)
                        {
                            ListViewItem lviRegistration = new ListViewItem(tr.RegistrationNumber.ToString());
                            lviRegistration.SubItems.Add(tr.RegistrationDate.ToShortDateString());
    
                            using (FileStream fsEmployees = new FileStream(strEmployeesFile, FileMode.Open))
                            {
                                employees = (Collector<Employee>)bfEmployees.Deserialize(fsEmployees);
    
                                foreach (Employee empl in employees)
                                {
                                    if (empl.EmployeeNumber == tr.EmployeeNumber)
                                    {
                                        strEmployee = empl.EmployeeNumber + ": " + empl.FirstName + " " + empl.LastName;
                                        break;
                                    }
                                }
                            }
    
                            lviRegistration.SubItems.Add(strEmployee);
                            lviRegistration.SubItems.Add(tr.TenantCode);
                            lviRegistration.SubItems.Add(tr.FirstName);
                            lviRegistration.SubItems.Add(tr.LastName);
                            lviRegistration.SubItems.Add(tr.MaritalStatus);
                            lviRegistration.SubItems.Add(tr.NumberOfChildren.ToString());
                            lviRegistration.SubItems.Add(tr.PhoneNumber);
                            lviRegistration.SubItems.Add(tr.EmailAddress);
    
                            using (FileStream fsApartments = new FileStream(strApartmentsFile, FileMode.Open))
                            {
                                apartments = (Collector<Apartment>)bfApartments.Deserialize(fsApartments);
    
                                foreach (Apartment apart in apartments)
                                {
                                    if (apart.UnitCode == tr.UnitCode)
                                    {
                                        strApartment = tr.TenantCode + ": " + apart.Bedrooms.ToString() + " bedroom(s), " +
                                                       apart.Bathrooms.ToString() + " bathroom(s), " +
                                                       "Rent = " + apart.MonthlyRate.ToString() + "\\month, " +
                                                       "Deposit = " + apart.SecurityDeposit.ToString();
                                        break;
                                    }
                                }
                            }
                            lviRegistration.SubItems.Add(strApartment);
                            lviRegistration.SubItems.Add(tr.RentStartDate.ToShortDateString());
                            lvwRegistrations.Items.Add(lviRegistration);
                        }
                    }
                }
            }
    
            private void TenantsRegistrations_Load(object sender, EventArgs e)
            {
                ShowRegistrations();
            }
    
            private void btnNewRegistration_Click(object sender, EventArgs e)
            {
                NewTenantRegistration ntr = new NewTenantRegistration();
    
                ntr.ShowDialog();
                ShowRegistrations();
            }
    
            private void btnClose_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
  17. Save all

The Payments

There are various types of payments a tenant must make:

  • In the begining, when acquiring an apartment, a customer must pay a security deposit
  • Every month, usually at the end (of the month), a tenant must pay the fixed monthly rate for occupying the apartment
  • Some time to time, a customer may have to pay a fine. There are various reasons. The most common reason is when rent is paid late

Practical LearningPractical Learning: Making Payments

  1. Display the New Payment form and double-click an unoccupied area of its body
  2. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace LambdaSquareApartments1
    {
        public partial class NewPayment : Form
        {
            public NewPayment()
            {
                InitializeComponent();
            }
    
            private void InitializePayment()
            {
                int iReceiptNumber = 100000;
                BinaryFormatter bfPayments = new BinaryFormatter();
                Collector payments = new Collector();
                string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Payments.pmt";
    
                if (File.Exists(strFileName))
                {
                    using (FileStream fsPayments = new FileStream(strFileName, FileMode.Open))
                    {
                        payments = (Collector)bfPayments.Deserialize(fsPayments);
    
                        foreach (Payment pmts in payments)
                        {
                            iReceiptNumber = pmts.ReceiptNumber;
                        }
                    }
                }
    
                txtReceiptNumber.Text = (iReceiptNumber + 1).ToString();
            }
    
            private void NewPayment_Load(object sender, EventArgs e)
            {
                InitializePayment();
            }
        }
    }
  3. Return to the New Payment form and click the Employee # text box
  4. In the Events section of the Properties window, double-click Leave
  5. Implement the event as follows:
     private void txtEmployeeNumber_Leave(object sender, EventArgs e)
    {
        BinaryFormatter bfEmployees = new BinaryFormatter();
        Collector<Employee> employees = new Collector<Employee>();
        string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Employees.mpl";
    
        if (string.IsNullOrEmpty(txtEmployeeNumber.Text))
            return;
    
        if (File.Exists(strFileName))
        {
            using (FileStream fsEmployees = new FileStream(strFileName, FileMode.Open))
            {
                employees = (Collector<Employee>)bfEmployees.Deserialize(fsEmployees);
    
                foreach (Employee empl in employees)
                {
                    if (txtEmployeeNumber.Text == empl.EmployeeNumber)
                    {
                        txtEmployeeName.Text = empl.FirstName + " " + empl.LastName;
                        break;
                    }
                }
            }    
        }
    }
  6. Return to the New Tenant Registration form and click the Registration # text box
  7. In the Events section of the Properties window, double-click Leave
  8. Implement the event as follows:
    private void txtRegistrationNumber_Leave(object sender, EventArgs e)
    {
        BinaryFormatter bfApartments = new BinaryFormatter();
        BinaryFormatter bfRegistrations = new BinaryFormatter();
        Collector<Apartment> apartments = new Collector<Apartment>();
        Collector<TenantRegistration> registrations = new Collector<TenantRegistration>();
        string strApartmentsFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Apartments.apt";
        string strRegistrationsFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\TenantsRegistrations.trs";
    
        if (string.IsNullOrEmpty(txtRegistrationNumber.Text))
            return;
    
        if (File.Exists(strRegistrationsFile))
        {
            using (FileStream fsRegistrations = new FileStream(strRegistrationsFile, FileMode.Open))
            {
                registrations = (Collector<TenantRegistration>)bfRegistrations.Deserialize(fsRegistrations);
    
                foreach (TenantRegistration regist in registrations)
                {
                    if (regist.RegistrationNumber == int.Parse(txtRegistrationNumber.Text) )
                    {
                        txtDateRegistered.Text = regist.RegistrationDate.ToShortDateString();
                        txtRentStartDate.Text = regist.RentStartDate.ToShortDateString();
                        txtTenantInformation.Text = regist.TenantCode + ": " +
                                                    regist.FirstName + " " + regist.LastName + ", " +
                                                    regist.MaritalStatus + ", " +
                                                    regist.NumberOfChildren.ToString() + " child(ren)";
                    }  
                            
                    using (FileStream fsApartments = new FileStream(strApartmentsFile, FileMode.Open))
                    {
                        apartments = (Collector<Apartment>)bfApartments.Deserialize(fsApartments);
                                
                        foreach (Apartment apart in apartments)
                        {
                            if( apart.UnitCode == regist.UnitCode )
                            {
                                txtApartmentInformation.Text = apart.UnitCode + ": Apart #: " +
                                                                apart.ApartmentNumber + ", " + 
                                                                apart.Bedrooms.ToString() + " bedroom(s), " + 
                                                                apart.Bathrooms.ToString() + " bathroom(s), "  +
                                                                apart.MonthlyRate.ToString() + "/month, " +
                                                                " deposit = " + apart.SecurityDeposit.ToString();
                            }
                        }
                    }
                }
            }
        }
    }
  9. Return to the New Payment form and double-click the Submit button
  10. Implement the event as follows:
    private void btnSubmit_Click(object sender, EventArgs e)
    {
        Payment pmt = new Payment();
        BinaryFormatter bfPayments = new BinaryFormatter();
        Collector<Payment> payments = new Collector<Payment>();
        string strFileName = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Payments.pmt";
    
        if (string.IsNullOrEmpty(txtReceiptNumber.Text))
        {
            MessageBox.Show("You must specify the receipt number.",
                            "Lambda Square Apartments",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
            return;
        }
    
        if (File.Exists(strFileName))
        {
            using (FileStream fsPayments = new FileStream(strFileName, FileMode.Open))
            {
                payments = (Collector<Payment>)bfPayments.Deserialize(fsPayments);
            }
        }
    
        pmt.ReceiptNumber = Convert.ToInt32(txtReceiptNumber.Text);
        pmt.PaymentDate = dtpPaymentDate.Value;
        pmt.EmployeeNumber = txtEmployeeNumber.Text;
        pmt.RegistrationNumber = int.Parse(txtRegistrationNumber.Text);
        pmt.PaymentAmount = Convert.ToDouble(txtPaymentAmount.Text);
        pmt.Notes = txtNotes.Text;
                
        payments.Add(pmt);
    
        using (FileStream fsPayments = new FileStream(strFileName, FileMode.Create))
        {
            bfPayments.Serialize(fsPayments, payments);
        }
    
        Close();
    }
  11. Return to the New Payment form and click the Close button
  12. Implement the event as follows:
    private void btnClose_Click(object sender, EventArgs e)
    {
        Close();
    }
  13. Display the Payments form and double-click an unoccupied area of its body
  14. Return to the Payments form and double-click the New Payment button
  15. Return to the Payments form and double-click the Close button
  16. Change the document as follows:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace LambdaSquareApartments1
    {
        public partial class Payments : Form
        {
            public Payments()
            {
                InitializeComponent();
            }
    
            private void ShowPayments()
            {
                string strEmployee = "", strRegistration = "";
                BinaryFormatter bfPayments = new BinaryFormatter();
                BinaryFormatter bfEmployees = new BinaryFormatter();
                Collector<Payment> payments = new Collector<Payment>();
                Collector<Employee> employees = new Collector<Employee>();
                BinaryFormatter bfTenantsRegistrations = new BinaryFormatter();
                Collector<TenantRegistration> registrations = new Collector<TenantRegistration>();
                string strPaymentsFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Payments.pmt";
                string strEmployeesFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\Employees.mpl";
                string strTenantsRegistrationsFile = @"C:\Microsoft Visual C# Application Design\Lambda Square Apartments\TenantsRegistrations.trs";
    
                if (File.Exists(strPaymentsFile))
                {
                    lvwPayments.Items.Clear();
                    using (FileStream fsPayments = new FileStream(strPaymentsFile, FileMode.Open))
                    {
                        payments = (Collector<Payment>)bfPayments.Deserialize(fsPayments);
    
                        foreach (Payment pmt in payments)
                        {
                            ListViewItem lviPayment = new ListViewItem(pmt.ReceiptNumber.ToString());
                            lviPayment.SubItems.Add(pmt.PaymentDate.ToShortDateString());
    
                            using (FileStream fsEmployees = new FileStream(strEmployeesFile, FileMode.Open))
                            {
                                employees = (Collector<Employee>)bfEmployees.Deserialize(fsEmployees);
    
                                foreach (Employee empl in employees)
                                {
                                    if (empl.EmployeeNumber == pmt.EmployeeNumber)
                                    {
                                        strEmployee = empl.EmployeeNumber + ": " + empl.FirstName + " " + empl.LastName;
                                        break;
                                    }
                                }
                            }
    
                            lviPayment.SubItems.Add(strEmployee);
    
                            using (FileStream fsTenantsRegistrations = new FileStream(strTenantsRegistrationsFile, FileMode.Open))
                            {
                                registrations = (Collector<TenantRegistration>)bfTenantsRegistrations.Deserialize(fsTenantsRegistrations);
    
                                foreach (TenantRegistration tr in registrations)
                                {
                                    if (tr.RegistrationNumber == pmt.RegistrationNumber)
                                    {
                                        strRegistration = "Regist #: " + tr.RegistrationNumber.ToString() +
                                                          " for " + tr.FirstName + " " + tr.LastName + ", " +
                                                          tr.MaritalStatus + ", " + tr.NumberOfChildren + " child(ren)";
                                    }
                                }
                            }
                            lviPayment.SubItems.Add(strRegistration);
                            lviPayment.SubItems.Add(pmt.PaymentAmount.ToString("F"));
                            lviPayment.SubItems.Add(pmt.Notes);
                            lvwPayments.Items.Add(lviPayment);
                        }
                    }
                }
            }
    
            private void Payments_Load(object sender, EventArgs e)
            {
                ShowPayments();
            }
    
            private void btnNewPayment_Click(object sender, EventArgs e)
            {
                NewPayment np = new NewPayment();
                np.ShowDialog();
                ShowPayments();
            }
    
            private void btnClose_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
  17. Execute the application
  18. Create the aparments as follows:
    Unit Code Aprt # Bedrooms Bathrooms Monthly Rate Security Deposit Occupancy Status
    399475 101 2 2 1150 650 Available
    508293 102 1 1 950 500 Needs Repair
    729397 103 1 1 925 500 Available
    928364 104 3 2 1350 850 Available
    297297 105 2 1 1150 550 Available
    492739 106 3 2 1350 850 Available
    692797 107 3 2 1285 850 Not Ready
    829475 108 1 1 885 500 Available
    139749 109 2 2 1150 650 Available
    369294 110 1 1 895 500 Available
    502084 111 2 2 1145 650 Available
    829397 112 2 1 1085 600 Available
    292739 201 2 1 1185 650 Available
    496055 202 1 1 895 500 Available
    939595 203 1 1 925 500 Available
    384068 204 3 2 1250 850 Available
    824850 205 2 1 1100 600 Available
    620485 206 3 2 1300 850 Available
    294940 207 3 2 1350 850 Available
    602048 208 1 1 920 500 Available
    829479 209 2 2 1150 650 Available
    280484 210 1 1 895 500 Available
    602408 211 2 2 1175 650 Available
    384086 212 2 1 1075 600 Available
    397493 301 2 2 1175 650 Available
    625941 302 1 1 950 500 Available
    404950 303 1 1 925 500 Available
    304806 304 3 2 1250 850 Available
    844850 305 2 1 1100 600 Needs Repair
    596305 306 3 2 1300 850 Available
    138408 307 3 2 1350 850 Available
    305860 308 1 1 920 500 Available
    847584 309 2 2 1150 650 Available
    746959 310 1 1 935 500 Available
    359405 311 2 2 1175 650 Available
    308505 312 2 1 1075 600 Available
  19. Create employees records as follows:
     
    Employee # First Name Last Name Title
    93947 Leonard Goulet Owner - General Manager
    40685 Justine Sandt Rent Manager
    73048 Raymond Wilkinson  
    60949 Mark Reason Maintenance Technician
    38408 Marc Knights Rent Associate
    20448 Nancy Longhorn Rent Associate
  20. Create the registrations records as follows:
     
    Regist # Registration Date Processed By Tenant Code First Name Last Name Marital Status Children Phone Number Email Address Tenancy Status Unit Code Rent Start Date
    1001 6/12/2014 38408 29-485-05 Ann Sanders Married 1 (240) 524 -2831 annsanders@emailcity.com Active 139749 7/1/2014
    1002 6/16/2014 20448 83-400-85 Mahty Shaoul Married 2 202-729-1574 mshaoulman@gmail.com Active 928364 9/1/2014
    1003 6/24/2014 40685 48-602-73 Frank Ulm Single 0 (301) 882-0704 fulm112244@yaho.com Active 729397 7/1/2014
    1004 6/24/2014 93947 24-385-30 Elise Provoski Separated 1 (443) 974-9631 eprevalence@yahoo.com Active 844850 8/1/2014
    1005 7/23/2014 93947 92-048-11 Grace Curryan Married 1 (240) 927-0993 gcarrier@gmail.com Active 297297 9/1/2014
    1006 7/25/2014 38408 51-304-58 Tracy Warrens Divorced 2 202-793-6924 twarrior12@hotmail.coom Active 492739 8/1/2014
    1007 8/1/2014 38408 72-384-04 Paul Yamo Married 3 (410-792-7045 pyamo@hr.umd.edu Active 384068 10/1/2014
    1008 8/10/2014 40685 62-405-29 Nancy Shermann Single 1 (703) 338-2973 nsherre@emailcity.com Active 829475 9/1/2014
    1009 9/12/2014 20448 72-484-04 Michael Tiernan Single 0 301-274-9285 resdev.globelan.net Active 829479 11/1/2014
    1010 10/5/2014 38408 60-285-83 Phillippe Anderson Single 0 202-729-1574 philanders@gmail.com Active 496055 11/1/2014
  21. Create payments records as follows:
     
    Receipt # Payment Date Empl # Regist # Amount Notes
    100001 6/12/2014 38408 1001 650 This is the payment for the security deposit.
    100002 6/20/2014 40685 1003 500 Security Deposit
    100003 7/27/2014 38408 1003 925
    100004 7/28/2014 38408 1001 1150
    100005 8/1/2014 40685 1006 850 Security Deposit
    100006 8/8/2014 40685 1007 850 Security Deposit
    100007 8/8/2014 40685 1008 500 Security Deposit
    100008 8/13/2014 40685 1004 600 Security Deposit
    100009 8/14/2014 20448 1002 850 Payment for security deposit
    100010 8/25/2014 38408 1001 1150
    100011 8/25/2014 38408 1002 1350
    100012 8/26/2014 20448 1003 925
    100013 8/27/2014 40685 1004 1100
    100014 8/30/2014 38408 1006 1350
    100015 9/17/2014 40685 1009 650 Security Deposit
    100016 9/18/2014 20448 1005 550 Security Deposit
    100017 9/25/2014 20448 1004 1100
    100018 9/25/2014 20448 1006 1350
    100019 9/25/2014 20448 1008 885
    100020 9/28/2014 20448 1001 1150
    100021 9/28/2014 40685 1002 1350
    100022 9/28/2014 40685 1005 1150
    100023 10/5/2014 38408 1003 925
    100024 10/8/2014 40685 1010 500 Security Deposit
    100025 10/24/2014 38408 1004 1100
    100026 10/24/2014 38408 1005 1150
    100027 10/25/2014 40685 1006 1350
    100028 10/25/2014 40685 1007 1250
    100029 10/27/2014 93947 1001 1150
    100030 10/29/2014 93947 1008 885
    100031 10/30/2014 38408 1002 1350
    100032 10/31/2014 40685 1003 925
    100033 11/26/2014 38408 1002 1350
    100034 11/26/2014 38408 1008 885
    100035 11/27/2014 38408 1006 1350
    100036 11/28/2014 20448 1004 1100
    100037 11/28/2014 38408 1005 1150
    100038 11/28/2014 38408 1007 1250
    100039 11/29/2014 93947 1001 1150
    100040 11/30/2014 38408 1003 925
    100041 11/30/2014 20448 1009 1150
    100042 11/30/2014 20448 1010 895
    100043 12/25/2014 38408 1006 1350
    100044 12/25/2014 38408 1007 1250
    100045 12/27/2014 20448 1009 1150
    100046 12/28/2014 20448 1001 1150
    100047 12/28/2014 38408 1004 1100
    100048 12/28/2014 38408 1005 1150
    100049 12/28/2014 38408 1010 895
    100050 12/30/2014 20448 1003 925
    100051 12/31/2014 38408 1002 1350
    100052 12/31/2014 20448 1008 885
    100053 1/23/2015 20448 1005 1150
    100054 1/26/2015 38408 1001 1150
    100055 1/28/2015 93947 1003 925
    100056 1/29/2015 93947 1002 1350
    100057 2/10/2015 20448 1004 100 This is a fee for late payment.
    100058 2/10/2015 20448 1004 1100
    100059 2/20/2015 20448 1001 1150
    100060 2/25/2015 20448 1005 1150
    100061 2/26/2015 38408 1002 1350
    100062 3/1/2015 38408 1004 1100
    100063 3/3/2015 40685 1003 925
  22. Close the forms and return to your programming environment

 

Application

 
 
   
 

Home Copyright © 2014, FunctionX