|
@@ -39,7 +39,7 @@ public class Report
|
|
|
|
|
|
}}";
|
|
|
|
|
|
- private ReportTemplate SelectedTemplate;
|
|
|
+ private ReportTemplate? SelectedTemplate;
|
|
|
|
|
|
public ReportGrid()
|
|
|
{
|
|
@@ -63,7 +63,7 @@ public class Report
|
|
|
|
|
|
public bool Populate { get; set; }
|
|
|
|
|
|
- private bool ScriptClick(CoreRow arg)
|
|
|
+ private bool ScriptClick(CoreRow? arg)
|
|
|
{
|
|
|
if (arg != null)
|
|
|
{
|
|
@@ -83,7 +83,7 @@ public class Report
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- private BitmapImage ScriptImage(CoreRow arg)
|
|
|
+ private BitmapImage? ScriptImage(CoreRow? arg)
|
|
|
{
|
|
|
return arg == null ? Properties.Resources.edit.AsBitmapImage() :
|
|
|
arg.Get<ReportTemplate, bool>(x => x.IsRDL) ? null : Properties.Resources.edit.AsBitmapImage();
|
|
@@ -102,8 +102,8 @@ public class Report
|
|
|
return columns;
|
|
|
}
|
|
|
|
|
|
- protected override void Reload(Filters<ReportTemplate> criteria, Columns<ReportTemplate> columns, ref SortOrder<ReportTemplate> sort,
|
|
|
- Action<CoreTable, Exception> action)
|
|
|
+ protected override void Reload(Filters<ReportTemplate> criteria, Columns<ReportTemplate> columns, ref SortOrder<ReportTemplate>? sort,
|
|
|
+ Action<CoreTable?, Exception?> action)
|
|
|
{
|
|
|
criteria.Add(new Filter<ReportTemplate>(x => x.DataModel).IsEqualTo(DataModel.Name).And(x => x.Section).IsEqualTo(Section));
|
|
|
base.Reload(criteria, columns, ref sort, action);
|
|
@@ -118,15 +118,22 @@ public class Report
|
|
|
return bOK;
|
|
|
}
|
|
|
|
|
|
- private DynamicGridColumns Editor_OnDefineGridColumns(object sender, DynamicGridColumns master)
|
|
|
+ private DynamicGridColumns Editor_OnDefineGridColumns(object sender, DynamicGridColumns? master)
|
|
|
{
|
|
|
return LoadColumns();
|
|
|
}
|
|
|
|
|
|
- private bool ExportClick(CoreRow row)
|
|
|
+ private bool ExportClick(CoreRow? row)
|
|
|
{
|
|
|
+ if (row is null) return false;
|
|
|
+
|
|
|
var id = row.Get<ReportTemplate, Guid>(x => x.ID);
|
|
|
SelectedTemplate = new Client<ReportTemplate>().Load(new Filter<ReportTemplate>(x => x.ID).IsEqualTo(id)).FirstOrDefault();
|
|
|
+ if(SelectedTemplate is null)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, "", $"Report Template {id} does not exist!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
var dlg = new SaveFileDialog
|
|
|
{
|
|
|
Filter = "RDL Files|*.rdl"
|
|
@@ -136,8 +143,10 @@ public class Report
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- private bool ImportClick(CoreRow row)
|
|
|
+ private bool ImportClick(CoreRow? row)
|
|
|
{
|
|
|
+ if (row is null) return false;
|
|
|
+
|
|
|
var id = row.Get<ReportTemplate, Guid>(x => x.ID);
|
|
|
|
|
|
var dlg = new OpenFileDialog
|
|
@@ -147,6 +156,11 @@ public class Report
|
|
|
if (dlg.ShowDialog() == true)
|
|
|
{
|
|
|
SelectedTemplate = new Client<ReportTemplate>().Load(new Filter<ReportTemplate>(x => x.ID).IsEqualTo(id)).FirstOrDefault();
|
|
|
+ if (SelectedTemplate is null)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, "", $"Report Template {id} does not exist!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
SelectedTemplate.RDL = File.ReadAllText(dlg.FileName);
|
|
|
new Client<ReportTemplate>().Save(SelectedTemplate, "Imported from " + dlg.FileName);
|
|
|
}
|
|
@@ -154,10 +168,17 @@ public class Report
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- private bool DesignClick(CoreRow row)
|
|
|
+ private bool DesignClick(CoreRow? row)
|
|
|
{
|
|
|
+ if (row is null) return false;
|
|
|
+
|
|
|
var id = row.Get<ReportTemplate, Guid>(x => x.ID);
|
|
|
SelectedTemplate = new Client<ReportTemplate>().Load(new Filter<ReportTemplate>(x => x.ID).IsEqualTo(id)).FirstOrDefault();
|
|
|
+ if (SelectedTemplate is null)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, "", $"Report Template {id} does not exist!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
ReportUtils.DesignReport(SelectedTemplate, DataModel, Populate);
|
|
|
return false;
|
|
|
}
|
|
@@ -171,7 +192,7 @@ public class Report
|
|
|
return template;
|
|
|
}
|
|
|
|
|
|
- private void ReportGrid_OnAddItem(object sender, object item)
|
|
|
+ /*private void ReportGrid_OnAddItem(object sender, object item)
|
|
|
{
|
|
|
SelectedTemplate = (ReportTemplate)item;
|
|
|
SelectedTemplate.DataModel = DataModel.Name;
|
|
@@ -189,6 +210,6 @@ public class Report
|
|
|
{
|
|
|
client.Save(SelectedTemplate, "Report Saved from Designer");
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
}
|