protected void Municipality_SelectedIndex(object sender, EventArgs e) { parish1.Items.Clear(); String nameMunicipality = municipality1.SelectedItem.Text; Place consultmunicipalityID = new Place(nameMunicipality); ConsultMunicipalityIDCommand consultIDMunicipality = new ConsultMunicipalityIDCommand(consultmunicipalityID); try { consultIDMunicipality.execute(); _municipality = consultIDMunicipality.getAnswer(); idMunicipality = _municipality._ID; ConsultParishCommand cmd = new ConsultParishCommand(_municipality); cmd.execute(); parishConsultList = cmd.getAnswer(); foreach (Place _parish in parishConsultList) { parish1.Items.Add(_parish._Name); } } catch (Exception municipalityEx) { throw municipalityEx; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["USER_ID"] == null) { Response.Redirect("~/View/Home/index.aspx", false); } else { ConsultStateCommand consultState = new ConsultStateCommand(); try { consultState.execute(); stateConsultList = consultState.getAnswer(); foreach (Place _place1 in stateConsultList) { state1.Items.Add(_place1._Name); String test = _place1._Name; } } catch (Exception stateEx) { throw stateEx; } String idPatient = Request.QueryString["patiendID"]; int idInt = Convert.ToInt32(idPatient); consult = new Patient(idInt); ConsultPatientInformationCommand command = new ConsultPatientInformationCommand(consult); try { command.execute(); consulted = command.getAnswer(); nameTXT.Text = consulted._Name; surnameTXT.Text = consulted._Surname; ageTXT.Text = consulted._Age.ToString(); career1.SelectedValue = consulted._Career; foreach (Place _searchState in stateConsultList) { if (_searchState._Name == consulted._State) { state1.SelectedValue = consulted._State; } } //MUNICIPIOS String nameState = consulted._State; Place consultstateID = new Place(nameState); ConsultStateIDCommand consultIDState = new ConsultStateIDCommand(consultstateID); try { consultIDState.execute(); _state = consultIDState.getAnswer(); idState = _state._ID; test2 = idState; ConsultMunicipalityCommand cmd = new ConsultMunicipalityCommand(_state); cmd.execute(); municipalityConsultList = cmd.getAnswer(); foreach (Place _municipality in municipalityConsultList) { municipality1.Items.Add(_municipality._Name); _probando = _municipality; } foreach (Place _searchMunicipality in municipalityConsultList) { if (_searchMunicipality._Name == consulted._Municipality) { municipality1.SelectedValue = consulted._Municipality; } } } catch (Exception stateEx) { throw stateEx; } //PARROQUIAS String nameMunicipality = consulted._Municipality; Place consultmunicipalityID = new Place(nameMunicipality); ConsultMunicipalityIDCommand consultIDMunicipality = new ConsultMunicipalityIDCommand(consultmunicipalityID); try { consultIDMunicipality.execute(); _municipality = consultIDMunicipality.getAnswer(); idMunicipality = _municipality._ID; ConsultParishCommand cmd = new ConsultParishCommand(_municipality); cmd.execute(); parishConsultList = cmd.getAnswer(); foreach (Place _parish in parishConsultList) { parish1.Items.Add(_parish._Name); } foreach (Place _searchParish in parishConsultList) { if (_searchParish._Name == consulted._Parish) { parish1.SelectedValue = consulted._Parish; } } } catch (Exception municipalityEx) { throw municipalityEx; } } catch (Exception ex) { throw ex; } } } }
protected void State_SelectedIndex(object sender, EventArgs e) { //PARROQUIA municipality1.Items.Clear(); parish1.Items.Clear(); String nameState = state1.SelectedItem.Text; Place consultstateID = new Place(nameState); ConsultStateIDCommand consultIDState = new ConsultStateIDCommand(consultstateID); try { consultIDState.execute(); _state = consultIDState.getAnswer(); idState = _state._ID; test2 = idState; ConsultMunicipalityCommand cmdMunicipality = new ConsultMunicipalityCommand(_state); cmdMunicipality.execute(); municipalityConsultList = cmdMunicipality.getAnswer(); foreach (Place _municipality in municipalityConsultList) { municipality1.Items.Add(_municipality._Name); } //MUNICIPIO String nameMunicipality = municipality1.Items[0].Text; Place consultmunicipalityID = new Place(nameMunicipality); ConsultMunicipalityIDCommand consultIDMunicipality = new ConsultMunicipalityIDCommand(consultmunicipalityID); try { consultIDMunicipality.execute(); _municipality = consultIDMunicipality.getAnswer(); idMunicipality = _municipality._ID; ConsultParishCommand cmdParish = new ConsultParishCommand(_municipality); cmdParish.execute(); parishConsultList = cmdParish.getAnswer(); foreach (Place _parish in parishConsultList) { parish1.Items.Add(_parish._Name); } } catch (Exception municipalityEx) { throw municipalityEx; } } catch (Exception stateEx) { throw stateEx; } }