public BE_Json GetProgramationByFilters(int month, int headquartersId, int dietId) { BE_Json objJson = null; var objListaAux = string.Empty; try { BL_Programation bL_Programation = new BL_Programation(); bL_Programation.connectionString = AppConfig.DbConnection; objListaAux = JsonConvert.SerializeObject(bL_Programation.GetProgramationByFilters(month, headquartersId, dietId)); objJson = new BE_Json(); objJson.data = objListaAux; objJson.status = CManager.RESULTADO_WCF.OK; } catch (Exception ex) { objJson = new BE_Json(); objJson.data = "Hubo en error en servidor:" + ex.Message + ";" + ex.StackTrace + ";" + ex.ToString(); objJson.status = CManager.RESULTADO_WCF.ERROR; objJson.status = CManager.RESULTADO_WCF.ERROR; } finally { objListaAux = null; } return(objJson); }
public BE_Json UpdateProgramation([FromBody] BE_Programation bE_Programation) { BE_Json objJson = null; var objListaAux = string.Empty; try { BL_Programation bL_Programation = new BL_Programation(); bL_Programation.connectionString = AppConfig.DbConnection; objListaAux = JsonConvert.SerializeObject(bL_Programation.UpdateProgramation(bE_Programation)); objJson = new BE_Json(); objJson.data = objListaAux; objJson.status = CManager.RESULTADO_WCF.OK; } catch (Exception ex) { objJson = new BE_Json(); objJson.data = "Hubo en error en servidor:" + ex.Message + ";" + ex.StackTrace + ";" + ex.ToString(); objJson.status = CManager.RESULTADO_WCF.ERROR; objJson.status = CManager.RESULTADO_WCF.ERROR; } finally { objListaAux = null; } return(objJson); }
public BE_Json GetProgramationDetailByDateAndFeedingTimeId(DateTime date, int feedingTime) { BE_Json objJson = null; var objListaAux = string.Empty; try { BL_Programation bL_Programation = new BL_Programation(); bL_Programation.connectionString = AppConfig.DbConnection; objListaAux = JsonConvert.SerializeObject(bL_Programation.GetProgramationDetailByDateAndFeedingTimeId(date, feedingTime)); objJson = new BE_Json(); objJson.data = objListaAux; objJson.status = CManager.RESULTADO_WCF.OK; } catch (Exception ex) { objJson = new BE_Json(); objJson.data = "Hubo en error en servidor:" + ex.Message + ";" + ex.StackTrace + ";" + ex.ToString(); objJson.status = CManager.RESULTADO_WCF.ERROR; objJson.status = CManager.RESULTADO_WCF.ERROR; } finally { objListaAux = null; } return(objJson); }
public HttpResponseMessage ProgramationByWeekPdf(int year, int month, int headquartersId, int dietId, string userName, int week) { BL_Programation bL_Programation = new BL_Programation(); bL_Programation.connectionString = AppConfig.DbConnection; var date = DateTime.Now.ToString(BE.n.util.CustomeDateFormat()); var OutputPath = "reporte" + date + ".pdf"; var html = bL_Programation.GetPdfDataByWeek(year, month, headquartersId, dietId, userName, week); StringReader sr = new StringReader(html); HttpResponseMessage response = new HttpResponseMessage(); Document pdfDoc = new Document(PageSize.A4.Rotate(), 10f, 10f, 10f, 0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); using (MemoryStream memoryStream = new MemoryStream()) { PdfWriter writer = PdfWriter.GetInstance(pdfDoc, memoryStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); response.StatusCode = HttpStatusCode.OK; response.Content = new ByteArrayContent(memoryStream.ToArray()); response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment") { FileName = OutputPath }; return(response); } }
public HttpResponseMessage exportExcel(int year, int month, int headquartersId, int dietId, string userName) { BL_Programation bL_Programation = new BL_Programation(); bL_Programation.connectionString = AppConfig.DbConnection; var date = DateTime.Now.ToString(BE.n.util.CustomeDateFormat()); var OutputPath = "reporte" + date + ".xlsx"; var ms = bL_Programation.GetExcelData(year, month, headquartersId, dietId, userName); HttpResponseMessage response = new HttpResponseMessage(); response.StatusCode = HttpStatusCode.OK; response.Content = new StreamContent(ms); response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment") { FileName = OutputPath }; return(response); }