public IHttpActionResult ConsultarCompetencia()
        {
            try
            {
                CompetenciaBl oCompetenciaBl = new CompetenciaBl();

                List <ParametrosDTO> ListaParametro = new List <ParametrosDTO>();

                var        Datos       = oCompetenciaBl.ConsultarCompetencias();
                ProgramaBl oProgramaBl = new ProgramaBl();


                foreach (var item in Datos)
                {
                    ParametrosDTO oParametro     = new ParametrosDTO();
                    var           nombrePrograma = oProgramaBl.ConsultarProgramaId(item.IdPrograma);
                    oParametro.Parametro1 = item.IdCompetencia.ToString();
                    oParametro.Parametro2 = nombrePrograma.NombrePrograma;
                    oParametro.Parametro3 = item.Nombre;
                    oParametro.Parametro4 = item.Horas.ToString();
                    oParametro.Parametro5 = item.Codigo.ToString();
                    ListaParametro.Add(oParametro);
                }



                return(Ok(new { datos = ListaParametro, success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
Exemple #2
0
 public IHttpActionResult ConsultarResultados()
 {
     try
     {
         ResultadoBl          oResultadoBl   = new ResultadoBl();
         var                  Datos          = oResultadoBl.ConsultarResultados();
         List <ParametrosDTO> ListaParametro = new List <ParametrosDTO>();
         CompetenciaBl        oCompetenciaBl = new CompetenciaBl();
         foreach (var item in Datos)
         {
             ParametrosDTO oParametro        = new ParametrosDTO();
             var           NombreCompetencia = oCompetenciaBl.ConsultarCompetenciaId(item.IdCompetencia);
             oParametro.Parametro1 = item.IdResultado.ToString();
             oParametro.Parametro2 = NombreCompetencia.Nombre;
             oParametro.Parametro3 = item.Codigo.ToString();
             oParametro.Parametro4 = item.Resultado;
             ListaParametro.Add(oParametro);
         }
         return(Ok(new { datos = ListaParametro, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
 public IHttpActionResult ConsultarCompetenciasxPrograma(ParametrosDTO oParametrosDTO)
 {
     try
     {
         CompetenciaBl oCompetenciaBl = new CompetenciaBl();
         var           competencia    = oCompetenciaBl.ConsultarCompetenciasxPrograma(int.Parse(oParametrosDTO.Parametro1));
         return(Ok(new { success = true, competencia }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
 public IHttpActionResult ConsultarCompetencias1()
 {
     try
     {
         CompetenciaBl oCompetenciaBl = new CompetenciaBl();
         var           Competencias   = oCompetenciaBl.ConsultarCompetencias();
         return(Ok(new { datos = Competencias, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
 public IHttpActionResult ConsultarProgramas()
 {
     try
     {
         CompetenciaBl oCompetenciaBl = new CompetenciaBl();
         var           Datos          = oCompetenciaBl.ConsultarProgramas();
         return(Ok(new { datos = Datos, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { exc, success = false }));
     }
 }
Exemple #6
0
 public IHttpActionResult GetCompetencias(ParametrosDTO oParametrosDTO)
 {
     try
     {
         CompetenciaBl oCompetenciaBl = new CompetenciaBl();
         var           Datos          = oCompetenciaBl.ConsultarCompetenciasxArea(int.Parse(oParametrosDTO.Parametro1));
         return(Ok(new { datos = Datos, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
        public IHttpActionResult ModificarCompetencia(ParametrosDTO oParametro)
        {
            try
            {
                CompetenciaBl oCompetenciaBl = new CompetenciaBl();
                var           Competencia    = oCompetenciaBl.ConsultarCompetenciaId(int.Parse(oParametro.Parametro1));

                return(Ok(new { success = true, Competencia }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
        public IHttpActionResult GuardarModificacionCompetencia(Competencia oCompetencia)
        {
            try
            {
                CompetenciaBl oCompetenciaBl = new CompetenciaBl();

                oCompetenciaBl.ActualizarRegistro(oCompetencia);

                return(Ok(new { success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
        public IHttpActionResult EliminarCompetencia(ParametrosDTO oParametrosDTO)
        {
            try
            {
                CompetenciaBl oCompetenciaBl = new CompetenciaBl();

                foreach (var item in oParametrosDTO.Parametros)
                {
                    oCompetenciaBl.EliminarCompetencia(int.Parse(item.Parametro1));
                }
                return(Ok(new { success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
 public IHttpActionResult GuardarCompetencia(Competencia oCompetencia)
 {
     try
     {
         CompetenciaBl oCompetenciaBl = new CompetenciaBl();
         var           Competencia    = oCompetenciaBl.GuardarCompetencia(oCompetencia);
         if (Competencia == true)
         {
             return(Ok(new { success = true }));
         }
         else
         {
             return(Ok(new { success = false }));
         }
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
        public IHttpActionResult UploadFileResultado()
        {
            try
            {
                //                List<LogResponseDTO> lstErrores = new List<LogResponseDTO>();
                var httpRequest = HttpContext.Current.Request;
                if (httpRequest.Files.Count > 0)
                {
                    var fileSavePath = string.Empty;

                    var docfiles = new List <string>();

                    var URLArchivo = "";

                    foreach (string file in httpRequest.Files)
                    {
                        var postedFile = httpRequest.Files[file];
                        //var filePath = HttpContext.Current.Server.MapPath("~/UploadedFiles/");
                        var filePath = "C:/UploadedFiles/";

                        var GUID = Guid.NewGuid().ToString();

                        if (!Directory.Exists(filePath))
                        {
                            Directory.CreateDirectory(filePath);
                        }

                        fileSavePath = Path.Combine(filePath, GUID + "." + postedFile.FileName.Split('.')[1]);

                        postedFile.SaveAs(fileSavePath);

                        docfiles.Add(filePath);

                        //URLArchivo = "~/UploadedFiles/" + GUID + "." + postedFile.FileName.Split('.')[1];
                        URLArchivo = "C:/UploadedFiles/" + GUID + "." + postedFile.FileName.Split('.')[1];



                        string e = Path.GetExtension(URLArchivo);
                        if (e != ".xlsx")
                        {
                            return(Ok(new { success = false, message = "La extencion del archivo no es valida" }));
                        }
                    }

                    string FilePath = URLArchivo.Split('/')[2];

                    //var reader = new StreamReader(File.OpenRead(HttpContext.Current.Server.MapPath("~/UploadedFiles/") + FilePath), Encoding.GetEncoding(1252));

                    //var reader = new StreamReader(File.OpenRead(("C:/UploadedFiles/") + FilePath), Encoding.GetEncoding(1252));

                    CompetenciaBl         oCompetenciaBl      = new CompetenciaBl();
                    ResultadoBl           oResultadoBl        = new ResultadoBl();
                    Resultado_Aprendizaje oResultado          = new Resultado_Aprendizaje();
                    List <string>         ResultadoNoRegistro = new List <string>();

                    var book      = new ExcelQueryFactory(URLArchivo);
                    var hoja      = book.GetWorksheetNames();
                    var resultado = (from i in book.Worksheet(hoja.FirstOrDefault())
                                     select i).ToList();


                    foreach (var values in resultado)
                    {
                        if (values[0] == "")
                        {
                            break;
                        }


                        var ListaCompetencias = oResultadoBl.ConsultarCompetenciaxCodigo(Convert.ToInt64(values[2]));

                        foreach (var item in ListaCompetencias)
                        {
                            var codigo = oResultadoBl.ConsultarResultadoCodigo(int.Parse(values[0]), item.IdCompetencia);
                            if (codigo == null || codigo.Count == 0)
                            {
                                oResultado.Codigo = int.Parse(values[0]);
                                var Competencia = oCompetenciaBl.ConsultarCompetenciaId(item.IdCompetencia);

                                oResultado.Resultado = values[1];
                                if (Competencia == null)
                                {
                                    ResultadoNoRegistro.Add(values[1]);
                                    continue;
                                }
                                //oResultado.IdCompetencia = oCompetenciaBl.ConsultarCompetenciaId(item.IdCompetencia).IdCompetencia;

                                oResultado.IdCompetencia = Competencia.IdCompetencia;

                                oResultadoBl.GuardarResultado(oResultado);
                            }
                        }
                    }
                    var no = ResultadoNoRegistro;

                    return(Ok(new { success = true, path = URLArchivo }));
                }
                else
                {
                    return(Ok(new { success = false, message = "No File" }));
                }
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, message = exc.Message }));
            }
        }