This commit is contained in:
2020-09-22 23:46:34 +00:00
parent 912f58d176
commit 28beeaf783

View File

@@ -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);