Example #1
0
        public MyProperty Min()
        {
            double     min  = double.MaxValue;
            MyProperty prop = null;

            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] != null && arr[i].Price < min)
                {
                    min  = arr[i].Price;
                    prop = arr[i];
                }
            }
            return(prop);
        }
Example #2
0
        public MyProperty Max()
        {
            double     max  = double.MinValue;
            MyProperty prop = null;

            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] != null && arr[i].Price > max)
                {
                    max  = arr[i].Price;
                    prop = arr[i];
                }
            }
            return(prop);
        }
Example #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int        search   = int.Parse(txtPropertyNumber.Text);
            string     suburb   = txtSuburb.Text;
            int        bedrooms = int.Parse(txtBedrooms.Text);
            double     rent     = double.Parse(txtRent.Text);
            MyProperty prop     = new MyProperty(search, suburb, bedrooms, rent);

            if (manager.UpdateProperty(prop))
            {
                MessageBox.Show("Your property was succesfully Updated");
            }
            else
            {
                MessageBox.Show("No property matched the id");
            }
        }
Example #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string     suburb   = txtSuburb.Text;
            int        bedrooms = int.Parse(txtBedrooms.Text);
            double     rent     = double.Parse(txtRent.Text);
            MyProperty prop     = new MyProperty((counter * id), suburb, bedrooms, rent);

            if (manager.AddProperty(prop))
            {
                MessageBox.Show("A New property was added");
                counter++;
            }
            else
            {
                MessageBox.Show("No Property was added!");
            }
        }
Example #5
0
        private void btnMin_Click(object sender, EventArgs e)
        {
            MyProperty prop = manager.Min();

            MessageBox.Show("The Min property value is :" + prop.PrintInfo());
        }