コード例 #1
0
        /// <summary>
        /// Define las acciones del boton Enviar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Ado.ClasesComunes.Estudiante _estudianteDatos = (Ado.ClasesComunes.Estudiante)Session["Estudiante"];
            PlanEstudios _planEstudios = (PlanEstudios)Session["Plan"];

            IMetodosAdministrador _metAdmin = new MetodosAdministrador();
            Periodo _perUltimo = _metAdmin.UltimoPeriodo();

            Solicitud _solicitudNueva = new Solicitud();
            _solicitudNueva.Fec_Creacion = DateTime.Now;
            _solicitudNueva.Txt_Comentario = txtComentario.Text;
            _solicitudNueva.txt_Curso = ddlCursos.SelectedValue;
            _solicitudNueva.Txt_Estado = "PENDIENTE";
            _solicitudNueva.Txt_Motivo = "";

            IMetodosEstudiante _metEstudiante = new MetodosEstudiante();
            _metEstudiante.GuardarDatosEstudiantes(_estudianteDatos, _planEstudios.Id_Plan_Estudios);

            if ((_perUltimo.Fec_Inicio <= _solicitudNueva.Fec_Creacion) &&
                (_perUltimo.Fec_Fin >= _solicitudNueva.Fec_Creacion))
            {
                _metEstudiante.GuardarSolicitud(_estudianteDatos.Id_Carnet, _perUltimo.Id_Periodo, _solicitudNueva);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Error al crear la solicitud",
                    "alert('Su solicitud no pudo ser procesada, ya que no fue realizada dentro del periodo de recepción');",true);
            }
        }
コード例 #2
0
        protected void btnAgregarExcepcion_Click(object sender, EventArgs e)
        {
            IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
            string _carnet = txtCarnet.Text;
            int _idCurso = int.Parse(ddlCurso.SelectedValue);
            int _idGrupo = int.Parse(ddlGrupo.SelectedValue);

            Ado.ClasesComunes.Periodo _periodoActual = new Ado.ClasesComunes.Periodo();
            _periodoActual = _metAdministrador.UltimoPeriodo();

            if(_periodoActual != null)
            {
                bool _resultado = _metAdministrador.CrearExcepcion(_periodoActual.Id_Periodo, _idCurso, _idGrupo, _carnet);

                if(_resultado)
                {
                    lblPopupHeader.Text = "Excepcion Agregada";
                    lblPopupBody.Text = "La excepcion ha sido agregada correctamente al sistema.";
                    Pop_Alerta.Show();
                }
                else
                {
                    lblPopupHeader.Text = "Error al agregar excepcion";
                    lblPopupBody.Text = "La excepcion no pudo ser agregada al sistema.";
                    Pop_Alerta.Show();
                }
            }
            else
            {
                lblPopupHeader.Text = "Error al agregar excepcion";
                lblPopupBody.Text = "No existe un periodo de recepcion definido aún.";
                Pop_Alerta.Show();
            }
        }
コード例 #3
0
        protected void btnDefinirPeriodo_Click(object sender, EventArgs e)
        {
            IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
            if (_metAdministrador.UltimoPeriodo() == null)
            {
                //GET datos para creacion de periodo
                string txt_Modalidad = ddlModalidad.SelectedValue;//"S"
                int num_Periodo = int.Parse(ddlPeriodo.SelectedValue);//
                int num_Anio = int.Parse(txtAnio.Text);
                string txt_FechaInicio = txtFechaInicio.Text;
                string txt_FechaFin = txtFechaFinal.Text;

                Ado.ClasesComunes.Periodo _periodoNuevo = new Ado.ClasesComunes.Periodo();
                _periodoNuevo.Txt_Modalidad = txt_Modalidad;
                _periodoNuevo.Num_Periodo = num_Periodo;
                _periodoNuevo.Num_Anno = num_Anio;
                _periodoNuevo.Fec_Inicio = DateTime.Parse(txt_FechaInicio + " 00:00:00");
                _periodoNuevo.Fec_Fin = DateTime.Parse(txt_FechaFin + " 00:00:00");
                _periodoNuevo.Txt_Estado = "En Curso";

                //Guardar en BD
                _metAdministrador.DefinirPeriodoSolicitud(_periodoNuevo);
                lblPopupHeader.Text = "Periodo Definido";
                lblPopupBody.Text = "El periodo de recepción de solicitudes ha sido definido de manera exitosa dentro del sistema.";
                Pop_Alerta.Show();
            }
            else
            {
                // Ya hay un periodo definido y en curso
                lblPopupHeader.Text = "Error al definir el periodo";
                lblPopupBody.Text = "El periodo no fue creado, ya que existe un periodo de asignación en curso.";
                Pop_Alerta.Show();
            }
        }
コード例 #4
0
        protected void btnBajar_Click(object sender, EventArgs e)
        {
            ImageButton boton = sender as ImageButton;
            TableCell celda = boton.Parent as TableCell;
            TableRow fila = celda.Parent as TableRow;
            string nombreRegla = fila.Cells[0].Text;
            int indexActual = tblReglas.Rows.GetRowIndex(fila);
            int indexNuevo = indexActual + 1;
            if (indexNuevo != tblReglas.Rows.Count)
            {
                IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
                LinkedList<Regla> _lisReglas = (LinkedList<Regla>)Session["LISTA_REGLAS"];
                Regla _reglaBaja = new Regla();
                Regla _reglaSube = new Regla();

                foreach (Regla _regla in _lisReglas)//-- Obtengo las reglas por modificar
                {
                    if (_regla.Posicion.Equals(indexActual))//-- Aca el nombre sube o baja no tiene sentido
                    {
                        _reglaBaja = _regla;
                    }
                    if (_regla.Posicion.Equals(indexNuevo))
                    {
                        _reglaSube = _regla;
                    }
                }

                _lisReglas.Remove(_reglaSube);//-- Borro reglas de lista
                _lisReglas.Remove(_reglaBaja);

                _reglaSube.Posicion = indexActual;//-- Cambio las posiciones
                _reglaBaja.Posicion = indexNuevo;

                _lisReglas.AddLast(_reglaSube);//-- Agrego a la lista
                _lisReglas.AddLast(_reglaBaja);

                bool _resultado = _metAdministrador.ModificarOrdenReglas(_lisReglas);

                if (_resultado)
                {
                    Page.Response.Redirect(Page.Request.Url.PathAndQuery);
                }
                else
                {
                    lblPopupHeader.Text = "Error";
                    lblPopupBody.Text = "La prioridad de la regla no fue modificada.";
                    Pop_Alerta.Show();
                }

            }
            else
            {
                lblPopupHeader.Text = "Error";
                lblPopupBody.Text = "La regla ya tiene la prioridad mínima.";
                Pop_Alerta.Show();
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Ado.ClasesComunes.Periodo _periodoActual = new Ado.ClasesComunes.Periodo();
            IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
            _periodoActual = _metAdministrador.UltimoPeriodo();
            if (_periodoActual != null)
            {
                LinkedList<string> _encabezados = new LinkedList<string>();
                _encabezados.AddLast("Identificación");
                _encabezados.AddLast("Fecha de Inicio");
                _encabezados.AddLast("Fecha de Fin");
                _encabezados.AddLast("Estado");
                _encabezados.AddLast("Modalidad");
                _encabezados.AddLast("Año");
                _encabezados.AddLast("Número de Periodo");
                TableHeaderRow _encabezado = new TableHeaderRow();
                foreach (var _elemento in _encabezados)
                {
                    TableHeaderCell _celda = new TableHeaderCell();
                    _celda.Text = _elemento;
                    _encabezado.Cells.Add(_celda);
                }

                LinkedList<string> _periodo = new LinkedList<string>();
                _periodo.AddLast(_periodoActual.Id_Periodo.ToString());
                _periodo.AddLast(_periodoActual.Fec_Inicio.Date.ToString());
                _periodo.AddLast(_periodoActual.Fec_Fin.Date.ToString());
                _periodo.AddLast(_periodoActual.Txt_Estado);
                _periodo.AddLast(_periodoActual.Txt_Modalidad);
                _periodo.AddLast(_periodoActual.Num_Anno.ToString());
                _periodo.AddLast(_periodoActual.Num_Periodo.ToString());
                TableRow _fila = new TableRow();
                foreach (var _elemento in _periodo)
                {
                    TableCell _celda = new TableCell();
                    _celda.Text = _elemento;
                    _fila.Cells.Add(_celda);
                }
                //Lleno tabla
                tblPeriodo.Rows.Add(_encabezado);
                tblPeriodo.Rows.Add(_fila);

            }
            else
            {
                //Agrego Label que diga que no hay un periodo de recepcion en curso actualmente.
                lblSinPeriodo.Text = "-- El sistema no tiene actualmente un periodo de recepción de solicitudes en curso actualmente. --";
            }
        }
        /**
         * Crea una nueva solicitud en la base de datos
         **/
        public bool GuardarSolicitud(string pEstudiante, int pPeriodo, Solicitud pSolicitud)
        {
            IMetodosEstudiante _metEstudiante = new MetodosEstudiante();
            IMetodosAdministrador _metAdmin = new MetodosAdministrador();
            Periodo _perUltimo = _metAdmin.UltimoPeriodo();

            pSolicitud.Txt_Estado = "PENDIENTE";

            if ((_perUltimo.Fec_Inicio <= pSolicitud.Fec_Creacion) &&
                (_perUltimo.Fec_Fin >= pSolicitud.Fec_Creacion))
            {
                _metEstudiante.GuardarSolicitud(pEstudiante, pPeriodo, pSolicitud);
                return true;
            }
            else
            {
                return false;
            }
        }
コード例 #7
0
 protected void btnAgregarRegla_Click(object sender, EventArgs e)
 {
     //Intento agregar regla al sistema
     IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
     Regla _reglaNueva = new Regla();
     _reglaNueva.Posicion = tblReglas.Rows.Count-1;
     _reglaNueva.Nombre = txtNombreRegla.Text;
     _reglaNueva.StoredProcedure = txtNombreProcedimiento.Text;
     _reglaNueva.Estado = "habilitada";
     bool _resultado = _metAdministrador.AgregarRegla(_reglaNueva);
     if(_resultado)
     {
         lblPopupHeader.Text = "Regla agregada";
         lblPopupBody.Text = "La regla fue agregada exitosamente al sistema.";
         Pop_Alerta.Show();
     }
     else
     {
         lblPopupHeader.Text = "Error al agregar regla";
         lblPopupBody.Text = "Ocurrió un error al intentar agregar la regla al sistema.";
         Pop_Alerta.Show();
     }
     //Page.Response.Redirect(Request.RawUrl);
 }
 /**
  * Devuelve el periodo
  **/
 public Periodo ObtenerPeriodo()
 {
     IMetodosAdministrador _metAdmin = new MetodosAdministrador();
     return _metAdmin.UltimoPeriodo();
 }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                IMetodosEstudiante _metEstudiante = new MetodosEstudiante();
                IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
                Ado.ClasesComunes.Periodo _periodoActual = _metAdministrador.UltimoPeriodo();
                string _carnet = (string)Session["NUsuario"];

                if(_periodoActual != null)
                {

                    #region Pendientes

                    LinkedList<Solicitud> _lisPendientes = _metEstudiante.ObtenerSolicitudesPendientes(_carnet, _periodoActual.Id_Periodo);
                    if (_lisPendientes.Count != 0)
                    {
                        #region Encabezado

                        TableHeaderRow Row_Encabezado = new TableHeaderRow();
                        TableHeaderCell Cel_EncabezadoID = new TableHeaderCell();
                        Cel_EncabezadoID.Text = "Solicitud";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoID);
                        TableHeaderCell Cel_EncabezadoNomCurso = new TableHeaderCell();
                        Cel_EncabezadoNomCurso.Text = "Nombre de Curso";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoNomCurso);
                        TableHeaderCell Cel_EncabezadoFecha = new TableHeaderCell();
                        Cel_EncabezadoFecha.Text = "Recepción";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoFecha);
                        TableHeaderCell Cel_EncabezadoAcciones = new TableHeaderCell();
                        Cel_EncabezadoAcciones.Text = "Acciones";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoAcciones);
                        tblPendientes.Rows.Add(Row_Encabezado);

                        #endregion

                        #region Llenado de tabla

                        foreach (var _solicitud in _lisPendientes)
                        {
                            TableRow Row_Pendientes = new TableRow();

                            TableCell Cel_ID = new TableCell();
                            Cel_ID.Text = _solicitud.Id_Solicitud.ToString();
                            Row_Pendientes.Cells.Add(Cel_ID);

                            TableCell Cel_Curso = new TableCell();
                            Cel_Curso.Text = _solicitud.txt_Curso;
                            Row_Pendientes.Cells.Add(Cel_Curso);

                            TableCell Cel_Fecha = new TableCell();
                            Cel_Fecha.Text = _solicitud.Fec_Creacion.Date.ToString();
                            Row_Pendientes.Cells.Add(Cel_Fecha);

                            TableCell Cel_Acciones = new TableCell();
                            //Agregar las acciones por fila de regla
                            ImageButton btnAnular = new ImageButton(); //-- Incrementar prioridad
                            btnAnular.ImageUrl = "../Images/table_cancel_row.png";
                            btnAnular.Enabled = false;
                            btnAnular.AlternateText = "Anular";
                            btnAnular.ToolTip = "Anular";
                            btnAnular.Click += new ImageClickEventHandler(btnAnular_Click);
                            Cel_Acciones.Controls.Add(btnAnular);

                            Row_Pendientes.Cells.Add(Cel_Acciones);

                            tblPendientes.Rows.Add(Row_Pendientes);
                        }

                        #endregion
                    }
                    else
                    {
                        TableRow Row_SinPendientes = new TableRow();
                        TableCell Cel_SinPendientes = new TableCell();
                        Cel_SinPendientes.Text = "No se encuentran solicitudes pendientes para este periodo";
                        Row_SinPendientes.Cells.Add(Cel_SinPendientes);
                        tblPendientes.Rows.Add(Row_SinPendientes);
                    }

                    #endregion

                    #region Anuladas

                    LinkedList<Solicitud> _lisAnuladas = _metEstudiante.ObtenerSolicitudesAnuladas(_carnet, _periodoActual.Id_Periodo);
                    if (_lisAnuladas.Count != 0)
                    {
                        #region Encabezado

                        TableHeaderRow Row_Encabezado = new TableHeaderRow();
                        TableHeaderCell Cel_EncabezadoID = new TableHeaderCell();
                        Cel_EncabezadoID.Text = "Solicitud";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoID);
                        TableHeaderCell Cel_EncabezadoNomCurso = new TableHeaderCell();
                        Cel_EncabezadoNomCurso.Text = "Nombre de Curso";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoNomCurso);
                        TableHeaderCell Cel_EncabezadoFecha = new TableHeaderCell();
                        Cel_EncabezadoFecha.Text = "Recepción";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoFecha);
                        tblAnuladas.Rows.Add(Row_Encabezado);

                        #endregion

                        #region Llenado de tabla

                        foreach (var _solicitud in _lisAnuladas)
                        {
                            TableRow Row_Anuladas = new TableRow();

                            TableCell Cel_ID = new TableCell();
                            Cel_ID.Text = _solicitud.Id_Solicitud.ToString();
                            Row_Anuladas.Cells.Add(Cel_ID);

                            TableCell Cel_Curso = new TableCell();
                            Cel_Curso.Text = _solicitud.txt_Curso;
                            Row_Anuladas.Cells.Add(Cel_Curso);

                            TableCell Cel_Fecha = new TableCell();
                            Cel_Fecha.Text = _solicitud.Fec_Creacion.Date.ToString();
                            Row_Anuladas.Cells.Add(Cel_Fecha);

                            tblAnuladas.Rows.Add(Row_Anuladas);
                        }

                        #endregion
                    }
                    else
                    {
                        TableRow Row_SinAnuladas = new TableRow();
                        TableCell Cel_SinAnuladas = new TableCell();
                        Cel_SinAnuladas.Text = "No se encuentran solicitudes anuladas para este periodo";
                        Row_SinAnuladas.Cells.Add(Cel_SinAnuladas);
                        tblAnuladas.Rows.Add(Row_SinAnuladas);
                    }

                    #endregion

                    #region Aprobadas

                    LinkedList<Solicitud> _lisAprobadas = _metEstudiante.ObtenerSolicitudesAprobadas(_carnet, _periodoActual.Id_Periodo);
                    if (_lisAprobadas.Count != 0)
                    {
                        #region Encabezado

                        TableHeaderRow Row_Encabezado = new TableHeaderRow();
                        TableHeaderCell Cel_EncabezadoID = new TableHeaderCell();
                        Cel_EncabezadoID.Text = "Solicitud";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoID);
                        TableHeaderCell Cel_EncabezadoNomCurso = new TableHeaderCell();
                        Cel_EncabezadoNomCurso.Text = "Nombre de Curso";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoNomCurso);
                        TableHeaderCell Cel_EncabezadoGrupo = new TableHeaderCell();
                        Cel_EncabezadoGrupo.Text = "Grupo Aceptado";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoGrupo);
                        tblAprobadas.Rows.Add(Row_Encabezado);

                        #endregion

                        #region Llenado de tabla

                        foreach (var _solicitud in _lisAprobadas)
                        {
                            TableRow Row_Aprobadas = new TableRow();

                            TableCell Cel_ID = new TableCell();
                            Cel_ID.Text = _solicitud.Id_Solicitud.ToString();
                            Row_Aprobadas.Cells.Add(Cel_ID);

                            TableCell Cel_Curso = new TableCell();
                            Cel_Curso.Text = _solicitud.txt_Curso;
                            Row_Aprobadas.Cells.Add(Cel_Curso);

                            TableCell Cel_Grupo = new TableCell();
                            LinkedList<Curso> _cursos = _metEstudiante.ObtenerCursosEstudiante(_carnet, null);
                            LinkedList<Grupo> _grupos = new LinkedList<Grupo>();
                            int _idCurso;
                            foreach (var _curso in _cursos)
                            {
                                if (_curso.Txt_Curso.Equals(_solicitud.txt_Curso))
                                {
                                    _idCurso = _curso.Id_Curso;
                                    _grupos = _metEstudiante.ObtenerGruposParaInclusion(_idCurso);
                                }
                            }
                            //LinkedList<Grupo> _grupos = _metEstudiante.ObtenerGruposParaInclusion(_idCurso);
                            foreach (var _grupo in _grupos)
                            {
                                if (_grupo.Id_Grupo.Equals(_solicitud.Id_GrupoAceptado))
                                {
                                    Cel_Grupo.Text = _grupo.Num_Grupo.ToString();
                                }
                            }
                            Row_Aprobadas.Cells.Add(Cel_Grupo);

                            tblAprobadas.Rows.Add(Row_Aprobadas);
                        }

                        #endregion
                    }
                    else
                    {
                        TableRow Row_SinAprobadas = new TableRow();
                        TableCell Cel_SinAprobadas = new TableCell();
                        Cel_SinAprobadas.Text = "No se encuentran solicitudes aprobadas para este periodo";
                        Row_SinAprobadas.Cells.Add(Cel_SinAprobadas);
                        tblAprobadas.Rows.Add(Row_SinAprobadas);
                    }

                    #endregion

                    #region Reprobadas

                    LinkedList<Solicitud> _lisReprobadas = _metEstudiante.ObtenerSolicitudesReprobadas(_carnet, _periodoActual.Id_Periodo);
                    if (_lisReprobadas.Count != 0)
                    {
                        #region Encabezado

                        TableHeaderRow Row_Encabezado = new TableHeaderRow();
                        TableHeaderCell Cel_EncabezadoID = new TableHeaderCell();
                        Cel_EncabezadoID.Text = "Solicitud";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoID);
                        TableHeaderCell Cel_EncabezadoNomCurso = new TableHeaderCell();
                        Cel_EncabezadoNomCurso.Text = "Nombre de Curso";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoNomCurso);
                        TableHeaderCell Cel_EncabezadoMotivo = new TableHeaderCell();
                        Cel_EncabezadoMotivo.Text = "Motivo";
                        Row_Encabezado.Cells.Add(Cel_EncabezadoMotivo);
                        tblReprobadas.Rows.Add(Row_Encabezado);

                        #endregion

                        #region Llenado de tabla

                        foreach (var _solicitud in _lisReprobadas)
                        {
                            TableRow Row_Reprobadas = new TableRow();

                            TableCell Cel_ID = new TableCell();
                            Cel_ID.Text = _solicitud.Id_Solicitud.ToString();
                            Row_Reprobadas.Cells.Add(Cel_ID);

                            TableCell Cel_Curso = new TableCell();
                            Cel_Curso.Text = _solicitud.txt_Curso;
                            Row_Reprobadas.Cells.Add(Cel_Curso);

                            TableCell Cel_Motivo = new TableCell();
                            Cel_Motivo.Text = _solicitud.Txt_Motivo;
                            Row_Reprobadas.Cells.Add(Cel_Motivo);

                            tblReprobadas.Rows.Add(Row_Reprobadas);
                        }

                        #endregion
                    }
                    else
                    {
                        TableRow Row_SinReprobadas = new TableRow();
                        TableCell Cel_SinReprobadas = new TableCell();
                        Cel_SinReprobadas.Text = "No se encuentran solicitudes reprobadas para este periodo";
                        Row_SinReprobadas.Cells.Add(Cel_SinReprobadas);
                        tblReprobadas.Rows.Add(Row_SinReprobadas);
                    }

                    #endregion
                }
                else
                {
                    lblPopupHeader.Text = "Alerta del sistema";
                    lblPopupBody.Text = "No existe un periodo de recepcion de solicitudes definido aún.";
                    Pop_Alerta.Show();
                }

            }
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Obtengo los datos del xml
            IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
            LinkedList<Regla> _lisReglas = _metAdministrador.ObtenerInformacionReglas();
            Session["LISTA_REGLAS"] = _lisReglas;
            if(_lisReglas != null)
            {
                var _lisReglasOrdenadas = _lisReglas.OrderBy(r => r.Posicion);//-- Ordeno la lista por prioridad

                //-- Encabezado de la tabla
                TableHeaderRow Row_Encabezado = new TableHeaderRow();
                TableHeaderCell Cel_EncabezadoNombre = new TableHeaderCell();
                Cel_EncabezadoNombre.Text = "Nombre de Regla";
                Row_Encabezado.Cells.Add(Cel_EncabezadoNombre);
                TableHeaderCell Cel_EncabezadoEstado = new TableHeaderCell();
                Cel_EncabezadoEstado.Text = "Estado";
                Row_Encabezado.Cells.Add(Cel_EncabezadoEstado);
                TableHeaderCell Cel_EncabezadoAcciones = new TableHeaderCell();
                Cel_EncabezadoAcciones.Text = "Acciones";
                Row_Encabezado.Cells.Add(Cel_EncabezadoAcciones);
                tblReglas.Rows.Add(Row_Encabezado);

                //-- Agrego las filas a la tabla

                foreach(var _regla in _lisReglasOrdenadas)
                {
                    TableRow Row_Regla = new TableRow();

                    TableCell Cel_Nombre = new TableCell(); //-- Nombre de regla
                    Cel_Nombre.Text = _regla.Nombre;
                    Row_Regla.Cells.Add(Cel_Nombre);

                    TableCell Cel_Activo = new TableCell();
                    CheckBox chbActivar = new CheckBox(); //-- Activar o desactivar
                    if (_regla.Estado == "habilitada")
                    {
                        chbActivar.Checked = true;
                    }
                    Cel_Activo.Controls.Add(chbActivar);
                    Row_Regla.Cells.Add(Cel_Activo);

                    TableCell Cel_Acciones = new TableCell();
                    //Agregar las acciones por fila de regla
                    ImageButton btnSubir = new ImageButton(); //-- Incrementar prioridad
                    btnSubir.ImageUrl = "../Images/table_move_row_up.png";
                    btnSubir.AlternateText = "Subir";
                    btnSubir.ToolTip = "Subir";
                    btnSubir.Click += new ImageClickEventHandler(btnSubir_Click);
                    Cel_Acciones.Controls.Add(btnSubir);

                    ImageButton btnBajar = new ImageButton(); //-- Decrementar prioridad
                    btnBajar.ImageUrl = "../Images/table_move_row_down.png";
                    btnBajar.AlternateText = "Bajar";
                    btnBajar.ToolTip = "Bajar";
                    btnBajar.Click += new ImageClickEventHandler(btnBajar_Click);
                    Cel_Acciones.Controls.Add(btnBajar);

                    Row_Regla.Cells.Add(Cel_Acciones);
                    tblReglas.Rows.Add(Row_Regla);
                }
            }
            else
            {
                TableRow Row_SinReglas = new TableRow();
                TableCell Cel_SinReglas = new TableCell();
                Cel_SinReglas.Text = "Se ha producido un error y la tabla no ha podido ser llenada";
                Row_SinReglas.Cells.Add(Cel_SinReglas);
                tblReglas.Rows.Add(Row_SinReglas);
            }
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                //Llenado de tabla de excepciones del periodo actual
                IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
                Ado.ClasesComunes.Periodo _periodoActual = _metAdministrador.UltimoPeriodo();
                LinkedList<Excepcion> _lisExcepciones = _metAdministrador.ObtenerListaExcepciones(_periodoActual.Id_Periodo);

                if(_lisExcepciones.Count != 0)
                {
                    #region Encabezado de la tabla

                    TableHeaderRow Row_Encabezado = new TableHeaderRow();
                    TableHeaderCell Cel_EncabezadoEstudiante = new TableHeaderCell();
                    Cel_EncabezadoEstudiante.Text = "Estudiante";
                    Row_Encabezado.Cells.Add(Cel_EncabezadoEstudiante);
                    TableHeaderCell Cel_EncabezadoCurso = new TableHeaderCell();
                    Cel_EncabezadoCurso.Text = "Curso";
                    Row_Encabezado.Cells.Add(Cel_EncabezadoCurso);
                    TableHeaderCell Cel_EncabezadoGrupo = new TableHeaderCell();
                    Cel_EncabezadoGrupo.Text = "Grupo";
                    Row_Encabezado.Cells.Add(Cel_EncabezadoGrupo);
                    TableHeaderCell Cel_EncabezadoAcciones = new TableHeaderCell();
                    Cel_EncabezadoAcciones.Text = "Acciones";
                    Row_Encabezado.Cells.Add(Cel_EncabezadoAcciones);
                    tblExcepciones.Rows.Add(Row_Encabezado);

                    #endregion

                    #region Llenado de tabla
                    //-- Agrego filas a la tabla
                    foreach(var _excepcion in _lisExcepciones)
                    {
                        TableRow Row_Excepcion = new TableRow();

                        TableCell Cel_Estudiante = new TableCell();
                        Cel_Estudiante.Text = _excepcion.Id_Estudiante;
                        Row_Excepcion.Cells.Add(Cel_Estudiante);

                        TableCell Cel_Curso = new TableCell();
                        Cel_Curso.Text = _excepcion.Id_Curso.ToString();
                        Row_Excepcion.Cells.Add(Cel_Curso);

                        TableCell Cel_Grupo = new TableCell();
                        Cel_Grupo.Text = _excepcion.Id_Grupo.ToString();
                        Row_Excepcion.Cells.Add(Cel_Grupo);

                        TableCell Cel_Acciones = new TableCell();
                        ImageButton btnEliminar = new ImageButton();
                        btnEliminar.ImageUrl = "../Images/table_delete_row.png";
                        btnEliminar.AlternateText = "Eliminar";
                        btnEliminar.Enabled = false;
                        btnEliminar.ToolTip = "Eliminar";
                        //btnEliminar.Click += new ImageClickEventHandler(btnEliminar_Click);
                        Cel_Acciones.Controls.Add(btnEliminar);
                        Row_Excepcion.Cells.Add(Cel_Acciones);

                        tblExcepciones.Rows.Add(Row_Excepcion);
                    }
                    #endregion
                }
                else
                {
                    TableRow Row_SinExcepciones = new TableRow();
                    TableCell Cel_SinExcepciones = new TableCell();
                    Cel_SinExcepciones.Text = "No se encuentran excepciones para este periodo";
                    Row_SinExcepciones.Cells.Add(Cel_SinExcepciones);
                    tblExcepciones.Rows.Add(Row_SinExcepciones);
                }

                #region Encuentra cursos y llena el autocomplete
                IMetodosEstudiante _metEstudiante = new MetodosEstudiante();
                LinkedList<Curso> _cursos = new LinkedList<Curso>();
                _cursos = _metEstudiante.ObtenerCursosEstudiante("", null);

                foreach (var _cursoActual in _cursos)
                {
                    ListItem _item = new ListItem();
                    _item.Value = _cursoActual.Id_Curso.ToString();
                    _item.Text = _cursoActual.Txt_Curso;
                    ddlCurso.Items.Add(_item);
                }
                #endregion
            }
        }