public static void ExportToExcel() { var visitedAttrs = new List <string>(); var csvFile = new CSVFile() { FileName = "OptionsReport.csv" }; foreach (var en in App.MigEntities) { foreach (var attr in en.OptionAttributes) { var visitedBloc = csvFile.Blocs.Where(b => b.AttributeName == attr.Name).FirstOrDefault(); if (visitedBloc != null) { visitedBloc.EntityName += "," + en.LogicalName; continue; } var bloc = new CSVBloc() { EntityName = en.LogicalName, AttributeName = attr.Name }; csvFile.Blocs.Add(bloc); if (attr.LeftOnlyOptions.Count > 0 || attr.RightOnlyOptions.Count > 0) { if (attr.CommonOptions.Count == 2 && (attr.CommonOptions[0].Name == "Yes" || attr.CommonOptions[0].Name == "No")) { continue; } if (attr.Name == "statecode" || attr.Name == "statuscode") { continue; } foreach (var o in attr.CommonOptions) { bloc.AddRow(new string[] { o.Value.ToString(), o.Name, o.Value.ToString(), o.Name, o.Usage?"Yes":"No", o.AllUsage?"Yes":"No", o.AllUsageEntities }); } foreach (var o in attr.LeftOnlyOptions) { bloc.AddRow(new string[] { o.Value.ToString(), o.Name, "", "", o.Usage ? "Yes" : "No", o.AllUsage ? "Yes" : "No", o.AllUsageEntities }); } foreach (var o in attr.RightOnlyOptions) { bloc.AddRow(new string[] { "", "", o.Value.ToString(), o.Name, o.Usage ? "Yes" : "No", o.AllUsage ? "Yes" : "No", o.AllUsageEntities }); } } } } csvFile.Export(); }
public static void ExportToExcel() { var visitedAttrs = new List <string>(); var csvFile = new CSVFile() { FileName = "Formulas.csv" }; foreach (var en in App.MigEntities) { foreach (var f in en.Formulas) { var bloc = new CSVBloc() { EntityName = f.SourceEntityName, AttributeName = f.SourceEntityName }; csvFile.Blocs.Add(bloc); bloc.AddRow(new string[] { f.Name, f.Type.Value + "", f.Type.Name }); } } csvFile.Export(); }
private void exportToExcelToolStripMenuItem_Click(object sender, EventArgs e) { var csvFile = new CSVFile() { FileName = "LookupsReport.csv" }; foreach (var le in App.CrmLookupEntities) { var bloc = new CSVBloc() { EntityName = le.LogicalName, AttributeName = "" }; csvFile.Blocs.Add(bloc); if (le.LeftOnlyLookups.Count > 0 || le.RightOnlyLookups.Count > 0) { foreach (var o in le.CommonLookups) { bloc.AddRow(new string[] { o.Name, o.Name }); } foreach (var o in le.LeftOnlyLookups) { bloc.AddRow(new string[] { o.Name, "" }); } foreach (var o in le.RightOnlyLookups) { bloc.AddRow(new string[] { "", o.Name }); } } } csvFile.Export(); }