public string SaveRecords(JObject container) { if (container != null) { try { SaveRecordsModel Projecto = container.ToObject <SaveRecordsModel>(); if (Projecto != null) { if (Projecto.ArrAloj != null) { foreach (var item in Projecto.ArrAloj) { Alojamento.Insert(item); } } if (Projecto.ArrVoos != null) { foreach (var item in Projecto.ArrVoos) { Voos.Insert(item); } } if (Projecto.ArrDiarias != null) { foreach (var item in Projecto.ArrDiarias) { Diarias.Insert(item); } } if (Projecto.ArrServicos != null) { foreach (var item in Projecto.ArrServicos) { ServicoTT.Insert(item); } } } return("Ok"); } catch (Exception ex) { return(ex.InnerException.ToString()); } } else { return("no_magic"); } }
public XLWorkbook generateProjectExlReport(JObject container) { if (container != null) { try { SaveRecordsModel Projecto = container.ToObject <SaveRecordsModel>(); var workbook = new XLWorkbook(); var worksheet = workbook.Worksheets.Add("Relatorio"); foreach (var r in Enumerable.Range(1, 5)) { foreach (var c in Enumerable.Range(1, 5)) { worksheet.Cell(r, c).Value = "X"; } } /*if (Projecto.ArrAloj != null) * { * foreach (var item in Projecto.ArrAloj) * { * * * //Alojamento.Insert(item); * } * } * if (Projecto.ArrVoos != null) * { * foreach (var item in Projecto.ArrVoos) * { * //Voos.Insert(item); * } * } * if (Projecto.ArrDiarias != null) * { * foreach (var item in Projecto.ArrDiarias) * { * //Diarias.Insert(item); * } * } * if (Projecto.ArrServicos != null) * { * foreach (var item in Projecto.ArrServicos) * { * //ServicoTT.Insert(item); * } * }*/ return(workbook); } catch (Exception e) { return(null); } } else { return(null); } }