예제 #1
0
        private void cboRegionZone_SelectedIndexChanged(object sender, EventArgs e)
        {
            CADASTRAL_ZONE cadastreZone = cboRegionZone.SelectedItem as CADASTRAL_ZONE;

            if (cadastreZone != null && cadastreZone.ID_CADASTRAL_ZONE != -1)
            {
                List <CADASTRAL_REGION> regions = _basicService.LoadAllCADASTRAL_REGION(_businessParam).Where(c => c.ID_CADASTRAL_ZONE == cadastreZone.ID_CADASTRAL_ZONE).OrderBy(c => c.NAME).ToList();
                regions.Insert(0, new CADASTRAL_REGION {
                    NAME = "---", CODE = "", ID_CADASTRAL_REGION = -1
                });

                cboRegion.DataSource    = regions;
                cboRegion.DisplayMember = "NAME";
                cboRegion.ValueMember   = "ID_CADASTRAL_REGION";

                txtCodeRegionZone.Text = cadastreZone.CODE;

                if (regions == null || regions.Count == 0)
                {
                    txtCodeRegion.Text          = "";
                    txtCodeMunicipality.Text    = "";
                    txtCodeTerriturialUnit.Text = "";

                    cboRegion.DataSource          = null;
                    cboMunicipality.DataSource    = null;
                    cboTerritorialUnit.DataSource = null;
                }

                txtCodeRegionZone.ReadOnly = true;
            }
            else
            {
                cboRegion.DataSource       = null;
                txtCodeRegionZone.ReadOnly = false;
                txtCodeRegionZone.Text     = "";
            }
        }