コード例 #1
0
        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 }));
            }
        }
コード例 #2
0
        public IHttpActionResult ConsultarFichasInactivas()
        {
            try
            {
                FichaBl oFichaBl = new FichaBl();
                List <ParametrosDTO> ListaParametro = new List <ParametrosDTO>();
                var        Datos       = oFichaBl.ConsultarFichasInactivas();
                ProgramaBl oProgramaBl = new ProgramaBl();
                foreach (var item in Datos)
                {
                    ParametrosDTO oParametrosDTO = new ParametrosDTO();
                    var           nombrePrograma = oProgramaBl.ConsultarProgramaId(item.IdPrograma);
                    oParametrosDTO.Parametro1 = item.IdFicha.ToString();
                    oParametrosDTO.Parametro2 = item.Ficha1;
                    oParametrosDTO.Parametro3 = item.NumAprendices.ToString();
                    oParametrosDTO.Parametro4 = item.TipoFormacion.ToString();
                    oParametrosDTO.Parametro5 = item.Estado.ToString();
                    oParametrosDTO.Parametro6 = item.FechaInicio.ToString();
                    oParametrosDTO.Parametro7 = item.FechaFin.ToString();
                    oParametrosDTO.Parametro8 = nombrePrograma.NombrePrograma;
                    oParametrosDTO.Parametro9 = item.Jornada;
                    ListaParametro.Add(oParametrosDTO);
                }

                return(Ok(new { datos = ListaParametro, success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #3
0
        public IHttpActionResult ConsultarFichasxArea(ParametrosDTO oParametrosDTO1)
        {
            try
            {
                FichaBl oFichaBl = new FichaBl();
                List <ParametrosDTO> ListaParametro = new List <ParametrosDTO>();
                var        Datos       = oFichaBl.ConsultarFichasxArea(int.Parse(oParametrosDTO1.Parametro1));
                ProgramaBl oProgramaBl = new ProgramaBl();
                foreach (var item in Datos)
                {
                    ParametrosDTO oParametrosDTO = new ParametrosDTO();
                    var           nombrePrograma = oProgramaBl.ConsultarProgramaId(item.IdPrograma);
                    var           nombre         = new CultureInfo("es-CO", false).TextInfo.ToTitleCase(nombrePrograma.NombrePrograma.ToLower());
                    oParametrosDTO.Parametro1 = item.IdFicha.ToString();
                    oParametrosDTO.Parametro2 = item.Ficha1;
                    oParametrosDTO.Parametro3 = item.NumAprendices.ToString();
                    oParametrosDTO.Parametro4 = new CultureInfo("es-CO", false).TextInfo.ToTitleCase(item.TipoFormacion.ToLower());
                    oParametrosDTO.Parametro5 = item.Estado.ToString();
                    oParametrosDTO.Parametro6 = item.FechaInicio.ToString();
                    oParametrosDTO.Parametro7 = item.FechaFin.ToString();
                    oParametrosDTO.Parametro8 = nombre;
                    oParametrosDTO.Parametro9 = item.Jornada;
                    ListaParametro.Add(oParametrosDTO);
                }

                return(Ok(new { datos = ListaParametro, success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #4
0
ファイル: ProgramaController.cs プロジェクト: 1000VIA/SRA
 public IHttpActionResult GuardarPrograma(Programa oPrograma)
 {
     try
     {
         ProgramaBl oProgramaBl = new ProgramaBl();
         return(Ok(new { success = oProgramaBl.GuardarPrograma(oPrograma) }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
コード例 #5
0
 public IHttpActionResult ConsultarPragamaTransversal()
 {
     try
     {
         ProgramaBl oProgramaBl = new ProgramaBl();
         var        programa    = oProgramaBl.ConsultarPragamaTransversal();
         return(Ok(new { success = true, programa }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
コード例 #6
0
ファイル: ProgramaController.cs プロジェクト: 1000VIA/SRA
 public IHttpActionResult CambiarEstado(Programa oParametros)
 {
     try
     {
         ProgramaBl oProgramaBl = new ProgramaBl();
         oProgramaBl.EliminarPrograma(oParametros.IdPrograma);
         return(Ok(new { success = true, }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
コード例 #7
0
 public IHttpActionResult ConsultarProgramaxArea(ParametrosDTO oParametrosDTO)
 {
     try
     {
         ProgramaBl oProgramaBl = new ProgramaBl();
         var        programa    = oProgramaBl.ConsultarProgramaxArea(int.Parse(oParametrosDTO.Parametro1));
         return(Ok(new { success = true, programa }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
コード例 #8
0
 public IHttpActionResult ConsultarProgramas()
 {
     try
     {
         ProgramaBl oProgramaBl = new ProgramaBl();
         var        Programas   = oProgramaBl.ConsultarProgramas();
         return(Ok(new { success = true, datos = Programas }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
コード例 #9
0
 public IHttpActionResult ProgramasMediaTecnica(ParametrosDTO oParametrosDTO)
 {
     try
     {
         ProgramaBl oProgramaBl = new ProgramaBl();
         var        datos       = oProgramaBl.ProgramasMediaTecnica(int.Parse(oParametrosDTO.Parametro1));
         return(Ok(new { success = true, datos }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc.Message }));
     }
 }
コード例 #10
0
        public IHttpActionResult GuardarModificacionPrograma(Programa oPrograma)
        {
            try
            {
                ProgramaBl oProgramaBl = new ProgramaBl();
                oProgramaBl.ActualizarRegistro(oPrograma);

                return(Ok(new { success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #11
0
        public IHttpActionResult ReporteProgramas(ParametrosDTO oParametros)
        {
            try
            {
                ProgramaBl oProgramaBl = new ProgramaBl();

                var Datos = oProgramaBl.ReporteProgramas(int.Parse(oParametros.Parametro1));

                return(Ok(new { success = true, Datos }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc.Message }));
            }
        }
コード例 #12
0
        public IHttpActionResult ProgramasComplementariosxCoordinacion(ParametrosDTO oParametrosDTO)
        {
            try
            {
                ProgramaBl oProgramaBl = new ProgramaBl();
                var        Datos       = oProgramaBl.ProgramasComplementariosxCoordinacion(int.Parse(oParametrosDTO.Parametro1));
                AreaBl     AreaBl      = new AreaBl();

                return(Ok(new { datos = Datos, success = true }));

                //return Ok(new { datos = Datos, success = true });
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #13
0
        public IHttpActionResult ProgramaVirtualesTitulados(ParametrosDTO oParametrosDTO)
        {
            try
            {
                ProgramaBl oProgramaBl = new ProgramaBl();
                var        Datos       = oProgramaBl.ProgramaVirtualesTitulados(int.Parse(oParametrosDTO.Parametro1));
                AreaBl     AreaBl      = new AreaBl();

                return(Ok(new { datos = Datos, success = true }));

                //return Ok(new { datos = Datos, success = true });
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #14
0
        public IHttpActionResult ConsultarProgramas()
        {
            try
            {
                ProgramaBl oProgramaBl = new ProgramaBl();
                var        Datos       = oProgramaBl.ConsultarProgramas();
                AreaBl     AreaBl      = new AreaBl();

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


                foreach (var item in Datos)
                {
                    ParametrosDTO oParametro = new ParametrosDTO();
                    var           NombreArea = AreaBl.ConsultarAreaId(item.IdArea);
                    oParametro.Parametro1 = item.IdPrograma.ToString();
                    oParametro.Parametro2 = item.CodigoPrograma.ToString();
                    oParametro.Parametro3 = item.Nivel;
                    oParametro.Parametro4 = item.LineaTecnologica;
                    oParametro.Parametro5 = item.Red_Tecnologica;
                    oParametro.Parametro6 = item.Perfil_Instructor;
                    oParametro.Parametro7 = item.Version_Programa.ToString();
                    oParametro.Parametro8 = NombreArea.Nombre.ToString();
                    oParametro.Parametro9 = item.NombrePrograma;

                    ListaParametro.Add(oParametro);
                }



                return(Ok(new { datos = ListaParametro, success = true }));

                //return Ok(new { datos = Datos, success = true });
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #15
0
        public IHttpActionResult EliminarPrograma(ParametrosDTO oParametros)
        {
            try
            {
                bool       Respuesta     = false;
                int        contadorTrue  = 0;
                int        contadorFalse = 0;
                ProgramaBl oProgramaBl   = new ProgramaBl();
                foreach (var item in oParametros.Parametros)
                {
                    Respuesta = oProgramaBl.EliminarPrograma(int.Parse(item.Parametro1));

                    if (Respuesta)
                    {
                        contadorTrue++;
                    }
                }
                return(Ok(new { respuesta = Respuesta, contadorTrue = contadorTrue, contadorFalse = contadorFalse, success = true, }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
コード例 #16
0
        public IHttpActionResult UploadFilePrograma()
        {
            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));

                    Programa      oPrograma          = new Programa();
                    ProgramaBl    oProgramaBl        = new ProgramaBl();
                    List <string> ProgramaNoRegistro = new List <string>();

                    Area   oArea   = new Area();
                    AreaBl oAreaBl = new AreaBl();

                    var book = new ExcelQueryFactory(URLArchivo);

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

                    var contador = 0;


                    foreach (var values in resultado)
                    {
                        if (values[0] == "")
                        {
                            break;
                        }
                        var codigo = oProgramaBl.ConsultarProgramaCodigo(int.Parse(values[0].ToString()));
                        if (codigo != null)
                        {
                            ProgramaNoRegistro.Add(values[1]);
                            continue;
                        }
                        if (codigo == null)
                        {
                            oPrograma.CodigoPrograma    = int.Parse(values[0].ToString());
                            oPrograma.NombrePrograma    = values[1];
                            oPrograma.Nivel             = values[2];
                            oPrograma.LineaTecnologica  = values[3];
                            oPrograma.Red_Tecnologica   = values[4];
                            oPrograma.Perfil_Instructor = values[5];
                            oPrograma.Version_Programa  = double.Parse(values[6]);

                            oPrograma.IdArea = oAreaBl.ConsultarAreaCodigo(int.Parse(values[7])).IdArea;

                            oProgramaBl.GuardarPrograma(oPrograma);
                            contador++;
                        }
                    }

                    var no = ProgramaNoRegistro;
                    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 }));
            }
        }
コード例 #17
0
        public IHttpActionResult UploadFileFicha()
        {
            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));

                    Ficha         oFicha   = new Ficha();
                    FichaBl       oFichaBl = new FichaBl();
                    List <string> idProgramasNoRegistro = new List <string>();

                    ProgramaBl oProgramaBl = new ProgramaBl();

                    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 Programa = oProgramaBl.ConsultarProgramaCodigo(int.Parse(values[0]));

                        if (Programa == null)
                        {
                            idProgramasNoRegistro.Add(values[0]);
                            continue;
                        }
                        oFicha.IdPrograma    = oProgramaBl.ConsultarProgramaCodigo(int.Parse(values[0])).IdPrograma;
                        oFicha.Ficha1        = values[1];
                        oFicha.NumAprendices = int.Parse(values[2]);
                        oFicha.TipoFormacion = values[3].ToString();
                        oFicha.Jornada       = values[6].ToString();

                        if (DateTime.Parse(values[4]) <= DateTime.Parse(values[5]))
                        {
                            oFicha.FechaInicio = DateTime.Parse(values[4]);
                            oFicha.FechaFin    = DateTime.Parse(values[5]);
                        }

                        oFicha.Estado = true;
                        oFichaBl.GuardarFicha(oFicha);
                    }
                    var no = idProgramasNoRegistro;

                    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 }));
            }
        }
コード例 #18
0
ファイル: FileController.cs プロジェクト: 1000VIA/SRA
        public IHttpActionResult UploadFile()
        {
            Model1 entity = new Model1();

            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 = "C:/UploadedFiles/" + GUID + "." + postedFile.FileName.Split('.')[1];


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


                    InstructorBl instructor = new InstructorBl();

                    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)
                    {
                        Instructor oInstructor = new Instructor();
                        var        cedula      = instructor.ConsultarInstructorCedula(values[2]);
                        if (cedula == null)
                        {
                            oInstructor.Nombre   = values[0];
                            oInstructor.Apellido = values[1];
                            oInstructor.Cedula   = values[2];
                            oInstructor.Email    = values[3];
                            oInstructor.Estado   = true;
                            oInstructor.Telefono = values[4];

                            var codigo = int.Parse(values[5]);
                            var area   = (from i in entity.Area
                                          where i.Codigo == codigo
                                          select i).FirstOrDefault();

                            if (values[6].ToString().ToLower() == "contratista")
                            {
                                oInstructor.TipoContrato = "1";
                            }
                            else
                            {
                                oInstructor.TipoContrato = "2";
                            }
                            //oInstructor.IdCompetencia = int.Parse(values[4]);

                            ProgramaBl oProgramaBl = new ProgramaBl();

                            // oListaInstructor.Add(oInstructor);

                            instructor.GuardarInstructor(oInstructor);
                        }
                    }
                    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 }));
            }
        }