Пример #1
0
 public eCurso Datos(int cod)
 {
     try
     {
         eCurso        c      = null;
         string        select = string.Format("select * from Curso where Codigo={0}", cod);
         SqlConnection con    = db.ConectaDB();
         SqlCommand    cmd    = new SqlCommand(select, con);
         SqlDataReader reader = cmd.ExecuteReader();
         if (reader.Read())
         {
             c         = new eCurso();
             c.Codigo  = (int)reader["Codigo"];
             c.Nombre  = (string)reader["Nombre"];
             c.Vacante = (int)reader["Vacante"];
         }
         reader.Close();
         return(c);
     }
     catch (Exception)
     {
         return(null);
     }
     finally
     {
         db.DesconectaDB();
     }
 }
Пример #2
0
        private void ComboBox_Curso_RegistrarNota_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Curso_Seleccionado_RN = ComboBox_Curso_RegistrarNota.SelectedItem as eCurso;

                //Datos del curso
                TextBlock_NombreCurso_RegistrarNota.Text         = Curso_Seleccionado_RN.Nombre;
                TextBlock_PromedioCurso_RegistrarNota.Text       = Curso_Seleccionado_RN.Promedio.ToString("N2");
                TextBlock_PromedioFinalCurso_RegistrarNota.Text  = Curso_Seleccionado_RN.Promedio.ToString("N0");
                TextBlock_CreditosCurso_RegistrarNota.Text       = Curso_Seleccionado_RN.Creditos.ToString();
                TextBlock_PorcentajeCurso_RegistrarNota.Text     = Curso_Seleccionado_RN.getPorcentaje_Completado().ToString();
                TextBlock_NotaAbsolutaCurso_RegistrarNota.Text   = ((Curso_Seleccionado_RN.getPorcentaje_Completado() / 100.0) * 20).ToString();
                TextBlock_PuntosPerdidosCurso_RegistrarNota.Text = (((Curso_Seleccionado_RN.getPorcentaje_Completado() / 100.0) * 20) - Curso_Seleccionado_RN.Promedio).ToString("N2");



                //Campos
                ComboBox_Evaluaciones_RegistrarNota.ItemsSource = Curso_Seleccionado_RN.Campos;
                DataGrid_Evaluaciones_RegistrarNota.ItemsSource = Curso_Seleccionado_RN.Campos;

                ComboBox_Evaluaciones_RegistrarNota.SelectedIndex = 0;
            }
            catch (Exception ex) { }
        }
Пример #3
0
        public void GetCamposRegistrados(eCurso obj, out int Numero_Campos_Registrados, out int Porcentaje_Campos_Registrados)
        {
            Numero_Campos_Registrados     = 0;
            Porcentaje_Campos_Registrados = 0;
            try
            {
                SqlConnection Conexion = DB.Conectar();
                string        SELECT   = string.Format("select COUNT(*), SUM(Peso) from Campo group by ID_Curso having ID_Curso = '{0}'", obj.Codigo + "-0" + obj.Vez);
                SqlCommand    Comando  = new SqlCommand(SELECT, Conexion);
                SqlDataReader Reader   = Comando.ExecuteReader();

                while (Reader.Read())//Si es diferente de cero
                {
                    Numero_Campos_Registrados     = Convert.ToInt32(Reader[0]);
                    Porcentaje_Campos_Registrados = Convert.ToInt32(Reader[1]);
                }


                Reader.Close();
            }
            catch (Exception e)
            {
            }
            finally
            {
                DB.Desconectar();
            }
        }
Пример #4
0
        /*
         * SELECT SUM(Peso)
         * FROM Campo
         * WHERE ID_Curso = 'SI407-01'
         */

        public float GetPorcentajePorCompletar(eCurso obj)
        {
            float Porcentaje_Completado = 0;

            try
            {
                SqlConnection Conexion = DB.Conectar();
                string        SELECT   = string.Format("SELECT SUM(Peso) FROM Campo WHERE ID_Curso = '{0}'", obj.Codigo + "-0" + obj.Vez);
                SqlCommand    Comando  = new SqlCommand(SELECT, Conexion);
                SqlDataReader Reader   = Comando.ExecuteReader();

                while (Reader.Read())//Si es diferente de cero
                {
                    Porcentaje_Completado = Convert.ToSingle(Reader[0]);
                }

                Reader.Close();
                return(100 - Porcentaje_Completado);
            }
            catch (Exception e)
            {
                return(100 - Porcentaje_Completado);
            }
            finally
            {
                DB.Desconectar();
            }
        }
Пример #5
0
 public List <eCurso> Listar()
 {
     try
     {
         List <eCurso> lista  = new List <eCurso>();
         eCurso        c      = null;
         string        select = string.Format("select * from Curso");
         SqlConnection con    = db.ConectaDB();
         SqlCommand    cmd    = new SqlCommand(select, con);
         SqlDataReader reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             c         = new eCurso();
             c.Codigo  = (int)reader["Codigo"];
             c.Nombre  = (string)reader["Nombre"];
             c.Vacante = (int)reader["Vacante"];
             lista.Add(c);
         }
         reader.Close();
         return(lista);
     }
     catch (Exception)
     {
         return(null);
     }
     finally
     {
         db.DesconectaDB();
     }
 }
Пример #6
0
 public bool Registrar_Curso(eCurso Curso, out string message)
 {//En observacion
     /*nCampo Campo_N = new nCampo();
      *
      * if (status)
      * {
      *  foreach (eCampo x in Curso.Campos)
      *  {
      *      status = Campo_N.Registrar_Campo(x, out message);
      *  }
      * }*/
     return(Curso_DB.Insertar(Curso, out message));;
 }
Пример #7
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                int    cod = int.Parse(txtCodigo.Text);
                string nom = txtNombre.Text;
                int    vac = int.Parse(numVacante.Value.ToString());

                if (nom != "")
                {
                    if (cod < 999 && cod > 100)
                    {
                        if (!CodigoExiste(cod))
                        {
                            if (!NombreExiste(nom))
                            {
                                curso         = new eCurso();
                                curso.Codigo  = cod;
                                curso.Nombre  = nom;
                                curso.Vacante = vac;
                                geCur.RegistrarCurso(curso);
                                MessageBox.Show("Curso registrado correctamente", "Listo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Limpiar();
                                listarCurso();
                            }
                            else
                            {
                                MessageBox.Show("El nombre del curso ingresado ya existe, por favor ingrese uno válido", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("El código ingresado le pertenece a otro curso, por favor ingrese un nombre válido", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Código inválido, intente ingresando otro", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Complete los datos", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Complete los campos, por favor", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }
        }
Пример #8
0
        public bool Insertar(eCurso obj, out string message)
        {//Correcto
            try
            {
                SqlConnection Conexion = DB.Conectar();
                string        INSERT   = string.Format("Insert into Curso Values('{0}','{1}','{2}',{3},{4},{7},{5},'{6}')",
                                                       obj.Codigo + "-0" + obj.Vez, obj.Codigo, obj.Nombre, obj.Creditos, obj.Numero_Campos, obj.Vez, obj.Ciclo.Periodo, obj.Promedio);
                SqlCommand Comando = new SqlCommand(INSERT, Conexion);
                Comando.ExecuteNonQuery();

                message = "Curso Registrado";
                return(true);
            }
            catch (Exception e) { message = e.Message; return(false); }
            finally { DB.Desconectar(); }
        }
Пример #9
0
        ///////////////LOGICA GLOBAL////////////////////////
        /////////////////////////////////////////////////////
        /////////////////////////////////////////////////////
        /////////////////////////////////////////////////////
        private void Actualizar_Nota(eCiclo Ciclo_Selected, eCurso Curso_Selected, eCampo Campo_Selected) //Actualiza las notas de manera local, sin afectar a la base de datos
        {                                                                                                 //
         //Para el curso
            if (Campo_Selected.Nota != Campo_Selected.Nota_Nueva)
            {
                Ciclo_Selected.Promedio -= Curso_Selected.Promedio * Curso_Selected.Creditos / Ciclo_Selected.getPesoTotal();

                Curso_Selected.Promedio -= Campo_Selected.Nota * Campo_Selected.Peso / 100;

                Campo_Selected.Nota           = Campo_Selected.Nota_Nueva;
                Campo_Selected.Nota_Nueva     = 0;
                Curso_Selected.Promedio_Nuevo = Curso_Selected.Promedio + (Campo_Selected.Nota * Campo_Selected.Peso / 100);//El curso ya tiene su nuevo promedio
                Curso_Selected.Promedio       = Curso_Selected.Promedio_Nuevo;
                Curso_Selected.Promedio_Nuevo = 0;

                Ciclo_Selected.Promedio += Curso_Selected.Promedio * Curso_Selected.Creditos / Ciclo_Selected.getPesoTotal();
            }
        }
Пример #10
0
 public string Registrar(eCurso c)
 {
     try
     {
         SqlConnection con    = db.ConectaDB();
         string        insert = string.Format("insert into Curso values({0},'{1}',{2})", c.Codigo, c.Nombre, c.Vacante);
         SqlCommand    cmd    = new SqlCommand(insert, con);
         cmd.ExecuteNonQuery();
         return("Curso creado correctamente");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
     finally
     {
         db.DesconectaDB();
     }
 }
Пример #11
0
 public string Modificar(eCurso c)
 {
     try
     {
         SqlConnection con    = db.ConectaDB();
         string        update = string.Format("update Curso set Nombre='{0}' where Codigo={1}", c.Nombre, c.Codigo);
         SqlCommand    cmd    = new SqlCommand(update, con);
         cmd.ExecuteNonQuery();
         return("Datos del curso modificados correctamente");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
     finally
     {
         db.DesconectaDB();
     }
 }
Пример #12
0
        public string RegistarMatricula(int codC, int codU, string cur)
        {
            eCurso curso = new eCurso()
            {
                Codigo = codC,
                Nombre = cur
            };
            eUsuario user = new eUsuario()
            {
                Codigo = codU
            };
            eMatricula mat = new eMatricula()
            {
                CodCurso   = curso.Codigo,
                Curso      = curso.Nombre,
                CodUsuario = user.Codigo
            };

            return(datosMatricula.Registrar(mat));
        }
Пример #13
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool Campos_Completos = true;

            //int variacion = Cantidad_Cursos - 1;
            for (int i = 0; i < Cantidad_Cursos && Campos_Completos; i++) //RECORRO TODOS LOS CAMPOS PARA VER SI ESTAN COMPLETOS
            {                                                             // 0 1 2 3 4     CC = 5     0  4  1 2 1
                for (int j = 1; j < 4; j++)
                {
                    if ((((StackPanel_Cursos.Children[i] as Label).Content as StackPanel).Children[j] as TextBox).Text == "")
                    {
                        Campos_Completos = false; break;
                    }
                }
            }

            if (Campos_Completos)//Creo la lista de los cursos
            {
                List <eCurso> Lista_Cursos = new List <eCurso>();
                eCurso        Curso;

                //ORDEN: TextBlock TextBox_Nombre TextBox_Creditos TextBox_Promedio
                for (int i = 0; i < Cantidad_Cursos && Campos_Completos; i++)//RECORRO TODOS LOS CAMPOS PARA OBTENER SU INFOR
                {
                    Curso          = new eCurso();
                    Curso.Nombre   = (((StackPanel_Cursos.Children[i] as Label).Content as StackPanel).Children[1] as TextBox).Text;
                    Curso.Creditos = Convert.ToInt32((((StackPanel_Cursos.Children[i] as Label).Content as StackPanel).Children[2] as TextBox).Text);
                    Curso.Promedio = Convert.ToSingle((((StackPanel_Cursos.Children[i] as Label).Content as StackPanel).Children[3] as TextBox).Text);

                    Lista_Cursos.Add(Curso);
                }


                //////////////ACTUALIZO Y MUESTRO LOS DATOS
                TextBlock_PP.Text = Calcular_Promedio_Ponderado(Lista_Cursos).ToString("0.##");
            }
            else
            {
                MessageBox.Show("Complete los campos restantes");
            }
        }
Пример #14
0
        private void ListBox_Cursos_VerInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Curso_Seleccionado_VI = ListBox_Cursos_VerInfo.SelectedItem as eCurso;//Obtengo el curso seleccionado

                //Curso_Seleccionado_VI.Campos = Campo_Controller.GetCampos_(Curso_Seleccionado_VI.Codigo + "-0" + Curso_Seleccionado_VI.Vez);
                DataGrid_Evaluaciones_VerInfo.ItemsSource = Curso_Seleccionado_VI.Campos;

                //Actualizo los datos del curso seleccionado
                TextBlock_NombreCurso_VerInfo.Text         = Curso_Seleccionado_VI.Nombre;
                TextBlock_PromedioCurso_VerInfo.Text       = Curso_Seleccionado_VI.Promedio.ToString("N2");
                TextBlock_CreditosCurso_VerInfo.Text       = Curso_Seleccionado_VI.Creditos.ToString();
                TextBlock_PromedioFinalCurso_VerInfo.Text  = Curso_Seleccionado_VI.Promedio.ToString("N0");
                TextBlock_PorcentajeCurso_VerInfo.Text     = Curso_Seleccionado_VI.getPorcentaje_Completado().ToString();
                TextBlock_NotaAbsolutaCurso_VerInfo.Text   = ((Curso_Seleccionado_VI.getPorcentaje_Completado() / 100.0) * 20).ToString();
                TextBlock_PuntosPerdidosCurso_VerInfo.Text = (((Curso_Seleccionado_VI.getPorcentaje_Completado() / 100.0) * 20) - Curso_Seleccionado_VI.Promedio).ToString("N2");
            }
            catch (Exception ex)
            {
            }
        }
Пример #15
0
        }//En observación

        /*public List<eCurso> GetCursos(string ID_Ciclo)//Lo recomendable seria obtener todos los cursos de un determinado ciclo
         * {//Correcto
         *  try
         *  {
         *      List<eCurso> Lista_Cursos = new List<eCurso>();
         *      eCurso aux = null;
         *
         *      SqlConnection Conexion = DB.Conectar();
         *      string SELECT = string.Format("SELECT * FROM CURSO WHERE ID_Ciclo = '{0}'", ID_Ciclo);
         *      SqlCommand Comando = new SqlCommand(SELECT, Conexion);
         *      SqlDataReader Reader = Comando.ExecuteReader();
         *
         *      while (Reader.Read())
         *      {
         *          aux = new eCurso();
         *          aux.Codigo = (string)Reader["Codigo"];
         *          aux.Creditos = (int)Reader["Creditos"];
         *          aux.Nombre = (string)Reader["Nombre"];
         *          aux.Numero_Campos = (int)Reader["Cantidad_Campos"];
         *          aux.Promedio = Convert.ToSingle(Reader["Promedio"]);
         *          aux.Vez = (int)Reader["Vez"];
         *          aux.Ciclo.Periodo = ID_Ciclo;
         *
         *          Lista_Cursos.Add(aux);
         *      }
         *
         *
         *      Reader.Close();
         *      return Lista_Cursos;
         *  }
         *  catch (Exception e)
         *  {
         *      return null;
         *  }
         *  finally
         *  {
         *      DB.Desconectar();
         *  }
         * }*/

        public ObservableCollection <eCurso> GetCursos(string ID_Ciclo)
        {//Correcto
            try
            {
                ObservableCollection <eCurso> ObservableCollectiona_Cursos = new ObservableCollection <eCurso>();
                eCurso aux = null;

                SqlConnection Conexion = DB.Conectar();
                string        SELECT   = string.Format("SELECT * FROM CURSO WHERE ID_Ciclo = '{0}'", ID_Ciclo);
                SqlCommand    Comando  = new SqlCommand(SELECT, Conexion);
                SqlDataReader Reader   = Comando.ExecuteReader();

                while (Reader.Read())
                {
                    aux               = new eCurso();
                    aux.Codigo        = (string)Reader["Codigo"];
                    aux.Creditos      = (int)Reader["Creditos"];
                    aux.Nombre        = (string)Reader["Nombre"];
                    aux.Numero_Campos = (int)Reader["Cantidad_Campos"];
                    aux.Promedio      = Convert.ToSingle(Reader["Promedio"]);
                    aux.Vez           = (int)Reader["Vez"];
                    aux.Ciclo.Periodo = ID_Ciclo;

                    ObservableCollectiona_Cursos.Add(aux);
                }


                Reader.Close();
                return(ObservableCollectiona_Cursos);
            }
            catch (Exception e)
            {
                return(null);
            }
            finally
            {
                DB.Desconectar();
            }
        }
Пример #16
0
        public List <eCurso> GetCursos()
        {//Correcto
            try
            {
                List <eCurso> Lista_Cursos = new List <eCurso>();
                eCurso        aux          = null;

                SqlConnection Conexion = DB.Conectar();
                string        SELECT   = "SELECT * FROM CURSO";
                SqlCommand    Comando  = new SqlCommand(SELECT, Conexion);
                SqlDataReader Reader   = Comando.ExecuteReader();

                while (Reader.Read())
                {
                    aux               = new eCurso();
                    aux.Codigo        = (string)Reader["Codigo"];
                    aux.Creditos      = (int)Reader["Creditos"];
                    aux.Nombre        = (string)Reader["Nombre"];
                    aux.Numero_Campos = (int)Reader["Cantidad_Campos"];
                    aux.Promedio      = Convert.ToSingle(Reader["Promedio"]);
                    aux.Vez           = (int)Reader["Vez"];
                    aux.Ciclo.Periodo = (string)Reader["ID_Ciclo"];

                    Lista_Cursos.Add(aux);
                }


                Reader.Close();
                return(Lista_Cursos);
            }
            catch (Exception e)
            {
                return(null);
            }
            finally
            {
                DB.Desconectar();
            }
        }//Para Analytics
Пример #17
0
        }//Para Analytics

        public eCurso GetCurso(string ID_Curso, out string message)
        {//Correcto
            try
            {
                eCurso aux = null;

                SqlConnection Conexion = DB.Conectar();
                string        SELECT   = string.Format("SELECT * FROM CURSO WHERE ID = '{0}'", ID_Curso);
                SqlCommand    Comando  = new SqlCommand(SELECT, Conexion);
                SqlDataReader Reader   = Comando.ExecuteReader();

                while (Reader.Read())
                {
                    aux               = new eCurso();
                    aux.Codigo        = (string)Reader["Codigo"];
                    aux.Creditos      = (int)Reader["Creditos"];
                    aux.Nombre        = (string)Reader["Nombre"];
                    aux.Numero_Campos = (int)Reader["Cantidad_Campos"];
                    aux.Promedio      = Convert.ToSingle(Reader["Promedio"]);
                    aux.Vez           = (int)Reader["Vez"];
                    aux.Ciclo.Periodo = (string)Reader["ID_Ciclo"];
                }


                Reader.Close();
                message = "Correcto";
                return(aux);
            }
            catch (Exception e)
            {
                message = e.Message;
                return(null);
            }
            finally
            {
                DB.Desconectar();
            }
        }//En observación
Пример #18
0
        private void ListBox_Cursos_RegistrarCiclo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Curso_Seleccionado_RC        = ListBox_Cursos_RegistrarCiclo.SelectedItem as eCurso;
                Curso_Seleccionado_RC.Campos = Campo_Controller.GetCampos_(Curso_Seleccionado_RC.Codigo + "-0" + Curso_Seleccionado_RC.Vez);

                TextBlock_Curso_RegistrarCiclo.Text            = Curso_Seleccionado_RC.Nombre;
                TextBlock_EvasPorRegistrar_RegistrarCiclo.Text = Curso_Seleccionado_RC.Numero_Campos.ToString();
                int Numero_Campos_Registrados;
                int Porcentaje_Campos_Registrados;

                Curso_Controller.GetCamposRegistrados(Curso_Seleccionado_RC, out Numero_Campos_Registrados, out Porcentaje_Campos_Registrados);

                TextBlock_EvasRegistradas_RegistrarCiclo.Text      = Numero_Campos_Registrados.ToString();
                TextBlock_PorcentajeRegistrado_RegistrarCiclo.Text = Porcentaje_Campos_Registrados.ToString();

                DataGrid_Campos_RegistrarCiclo.ItemsSource = Curso_Seleccionado_RC.Campos;

                //Verifico si ya estan todos los campos registrados

                if (Porcentaje_Campos_Registrados == 100)//Si ya estan registrados todos los campos
                {
                    ComboBox_NombreEva_RegistrarCiclo.IsEnabled  = false;
                    TextBox_PesoEva_RegistrarCiclo.IsEnabled     = false;
                    Button_RegistrarEva_RegistrarCiclo.IsEnabled = false;

                    MessageBox.Show("Este curso ya tiene todos sus campos registrados", "Curso Completo");
                }
                else
                {
                    ComboBox_NombreEva_RegistrarCiclo.IsEnabled  = true;
                    TextBox_PesoEva_RegistrarCiclo.IsEnabled     = true;
                    Button_RegistrarEva_RegistrarCiclo.IsEnabled = true;
                }
            }
            catch (Exception ex) { }
        }
Пример #19
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                int    cod = int.Parse(txtCodigo.Text);
                string nom = txtNombre.Text;

                if (nom != "")
                {
                    if (!NombreExiste(nom))
                    {
                        curso        = new eCurso();
                        curso.Codigo = cod;
                        curso.Nombre = nom;
                        geCur.ModificarCurso(curso);
                        MessageBox.Show("Datos del curso modificado correctamente", "Listo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        listarCurso();
                        Limpiar();
                        Habilitar();
                    }
                    else
                    {
                        MessageBox.Show("El nombre del curso ingresado ya existe, por favor ingrese uno válido", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                        Limpiar();
                        Habilitar();
                    }
                }
                else
                {
                    MessageBox.Show("Complete los datos", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Seleccione un curso", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }
        }
Пример #20
0
 public void GetCamposRegistrados(eCurso obj, out int Numero_Campos_Registrados, out int Porcentaje_Campos_Registrados)
 {
     Curso_DB.GetCamposRegistrados(obj, out Numero_Campos_Registrados, out Porcentaje_Campos_Registrados);
 }
Пример #21
0
 public float GetPorcentajePorCompletar(eCurso obj)
 {
     return(Curso_DB.GetPorcentajePorCompletar(obj));
 }
Пример #22
0
        private void Button_RegistrarCurso_RegistrarCiclo_Click(object sender, RoutedEventArgs e)
        {
            try
            {//Falta validacion, guiarse de estructura de registro ciclo
                string Nombre_Curso_Nuevo          = TextBox_NombreCurso_RegistrarCiclo.Text;
                string Codigo_Curso_Nuevo          = TextBox_CodigoCurso_RegistrarCiclo.Text;
                int    Creditos_Curso_Nuevo        = Convert.ToInt32(TextBox_CreditosCurso_RegistrarCiclo.Text);
                int    Cantidad_Campos_Curso_Nuevo = Convert.ToInt32(TextBox_EvaluacionesCurso_RegistrarCiclo.Text);
                int    Numero_Veces_Curso_Nuevo    = Convert.ToInt32(ComboBox_NumeroVeces_RegistrarCiclo.Text);

                if (Nombre_Curso_Nuevo.Length != 0)
                {
                    if (Codigo_Curso_Nuevo.Length >= 4 && Codigo_Curso_Nuevo.Length <= 6)
                    {
                        if (Creditos_Curso_Nuevo > 0 && Creditos_Curso_Nuevo <= 10)
                        {
                            if (Cantidad_Campos_Curso_Nuevo > 0 && Cantidad_Campos_Curso_Nuevo <= 20)
                            {
                                eCurso Curso_Nuevo = new eCurso()
                                {
                                    Nombre        = Nombre_Curso_Nuevo,
                                    Codigo        = Codigo_Curso_Nuevo,
                                    Creditos      = Creditos_Curso_Nuevo,
                                    Numero_Campos = Cantidad_Campos_Curso_Nuevo,
                                    Vez           = Numero_Veces_Curso_Nuevo,
                                    Ciclo         = Ciclo_Seleccionado_RC
                                };

                                switch (MessageBox.Show(string.Format("Se va a registrar el curso {0} - {1} en el sistema", Curso_Nuevo.Nombre, Curso_Nuevo.Codigo), "Registro de Curso",
                                                        MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.OK))
                                {
                                case MessageBoxResult.OK:
                                    string message;
                                    if (Curso_Controller.Registrar_Curso(Curso_Nuevo, out message)) //Si se pudo registrar el curso
                                    {
                                        Ciclo_Seleccionado_RC.Cursos.Add(Curso_Nuevo);              //Agrego el curso nuevo al ciclo actual

                                        ListBox_Cursos_RegistrarCiclo.ItemsSource  = Ciclo_Seleccionado_RC.Cursos;
                                        ListBox_Cursos_RegistrarCiclo.SelectedItem = Curso_Nuevo.ToString();

                                        TextBox_NombreCurso_RegistrarCiclo.Clear();
                                        TextBox_CodigoCurso_RegistrarCiclo.Clear();
                                        TextBox_CreditosCurso_RegistrarCiclo.Clear();
                                        TextBox_EvaluacionesCurso_RegistrarCiclo.Clear();
                                        ComboBox_NumeroVeces_RegistrarCiclo.SelectedIndex = 0;

                                        TextBlock_CursosRegistrados_RegistrarCiclo.Text = Ciclo_Controller.GetCursosRegistrados(Ciclo_Seleccionado_RC.Periodo).ToString();

                                        MessageBox.Show(message);

                                        if (isComplete_Ciclo(Ciclo_Seleccionado_RC))
                                        {
                                            Button_RegistrarCurso_RegistrarCiclo.IsEnabled     = false;
                                            TextBox_NombreCurso_RegistrarCiclo.IsEnabled       = false;
                                            TextBox_CodigoCurso_RegistrarCiclo.IsEnabled       = false;
                                            TextBox_CreditosCurso_RegistrarCiclo.IsEnabled     = false;
                                            TextBox_EvaluacionesCurso_RegistrarCiclo.IsEnabled = false;
                                            ComboBox_NumeroVeces_RegistrarCiclo.IsEnabled      = false;

                                            MessageBox.Show("Este ciclo ya tiene todos sus cursos registrados", "Ciclo Completo");
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show(message);
                                    }

                                    break;

                                case MessageBoxResult.Cancel:
                                    TextBox_NombreCurso_RegistrarCiclo.Focus();
                                    break;
                                }
                            }
                            else
                            {
                                MessageBox.Show("Ingrese una cantidad de campos validos");
                                TextBox_EvaluacionesCurso_RegistrarCiclo.Focus();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Ingrese una cantidad de creditos validos");
                            TextBox_CreditosCurso_RegistrarCiclo.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ingrese un codigo valido");
                        TextBox_CodigoCurso_RegistrarCiclo.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Ingrese un nombre valido");
                    TextBox_NombreCurso_RegistrarCiclo.Focus();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Пример #23
0
        /*public List<eCurso> GetCursos(string ID_Ciclo)
         * {
         *  return Curso_DB.GetCursos(ID_Ciclo);
         * }*/

        public bool Actualizar_Nota(eCurso Curso)
        {
            return(Curso_DB.Actualizar(Curso.Codigo + "-0" + Curso.Vez, Curso.Promedio));
        }
Пример #24
0
 public string ModificarCurso(eCurso c)
 {
     return(datosCur.Modificar(c));
 }
Пример #25
0
 public string RegistrarCurso(eCurso c)
 {
     return(datosCur.Registrar(c));
 }