public string ConsultaPeriodos(PeriodosModel model)
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }
            model.sesion = sesion;

            string        ClaveCiclo = Request.Params["ClaveCiclo"];
            StringBuilder sb         = new StringBuilder();

            foreach (string str in model.ConsultaPeriodos(ClaveCiclo))
            {
                sb.Append("<option value=\"").Append(str).Append("\">").Append(str).Append("</option>\n");
            }
            return(sb.ToString());
        }
Exemplo n.º 2
0
        public Periodos CargarDatosNuevos(PeriodosModel periodo)
        {
            Periodos t = new Periodos();

            t.Numero       = periodo.Numero;
            t.FechaInicial = periodo.FechaInicial;
            t.FechaFinal   = periodo.FechaFinal;
            if (periodo.activo)
            {
                t.activo = "Si";
            }
            else
            {
                t.activo = "No";
            }


            return(t);
        }
Exemplo n.º 3
0
        public IHttpActionResult GetPeriodos(string id)
        {
            try
            {
                List <PeriodosModel> periodos = new List <PeriodosModel>();
                List <Periodos>      data     = db.obtenerPeriodosFiltrado(id);
                string resp = validaciones.validarcodigoPeriodo(id);

                if (resp.Equals("1"))
                {
                    if (data.Count > 0)
                    {
                        foreach (Periodos periodo in data)
                        {
                            PeriodosModel temp = new PeriodosModel();
                            temp.Numero       = periodo.Numero;
                            temp.FechaInicial = periodo.FechaInicio;
                            temp.FechaFinal   = periodo.FechaFinal;
                            temp.activo       = periodo.activo;

                            periodos.Add(temp);
                        }

                        return(Ok(periodos));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                else
                {
                    throw new Exception(resp);
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        // GET: Direcciones/Colonias
        public string Periodos(string id_ciclo = "", string Periodo = "")
        {
            PeriodosModel model = new PeriodosModel();

            SessionDB sesion = SessionDB.start(Request, Response, false, model.db, SESSION_BEHAVIOR.AJAX);

            if (sesion == null)
            {
                return("");
            }

            StringBuilder sb       = new StringBuilder();
            string        selected = "";

            sb.Append("<option value=\"\"></option>");
            foreach (string periodo in model.getPeriodos(id_ciclo))
            {
                selected = (periodo == Periodo) ? "selected" : "";
                sb.Append("<option value=\"").Append(periodo).Append("\" ").Append(selected).Append(">").Append(periodo).Append("</option>\n");
                selected = "";
            }
            return(sb.ToString());
        }
Exemplo n.º 5
0
        // GET: api/Periodos
        public List <PeriodosModel> GetPeriodos()
        {
            try
            {
                List <PeriodosModel> periodos = new List <PeriodosModel>();
                List <Periodos>      data     = db.obtenerPeriodo();
                foreach (Periodos periodo in data)
                {
                    PeriodosModel temp = new PeriodosModel();
                    temp.Numero       = periodo.Numero;
                    temp.FechaInicial = periodo.FechaInicio;
                    temp.FechaFinal   = periodo.FechaFinal;
                    temp.activo       = periodo.activo;

                    periodos.Add(temp);
                }

                return(periodos);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }