This commit is contained in:
@@ -97,7 +97,10 @@ namespace AyaNova.Biz
|
|||||||
internal async Task<bool> ImportAsync(JObject o)
|
internal async Task<bool> ImportAsync(JObject o)
|
||||||
{
|
{
|
||||||
|
|
||||||
Report newObject = new Report();
|
//Report newObject = new Report();
|
||||||
|
var newObject = o.ToObject<Report>();
|
||||||
|
|
||||||
|
|
||||||
var proposedName = (string)o["Name"];
|
var proposedName = (string)o["Name"];
|
||||||
string newUniqueName = proposedName;
|
string newUniqueName = proposedName;
|
||||||
bool NotUnique = true;
|
bool NotUnique = true;
|
||||||
@@ -111,15 +114,35 @@ namespace AyaNova.Biz
|
|||||||
} while (NotUnique);
|
} while (NotUnique);
|
||||||
|
|
||||||
newObject.Name = newUniqueName;
|
newObject.Name = newUniqueName;
|
||||||
newObject.Active = (bool)o["Active"];
|
// This was stupid considering JObject can serialize directly to a report type
|
||||||
newObject.JsHelpers = (string)o["JsHelpers"];
|
//but leaving in for a little while just to be sure it's all good
|
||||||
newObject.JsPrerender = (string)o["JsPrerender"];
|
|
||||||
newObject.Notes = (string)o["Notes"];
|
// newObject.Active = (bool)o["Active"];
|
||||||
newObject.ObjectType = (AyaType)(int)o["ObjectType"];
|
// newObject.JsHelpers = (string)o["JsHelpers"];
|
||||||
newObject.RenderType = (ReportRenderType)(int)o["RenderType"];
|
// newObject.JsPrerender = (string)o["JsPrerender"];
|
||||||
newObject.Roles = (AuthorizationRoles)(int)o["Roles"];
|
// newObject.Notes = (string)o["Notes"];
|
||||||
newObject.Style = (string)o["Style"];
|
// newObject.ObjectType = (AyaType)(int)o["ObjectType"];
|
||||||
newObject.Template = (string)o["Template"];
|
// newObject.RenderType = (ReportRenderType)(int)o["RenderType"];
|
||||||
|
// newObject.Roles = (AuthorizationRoles)(int)o["Roles"];
|
||||||
|
// newObject.Style = (string)o["Style"];
|
||||||
|
// newObject.Template = (string)o["Template"];
|
||||||
|
// //pdf options
|
||||||
|
// newObject.HeaderTemplate = (string)o["HeaderTemplate"];
|
||||||
|
// newObject.FooterTemplate = (string)o["FooterTemplate"];
|
||||||
|
// newObject.MarginOptionsBottom = (string)o["MarginOptionsBottom"];
|
||||||
|
// newObject.MarginOptionsLeft = (string)o["MarginOptionsLeft"];
|
||||||
|
// newObject.MarginOptionsRight = (string)o["MarginOptionsRight"];
|
||||||
|
// newObject.MarginOptionsTop = (string)o["MarginOptionsTop"];
|
||||||
|
// newObject.PageRanges = (string)o["PageRanges"];
|
||||||
|
|
||||||
|
// newObject.PaperFormat = (ReportPaperFormat)(int)o["PaperFormat"];
|
||||||
|
// newObject.DisplayHeaderFooter = (bool)o["DisplayHeaderFooter"];
|
||||||
|
// newObject.Landscape = (bool)o["Landscape"];
|
||||||
|
// newObject.PreferCSSPageSize = (bool)o["PreferCSSPageSize"];
|
||||||
|
// newObject.PrintBackground = (bool)o["PrintBackground"];
|
||||||
|
// newObject.Scale = (decimal)o["Scale"];
|
||||||
|
|
||||||
|
|
||||||
await ValidateAsync(newObject, null);
|
await ValidateAsync(newObject, null);
|
||||||
if (HasErrors) return false;
|
if (HasErrors) return false;
|
||||||
await ct.Report.AddAsync(newObject);
|
await ct.Report.AddAsync(newObject);
|
||||||
@@ -185,7 +208,7 @@ namespace AyaNova.Biz
|
|||||||
Report dbObject = await ct.Report.SingleOrDefaultAsync(z => z.Id == id);
|
Report dbObject = await ct.Report.SingleOrDefaultAsync(z => z.Id == id);
|
||||||
ValidateCanDelete(dbObject);
|
ValidateCanDelete(dbObject);
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
return false;
|
return false;
|
||||||
ct.Report.Remove(dbObject);
|
ct.Report.Remove(dbObject);
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct);
|
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct);
|
||||||
@@ -574,22 +597,22 @@ namespace AyaNova.Biz
|
|||||||
if (!string.IsNullOrWhiteSpace(report.MarginOptionsBottom))
|
if (!string.IsNullOrWhiteSpace(report.MarginOptionsBottom))
|
||||||
PdfOptions.MarginOptions.Bottom = report.MarginOptionsBottom;
|
PdfOptions.MarginOptions.Bottom = report.MarginOptionsBottom;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(report.MarginOptionsLeft))
|
if (!string.IsNullOrWhiteSpace(report.MarginOptionsLeft))
|
||||||
PdfOptions.MarginOptions.Left = report.MarginOptionsLeft;
|
PdfOptions.MarginOptions.Left = report.MarginOptionsLeft;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(report.MarginOptionsRight))
|
if (!string.IsNullOrWhiteSpace(report.MarginOptionsRight))
|
||||||
PdfOptions.MarginOptions.Right = report.MarginOptionsRight;
|
PdfOptions.MarginOptions.Right = report.MarginOptionsRight;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(report.MarginOptionsTop))
|
if (!string.IsNullOrWhiteSpace(report.MarginOptionsTop))
|
||||||
PdfOptions.MarginOptions.Top = report.MarginOptionsTop;
|
PdfOptions.MarginOptions.Top = report.MarginOptionsTop;
|
||||||
|
|
||||||
//holding this back until figure it out
|
//holding this back until figure it out
|
||||||
//it's not really a report property, but a print time / render property
|
//it's not really a report property, but a print time / render property
|
||||||
//PdfOptions.PageRanges=report.PageRanges;
|
//PdfOptions.PageRanges=report.PageRanges;
|
||||||
|
|
||||||
PdfOptions.PreferCSSPageSize=report.PreferCSSPageSize;
|
PdfOptions.PreferCSSPageSize = report.PreferCSSPageSize;
|
||||||
PdfOptions.PrintBackground=report.PrintBackground;
|
PdfOptions.PrintBackground = report.PrintBackground;
|
||||||
PdfOptions.Scale=report.Scale;
|
PdfOptions.Scale = report.Scale;
|
||||||
|
|
||||||
//render to pdf and return
|
//render to pdf and return
|
||||||
log.LogDebug($"Calling render page contents to PDF");
|
log.LogDebug($"Calling render page contents to PDF");
|
||||||
|
|||||||
Reference in New Issue
Block a user