Пример #1
0
        public ObservableCollection<ElementalProperties> GetTitulos()
        {
            ObservableCollection<ElementalProperties> catalogoTitulos = new ObservableCollection<ElementalProperties>();

            string sqlCadena = "SELECT * FROM C_Titulo ORDER BY IdTitulo";


            OleDbConnection connection = new OleDbConnection(connectionString);
            OleDbCommand cmd = null;
            OleDbDataReader reader = null;


            try
            {
                connection.Open();

                cmd = new OleDbCommand(sqlCadena, connection);
                reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ElementalProperties elemento = new ElementalProperties();
                        elemento.IdElemento = Convert.ToInt32(reader["IdTitulo"]);
                        elemento.Descripcion = reader["TituloMay"].ToString();
                        elemento.ElementoAuxiliar = reader["TituloAbr"].ToString();

                        catalogoTitulos.Add(elemento);

                    }
                }
                cmd.Dispose();
                reader.Close();
            }
            catch (OleDbException ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,ElementalPropertiesModel", "PadronApi");
            }
            catch (Exception ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                ErrorUtilities.SetNewErrorMessage(ex, methodName + " Exception,ElementalPropertiesModel", "PadronApi");
            }
            finally
            {
                connection.Close();
            }

            return catalogoTitulos;
        }
Пример #2
0
        private void CbxTipoOrg_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TxtOrganismo.Text = String.Empty;
            selectedTipoOrg = CbxTipoOrg.SelectedItem as ElementalProperties;

            if (selectedTipoOrg.IdElemento < 2 || selectedTipoOrg.IdElemento > 10)
            {
                GpxMaterias.IsEnabled = false;
                CbxOrdinal.IsEnabled = false;
                CbxCircuito.IsEnabled = false;
                LblDescripcion.IsEnabled = false;
                TxtOrganismo.IsEnabled = true;

                CbxCircuito.SelectedIndex = -1;
                CbxOrdinal.SelectedIndex = -1;

                foreach (Materia materia in listaMaterias)
                    materia.IsChecked = false;
            }
            else
            {
                GpxMaterias.IsEnabled = true;
                CbxOrdinal.IsEnabled = true;
                CbxCircuito.IsEnabled = true;
                LblDescripcion.IsEnabled = true;
                TxtOrganismo.IsEnabled = false;
            }
        }