Beispiel #1
0
        private void frmRentProperty_Load(object sender, EventArgs e)
        {
            //Load ID's
            txtBookingID.Text = PropertySysv2.Booking.getNextBookingId().ToString("00000");


            //Fill combo boxes with options
            DataSet ds = new DataSet();

            ds = Property.getTown(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboTown.Items.Add(ds.Tables[0].Rows[i][0].ToString());
            }

            DataSet ts = new DataSet();

            ts = Tenant.getTenant(ts);

            for (int i = 0; i < ts.Tables["ss"].Rows.Count; i++)
            {
                cboTenant.Items.Add(ts.Tables[0].Rows[i][0].ToString());
            }

            for (int i = 1; i <= 6; i++)
            {
                cboBeds.Items.Add(i.ToString());
            }
        }
Beispiel #2
0
        private void cboTenant_SelectedIndexChanged(object sender, EventArgs e)
        {
            //if resetting combo, ignore
            if (cboTenant.SelectedIndex == -1)
            {
                return;
            }
            //Instantiate Tenant Objects
            Tenant newTenant = new Tenant();

            newTenant.getTenant(Convert.ToInt32(cboTenant.Text.Substring(0, 1)));


            if (newTenant.getTenantId().Equals(0))
            {
                MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtBookingID.Focus();
                return;
            }

            //Populate Text Boxes

            txtTenantID.Text = newTenant.getTenantId().ToString();
            txtForename.Text = newTenant.getForename();
            txtSurname.Text  = newTenant.getSurname();
            txtPhone.Text    = newTenant.getPhone().ToString();
            txtEmail.Text    = newTenant.getEmail();
            dtpDOB.Text      = newTenant.getDOB();

            //Reset UI
            grpTenants.Visible  = true;
            txtPropID.Enabled   = false;
            txtTenantID.Enabled = false;
            txtForename.Enabled = false;
            txtSurname.Enabled  = false;
            txtPhone.Enabled    = false;
            txtEmail.Enabled    = false;
            dtpDOB.Enabled      = false;
            btnExisting.Visible = true;
            btnAdd.Visible      = false;
        }