Exemple #1
0
        public List <Anos> Listar()
        {
            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = Properties.Settings.Default.Configuração;
                SqlCommand cn = new SqlCommand();
                cn.CommandType = CommandType.Text;
                con.Open();
                cn.CommandText = "SELECT * from ano";
                cn.Connection  = con;

                SqlDataReader dr;
                List <Anos>   lista = new List <Anos>();
                dr = cn.ExecuteReader();

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Anos dado = new Anos();
                        dado.Id_ano = Convert.ToInt32(dr["id_ano"]);
                        dado.Ano    = Convert.ToInt32(dr["ano"]);
                        lista.Add(dado);
                    }
                }

                return(lista);
            }
        }
Exemple #2
0
        public static Anos[] ConsultarAnos()
        {
            int aux = (DateTime.Now.Year) - 91;

            Anos[] Ano = new Anos[92];
            for (int i = 1; i < 92; i++)
            {
                Ano[i] += aux + i;
            }
            return(Ano);
        }
Exemple #3
0
        public int Inserir(Anos obj)
        {
            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = Properties.Settings.Default.Configuração;
                SqlCommand cn = new SqlCommand();
                cn.CommandType = CommandType.Text;
                con.Open();
                cn.CommandText = "INSERT INTO ano ([ano]) VALUES (@ano)";
                cn.Parameters.Add("ano", SqlDbType.Int).Value = obj.Ano;
                cn.Connection = con;

                int qtd = cn.ExecuteNonQuery();
                return(qtd);
            }
        }
Exemple #4
0
        public int Deletar(Anos obj)
        {
            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = Properties.Settings.Default.Configuração;
                SqlCommand cn = new SqlCommand();
                cn.CommandType = CommandType.Text;
                con.Open();
                cn.CommandText = "DELETE FROM ano WHERE id_ano = @id";
                cn.Parameters.Add("id", SqlDbType.Int).Value = obj.Id_ano;
                cn.Connection = con;

                int qtd = cn.ExecuteNonQuery();
                return(qtd);
            }
        }
        private void UpdateModeloModern()
        {
            ID_Ano = Anos.GetValue(UC_ComboBox_Ano.SelectedValue.ToString()).Value;
            UC_TabPage_TI_DG_Livros.ItemsSource = LivrosEngine.GetLivrosWithCiclo(ID_Ano).OrderBy(x => x.Ano).ThenBy(x => Disciplinas.GetValue(x.Disciplina));
            if (Modelo_Modern == null)
            {
                Modelo_Modern = new Models.Modelo_Modern_Matricula();
                Modelo_Modern.EditorMode();
                Modelo_Modern.Editor = this;
                UC_DockPanel_Modelo.Children.Add(Modelo_Modern);
            }
            string ano = UC_ComboBox_Ano.SelectedValue.ToString();

            if (ano.Contains('-'))
            {
                string[] split = ano.Split('-');
                Modelo_Modern.AnoLectivo     = split[0];
                Modelo_Modern.Escola         = split[1];
                Modelo_Modern.EnsinoSuperior = true;
            }
            else
            {
                Modelo_Modern.EnsinoSuperior = false;
                Modelo_Modern.AnoLectivo     = UC_ComboBox_Ano.SelectedValue.ToString();
                Modelo_Modern.Escola         = UC_ComboBox_Escola.SelectedValue.ToString();
            }
            if (Escola.GetKey(UC_ComboBox_Escola.SelectedItem.ToString()) == 999)
            {
                Modelo_Modern.Escola = "";
            }
            Modelo_Modern._Ano = ID_Ano;

            Modelo_Modern.disciplinasGeral      = new List <_Disciplina>();
            Modelo_Modern.disciplinasEspecifica = new List <_Disciplina>();

            if (DadosMatricula.Componetes.ContainsKey(ID_Ano))
            {
                Modelo_Modern.disciplinasGeral      = DadosMatricula.Componetes[ID_Ano].Where(x => x.Superior == false).ToList();
                Modelo_Modern.disciplinasEspecifica = DadosMatricula.Componetes[ID_Ano].Where(x => x.Superior == true).ToList();
            }

            Modelo_Modern.FillTablesEmpty();
        }
Exemple #6
0
 public static Anos[] ConsultarAnos()
 {
     int aux = (DateTime.Now.Year) - 91;
     Anos[] Ano = new Anos[92];
     for (int i = 1; i < 92; i++)
     {
         Ano[i] += aux + i;
     }
     return Ano;
 }
        private void UC_ComboBox_Escola_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!this.IsLoaded)
            {
                return;
            }


            DadosMatricula_Engine.Load(Escola.GetKey(UC_ComboBox_Escola.SelectedItem.ToString()));

            DadosMatricula = new DadosMatricula();
            DadosMatricula = DadosMatricula_Engine.DadosMatricula;

            if (UC_ComboBox_Ano.Items.Count > 0 && UC_ComboBox_Ano.SelectedItem != null && Anos.GetValue(UC_ComboBox_Ano.SelectedItem.ToString()).GetValueOrDefault() > DadosMatricula.Componetes.Keys.Max())
            {
                UC_ComboBox_Ano.SelectedIndex = DadosMatricula.Componetes.Keys.Count - 1;
            }

            UC_ComboBox_Ano.ItemsSource = Escola.GetAnos(Escola.GetKey(UC_ComboBox_Escola.SelectedItem.ToString()));
            if (UC_ComboBox_Ano.SelectedItem != null)
            {
                UpdateModelo();
                UpdateModeloModern();
            }
        }
Exemple #8
0
 public List <Anos> Buscar(Anos obj)
 {
     return(new AnoController().Buscar(obj));
 }
Exemple #9
0
 public static int Deletar(Anos obj)
 {
     return(new AnoController().Deletar(obj));
 }
Exemple #10
0
 public static int Editar(Anos obj)
 {
     return(new AnoController().Editar(obj));
 }
Exemple #11
0
 public static int Inserir(Anos obj)
 {
     return(new AnoController().Inserir(obj));
 }
Exemple #12
0
 public string ToShortString() => $"{Anos.ToString("00")}a {Meses.ToString("00")}m {Dias.ToString("00")}d";
Exemple #13
0
 public override string ToString() => $"{Anos.ToString("00")}a {Meses.ToString("00")}m {Dias.ToString("00")}d - Total {TotalDeDias.ToString("0000")} dias";