示例#1
0
        private void ListBoxLocations_SelectedIndexChanged(object sender, EventArgs e)
        {
            LandDA      landDA   = new LandDA();
            Location    location = (Location)ListBoxLocations.SelectedItem;
            List <Land> lands    = landDA.GetLandsByLocation(location);

            DataGridViewLands.Rows.Clear();

            int i = 0;

            while (i < lands.Count)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(DataGridViewLands);
                row.Cells[0].Value = Helper.GetNepaliNumber(i + 1);
                row.Cells[1].Value = lands[i].LandLocation.LocationPreviousVDC;
                row.Cells[2].Value = lands[i].PlotNumber;
                row.Cells[3].Value = lands[i].LandArea;

                // Store land_id as Tag
                row.Tag = lands[i].LandID.ToString();

                DataGridViewLands.Rows.Add(row);
                i++;
            }

            // Update total number of lands in selected location (label text)
            LabelTotalLandsInSelectedLocation.Text = $"जम्मा जग्गा (कित्ता) संख्या :  {Helper.GetNepaliNumber(lands.Count)}";
        }
        private void ComboBoxLocation_SelectedIndexChanged(object sender, EventArgs e)
        {
            LandDA      landDA   = new LandDA();
            Location    location = (Location)ComboBoxLocation.SelectedItem;
            List <Land> lands    = landDA.GetLandsByLocation(location);

            try
            {
                ComboBoxLand.DataSource    = lands;
                ComboBoxLand.DisplayMember = "LandInfo";
                ComboBoxLand.ValueMember   = "LandID";
            }
            catch (Exception)
            {
                MessageForm messageForm = new MessageForm();
                messageForm.MessageText = "ओहो! केही आन्तरिक त्रुटीको कारण जग्गा कित्ताको विवरण लोड गर्न सकिएन।";
                messageForm.ShowDialog();
            }
        }