public IHttpActionResult ConsultarAmbientesCoordinador(ParametrosDTO oParametrosDTO) { AmbienteBl oAmbienteBl = new AmbienteBl(); var ambiente = oAmbienteBl.ConsultarAmbientesCoordinador(int.Parse(oParametrosDTO.Parametro1)); return(Ok(new { success = true, ambiente })); }
public IHttpActionResult ConsultarAmbientes() { try { AmbienteBl oAmbienteBl = new AmbienteBl(); var Datos = oAmbienteBl.ConsultarAmbientes(); return(Ok(new { success = true, datos = Datos })); } catch (Exception exc) { return(Ok(new { success = false, exc.Message })); } }
public IHttpActionResult ModificarAmbiente(ParametrosDTO oParametro) { try { AmbienteBl oAmbienteBl = new AmbienteBl(); var Ambiente = oAmbienteBl.ConsultarAmbienteId(int.Parse(oParametro.Parametro1)); return(Ok(new { success = true, Ambiente })); } catch (Exception exc) { return(Ok(new { success = false, exc = exc.Message })); } }
public IHttpActionResult GetAmbientes(ParametrosDTO oParametrosDTO) { try { AmbienteBl oAmbienteBl = new AmbienteBl(); var Datos = oAmbienteBl.ConsultarAmbientes(); //var Datos = oAmbienteBl.ConsultarAmbientesxArea1(int.Parse(oParametrosDTO.Parametro1)); return(Ok(new { datos = Datos, success = true })); } catch (Exception exc) { return(Ok(new { success = false, exc = exc.Message })); } }
public IHttpActionResult GuardarModificacionAmbiente(Ambiente oAmbiente) { try { AmbienteBl oAmbienteBl = new AmbienteBl(); oAmbienteBl.ActualizarRegistro(oAmbiente); return(Ok(new { success = true })); } catch (Exception exc) { return(Ok(new { success = false, exc = exc.Message })); } }
public IHttpActionResult ambientesDisponibles(ParametrosDTO oParamaetrosDTO) { try { AmbienteBl oAmbienteBl = new AmbienteBl(); if (oParamaetrosDTO.Parametro6 == "") { oParamaetrosDTO.Parametro6 = "0"; } var Datos = oAmbienteBl.ambientesDisponibles(DateTime.Parse(oParamaetrosDTO.Parametro1), DateTime.Parse(oParamaetrosDTO.Parametro2), oParamaetrosDTO.Parametro3, oParamaetrosDTO.Parametro4, int.Parse(oParamaetrosDTO.Parametro5), int.Parse(oParamaetrosDTO.Parametro6), bool.Parse(oParamaetrosDTO.Parametro7), bool.Parse(oParamaetrosDTO.Parametro8), bool.Parse(oParamaetrosDTO.Parametro9), bool.Parse(oParamaetrosDTO.Parametro10), bool.Parse(oParamaetrosDTO.Parametro11)); return(Ok(new { success = true, datos = Datos })); } catch (Exception exc) { return(Ok(new { success = false, exc.Message })); } }
public IHttpActionResult EliminarAmbiente(ParametrosDTO oParametrosDTO) { try { AmbienteBl oAmbienteBl = new AmbienteBl(); foreach (var item in oParametrosDTO.Parametros) { oAmbienteBl.EliminarAmbiente(int.Parse(item.Parametro1)); } return(Ok(new { success = true })); } catch (Exception exc) { return(Ok(new { success = false, exc = exc.Message })); } }
public IHttpActionResult GuardarAmbiente(Ambiente oAmbiente) { try { AmbienteBl oAmbienteBl = new AmbienteBl(); var Ambiente = oAmbienteBl.GuardarAmbiente(oAmbiente); if (Ambiente == 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 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 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 })); } }