public IHttpActionResult ConsultarAreas()
        {
            try
            {
                AreaBl oAreaBl = new AreaBl();
                List <ParametrosDTO> ListaParametros = new List <ParametrosDTO>();
                var            Datos           = oAreaBl.ConsultarAreas();
                CoordinacionBl oCoordinacionBl = new CoordinacionBl();

                foreach (var item in Datos)
                {
                    ParametrosDTO oParametrosDTO = new ParametrosDTO();
                    //var NombreCoordinacion = oCoordinacionBl.ConsultarNombreCoordinacion(item.IdCoordinacion);
                    oParametrosDTO.Parametro1 = item.IdArea.ToString();
                    oParametrosDTO.Parametro2 = item.Codigo.ToString();
                    //oParametrosDTO.Parametro3 = NombreCoordinacion;
                    oParametrosDTO.Parametro4 = item.Nombre;
                    oParametrosDTO.Parametro5 = item.Descripcion;
                    ListaParametros.Add(oParametrosDTO);
                }
                return(Ok(new { datos = ListaParametros, success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
        // GET: Tareas/Edit/5
        public ActionResult Edit(int?id)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                if (id is null)
                {
                    return(RedirectToAction("Index"));
                }
                Tarea   item;
                Usuario usuario;

                usuario = Session["Usuario"] as Usuario;
                item    = TareaBl.Get((int)id);
                if (usuario.PerfilId == 1)
                {
                    ViewBag.ListaDeAreas = AreaBl.GetAll();
                }
                if (usuario.PerfilId == 2)
                {
                    ViewBag.ListaDeAreas = AreaBl.GetAll(usuario.EmpresaId);
                }
                ViewBag.ListaDeEstatusDeLaTarea = EstatusDeLaTareaBl.GetAll();

                return(View(item));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(Area item)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                item.UsuarioId = (Session["Usuario"] as Usuario).Id;
                if (ModelState.IsValid)
                {
                    AreaBl.Add(item);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();
                    return(View(item));
                }
            }
            catch
            {
                return(View());
            }
        }
        public IHttpActionResult EliminarArea(ParametrosDTO oParametrosDTO)
        {
            try
            {
                bool   Respuesta     = false;
                int    contadorTrue  = 0;
                int    contadorFalse = 0;
                AreaBl oAreaBl       = new AreaBl();
                foreach (var item in oParametrosDTO.Parametros)
                {
                    Respuesta = oAreaBl.EliminarArea(int.Parse(item.Parametro1));

                    if (Respuesta)
                    {
                        contadorTrue++;
                    }
                    else
                    {
                        contadorFalse++;
                    }
                }
                return(Ok(new { respuesta = Respuesta, contadorTrue = contadorTrue, contadorFalse = contadorFalse, success = true, }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
        public ActionResult Edit(Area area)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                if (ModelState.IsValid)
                {
                    AreaBl.Update(area);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();
                    return(View(area));
                }
            }
            catch
            {
                return(View());
            }
        }
        // GET: Areas
        public ActionResult Index()
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            List <Area> lista;

            lista = AreaBl.GetAll();

            return(View(lista));
        }
 public IHttpActionResult ConsultarCoordinaciones()
 {
     try
     {
         AreaBl oAreaBl      = new AreaBl();
         var    Coordinacion = oAreaBl.ConsultarCoordinaciones();
         return(Ok(new { success = true, coordinacion = Coordinacion }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
 public IHttpActionResult ConsultarNombreArea(int id)
 {
     try
     {
         AreaBl oAreaBl = new AreaBl();
         var    nombre  = oAreaBl.ConsultarNombreArea(id);
         return(Ok(new { success = true, nombre }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
 public IHttpActionResult ConsultarAreas()
 {
     try
     {
         AreaBl oAreaBl = new AreaBl();
         var    Datos   = oAreaBl.ConsultarAreas();
         return(Ok(new { datos = Datos, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
        public IHttpActionResult GuardarModificacionArea(Area oArea)
        {
            try
            {
                AreaBl oAreaBl = new AreaBl();
                oAreaBl.ActualizarRegistro(oArea);

                return(Ok(new { success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
        public IHttpActionResult ModificarArea(ParametrosDTO oParametrosDTO)
        {
            try
            {
                AreaBl oAreaBl = new AreaBl();
                var    Area    = oAreaBl.ConsultarAreaId(int.Parse(oParametrosDTO.Parametro1));

                return(Ok(new { success = true, Area }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
Beispiel #12
0
        // GET: UsuariosEnTarea/AddUserToTask/{tareaId}
        public ActionResult AddUserToTask(int id)
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            List <Usuario> lista;
            Tarea          tarea;
            Area           area;

            tarea           = TareaBl.Get(id);
            area            = AreaBl.Get(tarea.AreaId);
            lista           = UsuarioBl.GetAllByEmpresaId(area.EmpresaId);
            ViewBag.TareaId = id;

            return(View(lista));
        }
Beispiel #13
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 }));
            }
        }
Beispiel #14
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 }));
            }
        }
        // GET: Areas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id is null)
            {
                return(RedirectToAction("Index"));
            }

            Area item;

            item = AreaBl.Get((int)id);
            ViewBag.ListaDeEmpresas = EmpresaBl.GetAll();

            return(View(item));
        }
        public ActionResult Delete(Area area)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                AreaBl.Delete(area);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 public IHttpActionResult GuardarArea(Area oArea)
 {
     try
     {
         AreaBl oAreaBl = new AreaBl();
         var    Area    = oAreaBl.GuardarArea(oArea);
         if (Area == true)
         {
             return(Ok(new { success = true }));
         }
         else
         {
             return(Ok(new { success = false }));
         }
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
        // GET: Tareas/Create
        public ActionResult Create()
        {
            if (Session["Usuario"] is null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            Usuario usuario;

            usuario = Session["Usuario"] as Usuario;

            if (usuario.PerfilId == 1)
            {
                ViewBag.ListaDeAreas = AreaBl.GetAll();
            }
            if (usuario.PerfilId == 2)
            {
                ViewBag.ListaDeAreas = AreaBl.GetAll(usuario.EmpresaId);
            }

            return(View());
        }
Beispiel #19
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 }));
            }
        }
        public ActionResult Create(Tarea item)
        {
            try
            {
                if (Session["Usuario"] is null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                Usuario usuario;

                usuario = Session["Usuario"] as Usuario;

                item.UsuarioId = usuario.Id;
                if (ModelState.IsValid)
                {
                    item.Id = TareaBl.Add(item);
                    return(RedirectToAction($"Details/{item.Id}"));
                }
                else
                {
                    if (usuario.PerfilId == 1)
                    {
                        ViewBag.ListaDeAreas = AreaBl.GetAll();
                    }
                    if (usuario.PerfilId == 2)
                    {
                        ViewBag.ListaDeAreas = AreaBl.GetAll(usuario.EmpresaId);
                    }

                    return(View(item));
                }
            }
            catch
            {
                return(View());
            }
        }
        public IHttpActionResult ConsultarAmbientesColegios()
        {
            try
            {
                AmbienteBl oAmbienteBl = new AmbienteBl();

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

                var    Datos   = oAmbienteBl.ConsultarAmbientesColegios();
                AreaBl oAreaBl = new AreaBl();
                SedeBl oSedeBl = new SedeBl();

                foreach (var item in Datos)
                {
                    ParametrosDTO oParametro = new ParametrosDTO();
                    var           nombreArea = oAreaBl.ConsultarNombreArea(item.IdArea);
                    var           NombreSede = oSedeBl.ConsultarSedeId(item.IdSede);
                    oParametro.Parametro1  = item.IdAmbiente.ToString();
                    oParametro.Parametro2  = nombreArea;
                    oParametro.Parametro3  = item.Numero;
                    oParametro.Parametro4  = item.NumeroEquipos.ToString();
                    oParametro.Parametro5  = item.IdArea.ToString();
                    oParametro.Parametro6  = item.Pantalla.ToString();
                    oParametro.Parametro7  = item.Piso.ToString();
                    oParametro.Parametro8  = NombreSede.Nombre_Sede;
                    oParametro.Parametro9  = item.NumeroMesas.ToString();
                    oParametro.Parametro10 = item.NumeroSillas.ToString();
                    ListaParametro.Add(oParametro);
                }
                return(Ok(new { datos = ListaParametro, success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
        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")
                        {
                            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();
                            oInstructor.IdArea = area.IdArea;
                            if (values[7].ToString().ToLower() == "transversal")
                            {
                                oInstructor.TipoInstructor = 2;
                            }
                            else
                            {
                                oInstructor.TipoInstructor = 1;
                            }

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

                            ProgramaBl oProgramaBl = new ProgramaBl();
                            AreaBl     oAreaBl     = new AreaBl();

                            // var idProgrma = oProgramaBl.ConsultarProgramaCodigo(int.Parse(values[5]));
                            var idArea = oAreaBl.ConsultarAreaCodigo(int.Parse(values[5]));

                            oInstructor.IdArea = idArea.IdArea;

                            // 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 }));
            }
        }
        public IHttpActionResult UploadFileSede()
        {
            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));

                    Sede   oSede   = new Sede();
                    SedeBl oSedeBl = new SedeBl();

                    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();

                    foreach (var values in resultado)
                    {
                        if (values[0] == "")
                        {
                            break;
                        }
                        var codigo = oSedeBl.ConsultarSedeCodigo(int.Parse(values[0]));
                        if (codigo == null)
                        {
                            oSede.Codigo      = int.Parse(values[0]);
                            oSede.Nombre_Sede = values[1];
                            oSede.Direccion   = values[2];

                            var municipio = oSedeBl.ConsultarMunicipioxNombre(values[4].ToString().ToUpper(), values[3]);
                            if (municipio != null)
                            {
                                oSede.IdMunicipio = municipio.IdMunicipio;
                            }
                            else
                            {
                                continue;
                            }

                            if (values[5].ToString().ToUpper() == "Normal")
                            {
                                oSede.TipoSede = 1;
                            }
                            else if (values[5].ToString().ToUpper() == "Empresa")
                            {
                                oSede.TipoSede = 2;
                            }
                            else if (values[5].ToString().ToUpper() == "Colegio")
                            {
                                oSede.TipoSede = 3;
                            }
                            else if (values[5].ToString().ToUpper() == "Virtual")
                            {
                                oSede.TipoSede = 4;
                            }



                            oSedeBl.GuardarSede(oSede);
                        }
                    }


                    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 }));
            }
        }
        public IHttpActionResult UploadFileAmbiente()
        {
            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));

                    Ambiente   oAmbiente   = new Ambiente();
                    AmbienteBl oAmbienteBl = new AmbienteBl();

                    SedeBl oSedeBl = new SedeBl();
                    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();

                    foreach (var values in resultado)
                    {
                        oAmbiente.IdSede        = oSedeBl.ConsultarSedeCodigo(int.Parse(values[0])).IdSede;
                        oAmbiente.IdArea        = oAreaBl.ConsultarAreaCodigo(int.Parse(values[1])).IdArea;
                        oAmbiente.Piso          = int.Parse(values[2]);
                        oAmbiente.Numero        = values[3];
                        oAmbiente.NumeroEquipos = int.Parse(values[4]);
                        oAmbiente.NumeroMesas   = int.Parse(values[5]);
                        oAmbiente.NumeroSillas  = int.Parse(values[6]);

                        if (values[7].ToString().ToLower() == "si" || values[7].ToString().ToLower() == "SI")
                        {
                            oAmbiente.Pantalla = true;
                        }
                        else
                        {
                            oAmbiente.Pantalla = false;
                        }


                        oAmbienteBl.GuardarAmbiente(oAmbiente);
                    }

                    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 }));
            }
        }
        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 }));
            }
        }