public int PostRetroInfo(RetroInfoModel retroInfoModel) { var myData = new tbl_trn_retroinfo { retroinfo_name = retroInfoModel.retroinfo_name, retroinfo_projectinfo_id = retroInfoModel.retroinfo_projectinfo_id, retroinfo_sprint = retroInfoModel.retroinfo_sprint, retroinfo_date = DateTime.UtcNow.ToString("yyy-MM-dd"), retroinfo_imagepath = retroInfoModel.retroinfo_imagepath, retroinfo_imageinfo_id = retroInfoModel.retroinfo_imageinfo_id, retroinfo_status = retroInfoModel.retroinfo_status, retroinfo_isdeleted = retroInfoModel.retroinfo_isdeleted, }; var response = this.InsertandSave(myData); return(response.retroinfo_id); }
private Stream GetExcelSheet(DataSet resultdata, RetroInfoModel headerData, string imageData) { using (var package = new ExcelPackage()) { var worksheet = package.Workbook.Worksheets.Add("Retrospective"); worksheet.Cells["A8"].LoadFromDataTable(resultdata.Tables[0], true); worksheet.Cells[2, 2, 2, 2].Value = "Retrospective"; worksheet.Cells[2, 2, 2, 3].Merge = true; worksheet.Cells[2, 2, 2, 2].Style.Font.Bold = true; worksheet.Cells[2, 2, 2, 2].Style.Font.Color.SetColor(Color.White); worksheet.Cells[2, 2, 2, 2].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; var fillRetroTitle = worksheet.Cells[2, 2, 2, 2].Style.Fill; fillRetroTitle.PatternType = ExcelFillStyle.Solid; fillRetroTitle.BackgroundColor.SetColor(Color.Purple); worksheet.Cells[3, 2, 3, 2].Value = "Retro Name"; worksheet.Cells[4, 2, 4, 2].Value = "Project Name"; worksheet.Cells[5, 2, 5, 2].Value = "Sprint"; worksheet.Cells[6, 2, 6, 2].Value = "Date"; worksheet.Cells[3, 3, 3, 3].Value = headerData.retroinfo_name; worksheet.Cells[4, 3, 4, 3].Value = headerData.retroinfo_projectinfo_name; worksheet.Cells[5, 3, 5, 3].Value = headerData.retroinfo_sprint; worksheet.Cells[6, 3, 6, 3].Value = headerData.retroinfo_date; var fillRetroHeader = worksheet.Cells[3, 2, 6, 3].Style.Fill; fillRetroHeader.PatternType = ExcelFillStyle.Solid; fillRetroHeader.BackgroundColor.SetColor(Color.Orange); worksheet.Cells[8, 1, 8, resultdata.Tables[0].Columns.Count].Style.Font.Bold = true; worksheet.Cells[8, 1, 8, resultdata.Tables[0].Columns.Count].Style.Font.Color.SetColor(Color.White); worksheet.Cells[8, 1, 8, resultdata.Tables[0].Columns.Count].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; var fillDataHeader = worksheet.Cells[8, 1, 8, resultdata.Tables[0].Columns.Count].Style.Fill; fillDataHeader.PatternType = ExcelFillStyle.Solid; fillDataHeader.BackgroundColor.SetColor(Color.Purple); for (int i = 1; i <= resultdata.Tables[0].Columns.Count; i++) { var fillRetroDetals = worksheet.Cells[9, i, 8 + resultdata.Tables[0].Rows.Count, i].Style.Fill; fillRetroDetals.PatternType = ExcelFillStyle.Solid; var colColor = resultdata.Tables[1].Rows[i - 1][0].ToString(); var color = ColorTranslator.FromHtml(colColor); fillRetroDetals.BackgroundColor.SetColor(color); } if (imageData != null && imageData != string.Empty) { Bitmap image = LoadImage(imageData); ExcelPicture picture = null; if (image != null) { picture = worksheet.Drawings.AddPicture("picRetro", image); picture.From.Column = resultdata.Tables[0].Columns.Count + 1; picture.From.Row = 2; picture.SetSize(800, 600); } } var stream = new MemoryStream(package.GetAsByteArray()); return(stream); } }
public HttpResponseMessage Post(RetroInfoModel retroInfoModel) { var response = this.retrospectiveInformationService.PostRetroInfo(retroInfoModel); return(Request.CreateResponse(HttpStatusCode.OK, response)); }