示例#1
0
        private void LstNeighbourhoods_SelectedIndexChanged(object sender, EventArgs e)
        {
            // check a district and neighbourhood is selected
            // check data was loaded in
            if (lstDistricts.SelectedIndex != -1 && lstNeighbourhoods.SelectedIndex != -1 && btnLoadDataWasClicked)
            {
                lstProperties.Items.Clear();
                int distno = lstDistricts.SelectedIndex;

                District dist = Arrays.DistArray[distno];

                // put all the selected  district's nbhs into an array
                Arrays.NbhArray = dist.getDistAllNbh();
                //get the nbh we need
                int           whichnbh = lstNeighbourhoods.SelectedIndex;
                Neighbourhood nbh      = Arrays.NbhArray[whichnbh];

                Arrays.PropArray = nbh.getNbhAllProp();
                if (nbh.getNbhNumProp() != 0)
                {
                    nbh.getNbhAllProp();
                    foreach (Property prop in Arrays.PropArray)
                    {
                        lstProperties.Items.Add(prop.getPropName());
                    }

                    // property maintenance buttons become available
                    btnAddProp.Show();
                    btnEditProp.Show();
                }
            }

            else
            {
                MessageBox.Show("You must select a district and neighbourhood.");
            }
        }
示例#2
0
        private void BtnEditProp_Click(object sender, EventArgs e)
        {
            // make sure a dist, nbh and prop are selected
            if (lstDistricts.SelectedIndex != -1 && lstNeighbourhoods.SelectedIndex != -1 && lstProperties.SelectedIndex != -1)
            {
                // get district number
                int distno = lstDistricts.SelectedIndex;
                // get neighbourhood number
                int whichnbh = lstNeighbourhoods.SelectedIndex;
                // get property number
                int propno = lstProperties.SelectedIndex;
                // open the property maintenance form
                // get this property object out of the arrays
                District      dist = Arrays.DistArray[distno];
                Neighbourhood nbh  = Arrays.NbhArray[whichnbh];
                Arrays.PropArray = nbh.getNbhAllProp();
                Property prop = Arrays.PropArray[propno];

                // get data ready to carry to new form
                SetTextValuePropID    = prop.getPropID();
                SetTextValuePropName  = prop.getPropName();
                SetTextValueHostID    = prop.getHostID();
                SetTextValueHostName  = prop.getHostName();
                SetTextValueNumProp   = prop.getNumPropH();
                SetTextValueLati      = prop.getLati();
                SetTextValueLongi     = prop.getLongi();
                SetTextValueRoomType  = prop.getRoomType();
                SetTextValuePrice     = prop.getPrice();
                SetTextValueMinNights = prop.getMinNights();
                SetTextValueDays      = prop.getDays();

                frmEditProp frmProp = new frmEditProp();

                frmProp.Show();
            }
        }