void AplicoSubRegionPerfil() { if (CboPerfil.SelectedValue != "") { Ds_Temporal.Tables["DtSubregion"].Clear(); if (Convert.ToInt32(CboPerfil.SelectedValue) > 0) { int AmbitoId = ClUsuario.Get_Ambito_Perfil(Convert.ToInt32(CboPerfil.SelectedValue)); if (AmbitoId == 1) { DataSet Region = ClCatagos.Get_RegionesSubRegiones(); for (int i = 0; i < Region.Tables["Datos"].Rows.Count; i++) { AgregarSubRegion(Convert.ToInt32(Region.Tables["Datos"].Rows[i]["RegionId"]), Region.Tables["Datos"].Rows[i]["Region"].ToString(), Convert.ToInt32(Region.Tables["Datos"].Rows[i]["SubRegionId"]), Region.Tables["Datos"].Rows[i]["SubRegion"].ToString()); } Region.Clear(); } else if (AmbitoId == 2) { DataSet SubRegion = ClCatagos.ListadoSubRegion(Convert.ToInt32(CboRegion.SelectedValue)); for (int j = 0; j < SubRegion.Tables["Datos"].Rows.Count; j++) { AgregarSubRegion(Convert.ToInt32(Convert.ToInt32(CboRegion.SelectedValue)), CboRegion.Text, Convert.ToInt32(SubRegion.Tables["Datos"].Rows[j]["SubRegionId"]), SubRegion.Tables["Datos"].Rows[j]["Nombre"].ToString()); } SubRegion.Clear(); } else { AgregarSubRegion(Convert.ToInt32(CboRegion.SelectedValue), CboRegion.Text, Convert.ToInt32(CboSubregion.SelectedValue), CboSubregion.Text); } GrdRel_Region.Rebind(); } } }