コード例 #1
0
        private void location_CheckedChanged(object sender, EventArgs e)
        {
            if (location.Checked == true)
            {
                //clear the current list
                listView1.Items.Clear();

                //disable other two options
                selectDate.Enabled = false;
                selectSpecies.Enabled = false;

                //call query functions and display in listview
                List<string> lists = new List<string>();
                CommonSightingsProcessing commonsighting = new CommonSightingsProcessing(connection);
                lists = commonsighting.filterByLocation();
                if(lists.Count == 0)
                {
                    MessageBox.Show("No records found", "Common Sightings");
                }
                foreach(string location in lists)
                {
                    listView1.Items.Add(new ListViewItem(location));
                }
                listView1.View = View.List;

            }
            else if(location.Checked == false)
            {
                listView1.Items.Clear();
                selectDate.Enabled = true;
                selectSpecies.Enabled = true;
            }
        }
コード例 #2
0
        private void selecteDate_CheckedChanged(object sender, EventArgs e)
        {
            if (selectDate.Checked == true)
            {
                listView1.Items.Clear();

                selectSpecies.Enabled = false;
                location.Enabled = false;

                List<string> lists = new List<string>();
                CommonSightingsProcessing commonsighting = new CommonSightingsProcessing(connection);

                lists = commonsighting.filterByDate();

                if (lists.Count == 0)
                {
                    MessageBox.Show("No records found", "Common Sightings");
                }

                foreach (string dates in lists) {
                    listView1.Items.Add(new ListViewItem(dates));

                }
                listView1.View = View.List;
            }
            else
            {
                listView1.Items.Clear();
                selectSpecies.Enabled = true;
                location.Enabled = true;
            }
        }