示例#1
0
 public IHttpActionResult ConsultarInhabilitados()
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         var          Datos         = oInstructorBl.ConsultarInhabilitados();
         return(Ok(new { datos = Datos, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
示例#2
0
 public IHttpActionResult EnviarProgramacionInstructor(ParametrosDTO oParametrosDTO)
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         var          Programacion  = oInstructorBl.EnviarProgramacionInstructor(DateTime.Parse(oParametrosDTO.Parametro1), DateTime.Parse(oParametrosDTO.Parametro2), int.Parse(oParametrosDTO.Parametro3));
         return(Ok(new { success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
示例#3
0
 public IHttpActionResult EnviarCorreoInstructor()
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         oInstructorBl.EnviarCorreoInstructor();
         return(Ok(new { success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false }));
     }
 }
示例#4
0
 public IHttpActionResult ConsultarInhabilitadosxArea(ParametrosDTO oParametrosDTO)
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         var          Datos         = oInstructorBl.ConsultarInhabilitadosxArea(int.Parse(oParametrosDTO.Parametro1));
         return(Ok(new { datos = Datos, success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
示例#5
0
 public IHttpActionResult ReporteDeProgramacionInstructores(ParametrosDTO oParametrosDTO)
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         var          Datos         = oInstructorBl.ReporteDeProgramacionInstructores(int.Parse(oParametrosDTO.Parametro1), DateTime.Parse(oParametrosDTO.Parametro2), DateTime.Parse(oParametrosDTO.Parametro3));
         var          Horas         = oInstructorBl.ReporteHorasInstructores(int.Parse(oParametrosDTO.Parametro1), DateTime.Parse(oParametrosDTO.Parametro2), DateTime.Parse(oParametrosDTO.Parametro3));
         return(Ok(new { success = true, datos = Datos, Horas }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
示例#6
0
        public IHttpActionResult GuardarModificacionInstructor(Instructor oInstructor)
        {
            try
            {
                InstructorBl oInstructorBl = new InstructorBl();

                oInstructorBl.ActualizarRegistro(oInstructor);

                return(Ok(new { success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
示例#7
0
        public IHttpActionResult consultarCedula(string cedula)
        {
            try
            {
                InstructorBl oInstructorBl = new InstructorBl();

                oInstructorBl.ConsultarInstructorCedula(cedula);

                return(Ok(new { success = true }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
示例#8
0
        public IHttpActionResult ModificarInstructor(Instructor oInstructor)
        {
            try
            {
                InstructorBl oInstructorBl = new InstructorBl();

                var Instructor = oInstructorBl.ConsultarInstructorCedula1(oInstructor.Cedula);

                return(Ok(new { success = true, Instructor }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
示例#9
0
 public IHttpActionResult HabilitarInstructor(List <Instructor> oInstructor)
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         foreach (var item in oInstructor)
         {
             oInstructorBl.CambiarEstado(item);
         }
         return(Ok(new { success = true }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
示例#10
0
 public IHttpActionResult RepoorteHorasInstructores(ParametrosDTO oParametros)
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         if (oParametros.Parametro3 == "")
         {
             oParametros.Parametro3 = "0";
         }
         var ListaIntructores = oInstructorBl.RepoorteHorasInstructores(DateTime.Parse(oParametros.Parametro1), DateTime.Parse(oParametros.Parametro2), int.Parse(oParametros.Parametro3));
         return(Ok(new { success = true, ListaIntructores }));
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc.Message }));
     }
 }
示例#11
0
 public IHttpActionResult GuardarInstructor(Instructor oInstructor)
 {
     try
     {
         InstructorBl oInstructorBl = new InstructorBl();
         var          Instructor    = oInstructorBl.GuardarInstructor(oInstructor);
         if (Instructor == true)
         {
             return(Ok(new { success = true }));
         }
         else
         {
             return(Ok(new { success = false }));
         }
     }
     catch (Exception exc)
     {
         return(Ok(new { success = false, exc = exc.Message }));
     }
 }
示例#12
0
        public IHttpActionResult ModificarInstructor(Instructor oInstructor)
        {
            try
            {
                InstructorBl oInstructorBl = new InstructorBl();
                int          tipo          = 0;
                var          Instructor    = oInstructorBl.ConsultarInstructorCedula1(oInstructor.Cedula);

                if (Instructor.TipoContrato == "CONTRATISTA")
                {
                    tipo = 1;
                }

                return(Ok(new { success = true, Instructor, tipo }));
            }
            catch (Exception exc)
            {
                return(Ok(new { success = false, exc = exc.Message }));
            }
        }
示例#13
0
        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 }));
            }
        }