From ab89d8404a9d334bdf352422f4958e3a8c8b8cc0 Mon Sep 17 00:00:00 2001 From: Mark McAvoy Date: Wed, 6 Oct 2021 11:25:09 -0400 Subject: [PATCH 1/3] update the get role method to get the roles of the portal --- MainControl.ascx.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MainControl.ascx.cs b/MainControl.ascx.cs index 40e4ef8..bca3967 100644 --- a/MainControl.ascx.cs +++ b/MainControl.ascx.cs @@ -74,7 +74,7 @@ private void ExtraPageLoad() ddlExportByRole.Items.Clear(); ddlExportByRole.Items.Add(new ListItem(Localization.GetString("AllRoles", this.LocalResourceFile), "-1")); RoleController objRoleController = new RoleController(); - foreach (RoleInfo objRole in objRoleController.GetRoles(this.PortalId)) + foreach (RoleInfo objRole in objRoleController.GetPortalRoles(this.PortalId)) { ddlExportByRole.Items.Add(new ListItem(objRole.RoleName, objRole.RoleID.ToString())); } From 36cc1dc873787486aeee7c68287920ba87800eea Mon Sep 17 00:00:00 2001 From: Mark McAvoy Date: Wed, 6 Oct 2021 11:30:01 -0400 Subject: [PATCH 2/3] add a gitignore file --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6598382 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.suo +*.user + +.vs/ +bin/ +obj/ \ No newline at end of file From 10bc50facd8fb35e7bf3d5204553cdae6e1f711f Mon Sep 17 00:00:00 2001 From: Mark McAvoy Date: Wed, 6 Oct 2021 12:31:38 -0400 Subject: [PATCH 3/3] add functionality to allow the user's created date to be exported to CSV --- App_LocalResources/MainControl.ascx.resx | 6 ++ Components/ExportController.cs | 8 ++ MainControl.ascx | 7 +- MainControl.ascx.designer.cs | 120 +++++++++++++---------- Models/ExportInfo.cs | 3 +- 5 files changed, 92 insertions(+), 52 deletions(-) diff --git a/App_LocalResources/MainControl.ascx.resx b/App_LocalResources/MainControl.ascx.resx index efa8726..81f9ed3 100644 --- a/App_LocalResources/MainControl.ascx.resx +++ b/App_LocalResources/MainControl.ascx.resx @@ -303,4 +303,10 @@ Export By Role + + Export the date when the user account was created + + + Export Created Date + \ No newline at end of file diff --git a/Components/ExportController.cs b/Components/ExportController.cs index 28e117e..c1a4f18 100644 --- a/Components/ExportController.cs +++ b/Components/ExportController.cs @@ -134,6 +134,12 @@ FOR XML PATH('')) Roles .Replace("{0}", objExportInfo.ExportByRole.ToString())); } + if (objExportInfo.ExportCreatedDate) + { + sbSelect.Append(", u.CreatedOnDate"); + htFieldNames["CreatedOnDate"] = 1; + } + idr = DotNetNuke.Data.DataProvider.Instance().ExecuteSQL(sbSelect.ToString() + sbFrom.ToString() + sbWhere.ToString()); DataTable dt = DotNetNuke.Common.Globals.ConvertDataReaderToDataTable(idr); if (objExportInfo.ExportPasswords) @@ -141,6 +147,8 @@ FOR XML PATH('')) Roles dt = AddPasswordsColumn(PortalId, dt); } + + string strResult = ""; switch (objExportInfo.ExportFileType) diff --git a/MainControl.ascx b/MainControl.ascx index 8258427..3d7561a 100644 --- a/MainControl.ascx +++ b/MainControl.ascx @@ -50,6 +50,10 @@ +
+ + +
@@ -172,7 +176,8 @@ objValues.IncludeDeleted = $("#<%=cbIncludeDeleted.ClientID%>").prop("checked"); objValues.IncludeNonAuthorised = $("#<%=cbIncludeNonAuthorised.ClientID%>").prop("checked"); objValues.ExportRoles = $("#<%=cbExportRoles.ClientID%>").prop("checked"); - objValues.ExportPasswords = $("#<%=cbExportPasswords.ClientID%>").prop("checked"); + objValues.ExportPasswords = $("#<%=cbExportPasswords.ClientID%>").prop("checked"); + objValues.ExportCreatedDate = $("#<%=cbExportCreatedDate.ClientID%>").prop("checked"); objValues.PropertiesToExport = ""; $("#<%=cblPropertiesToExport.ClientID%> input[type='checkbox']:checked").each( function (ind, val) diff --git a/MainControl.ascx.designer.cs b/MainControl.ascx.designer.cs index 3d0816e..9cc8a1c 100644 --- a/MainControl.ascx.designer.cs +++ b/MainControl.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace forDNN.Modules.UsersExportImport { - - - public partial class MainControl { - +namespace forDNN.Modules.UsersExportImport +{ + + + public partial class MainControl + { + /// /// lblExportUsers control. /// @@ -20,7 +22,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblExportUsers; - + /// /// lblImportUsers control. /// @@ -29,7 +31,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblImportUsers; - + /// /// lblExportFileType control. /// @@ -38,7 +40,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblExportFileType; - + /// /// ddlExportFileType control. /// @@ -47,7 +49,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlExportFileType; - + /// /// lblbExportByRole control. /// @@ -56,7 +58,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblbExportByRole; - + /// /// ddlExportByRole control. /// @@ -65,7 +67,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlExportByRole; - + /// /// divIncludeSuperUsers control. /// @@ -74,7 +76,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divIncludeSuperUsers; - + /// /// lblIncludeSuperUsers control. /// @@ -83,7 +85,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblIncludeSuperUsers; - + /// /// cbIncludeSuperUsers control. /// @@ -92,7 +94,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbIncludeSuperUsers; - + /// /// lblIncludeDeleted control. /// @@ -101,7 +103,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblIncludeDeleted; - + /// /// cbIncludeDeleted control. /// @@ -110,7 +112,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbIncludeDeleted; - + /// /// lblIncludeNonAuthorised control. /// @@ -119,7 +121,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblIncludeNonAuthorised; - + /// /// cbIncludeNonAuthorised control. /// @@ -128,7 +130,25 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbIncludeNonAuthorised; - + + /// + /// lblExportCreatedDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UserControl lblExportCreatedDate; + + /// + /// cbExportCreatedDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbExportCreatedDate; + /// /// lblExportRoles control. /// @@ -137,7 +157,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblExportRoles; - + /// /// cbExportRoles control. /// @@ -146,7 +166,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbExportRoles; - + /// /// lblExportPasswords control. /// @@ -155,7 +175,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblExportPasswords; - + /// /// cbExportPasswords control. /// @@ -164,7 +184,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbExportPasswords; - + /// /// lblExportPasswordsDisabled control. /// @@ -173,7 +193,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblExportPasswordsDisabled; - + /// /// lblPropertiesToExport control. /// @@ -182,7 +202,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblPropertiesToExport; - + /// /// cbPropertiesToExport control. /// @@ -191,7 +211,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbPropertiesToExport; - + /// /// cblPropertiesToExport control. /// @@ -200,7 +220,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBoxList cblPropertiesToExport; - + /// /// btnExportUsers control. /// @@ -209,7 +229,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HyperLink btnExportUsers; - + /// /// lblExportInProgress control. /// @@ -218,7 +238,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblExportInProgress; - + /// /// lblImport control. /// @@ -227,7 +247,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblImport; - + /// /// objFile control. /// @@ -236,7 +256,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputFile objFile; - + /// /// lblMaxAllowedFileSize control. /// @@ -245,7 +265,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblMaxAllowedFileSize; - + /// /// lblImportRoles control. /// @@ -254,7 +274,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblImportRoles; - + /// /// rblImportRoles control. /// @@ -263,7 +283,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RadioButtonList rblImportRoles; - + /// /// lblImportProfileProperties control. /// @@ -272,7 +292,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblImportProfileProperties; - + /// /// cbImportProfileProperties control. /// @@ -281,7 +301,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbImportProfileProperties; - + /// /// lblUpdateExistingUser control. /// @@ -290,7 +310,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblUpdateExistingUser; - + /// /// cbUpdateExistingUser control. /// @@ -299,7 +319,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbUpdateExistingUser; - + /// /// lblCreateMissedProfileProperties control. /// @@ -308,7 +328,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblCreateMissedProfileProperties; - + /// /// cbCreateMissedProfileProperties control. /// @@ -317,7 +337,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbCreateMissedProfileProperties; - + /// /// lblRandomPassword control. /// @@ -326,7 +346,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblRandomPassword; - + /// /// cbRandomPassword control. /// @@ -335,7 +355,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbRandomPassword; - + /// /// lblForcePasswordChange control. /// @@ -344,7 +364,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblForcePasswordChange; - + /// /// cbForcePasswordChange control. /// @@ -353,7 +373,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbForcePasswordChange; - + /// /// lblEmailUser control. /// @@ -362,7 +382,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblEmailUser; - + /// /// cbEmailUser control. /// @@ -371,7 +391,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbEmailUser; - + /// /// btnImport control. /// @@ -380,7 +400,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton btnImport; - + /// /// lblExamples control. /// @@ -389,7 +409,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblExamples; - + /// /// lnkExampleCSV control. /// @@ -398,7 +418,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HyperLink lnkExampleCSV; - + /// /// lnkExampleXML control. /// @@ -407,7 +427,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HyperLink lnkExampleXML; - + /// /// lblResult control. /// @@ -416,7 +436,7 @@ public partial class MainControl { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblResult; - + /// /// lblIcon control. /// diff --git a/Models/ExportInfo.cs b/Models/ExportInfo.cs index e1eb012..ca8e655 100644 --- a/Models/ExportInfo.cs +++ b/Models/ExportInfo.cs @@ -22,5 +22,6 @@ public class ExportInfo public bool ExportPasswords { get; set; } public string PropertiesToExport { get; set; } public int ExportByRole { get; set; } - } + public bool ExportCreatedDate { get; set; } + } } \ No newline at end of file