Data change checking features in DotNetNuke pages.

I've used  data change checking features  described by Eric Woodruff in my ASP.NET application. When I converted the ASP.NET application to DotNetNuke, I still needed to have the same functionality.

Unfortunately .Net doesn't allow multiple inheritanse,  so I had to re-factor EWSoftware.Web.BasePage.

I created an interface IDataChangeChecking, that described the public methods, relevant to data change checking:
//described in http://www.codeproject.com/aspnet/EWSWebPt2.asp
string
[] BypassPromptIds
bool CheckForDataChanges
bool Dirty
string[] SkipDataCheckIds
StateBag ControlViewState
//expose protected ViewState

and created public class DataChangeCheckingImpl with methods extracted from original BasePage

{
      // Methods
      public DataChangeCheckingImpl(Control owner);
      public static void BypassChangesNotSavedPrompt(Control container, string ClientID);
      public static void BypassChangesNotSavedPromptIDs_Add(Control container, string[] ClientIDs);
      public void OnInit(EventArgs e);
      public void OnPreRender(EventArgs e);
      public static void SetCheckForDataChanges(Control container, bool value);
      public static bool SetPageDirty(Control container, bool Value);
      public static void SkipDataChangesCheckIDs_Add(Control container, string[] ClientIDs);

      // Properties
      public string[] BypassPromptIds { get; set; }
      public bool CheckForDataChanges { get; set; }
      public string ConfirmLeaveMessage { get; set; }
      public bool Dirty { get; set; }
      private HttpRequest Request { get; }
      public string[] SkipDataCheckIds { get; set; }
      public StateBag ViewState { get; }

      // Fields
      private bool bIsDirty;
      private Control m_ctlOwner;
      private IDataChangeChecking m_IDataChangeChecking;
}

Finally I've created DataChangeCheckingDefaultPage class, derived from DotNetNuke.Framework.CDefault and implementing IDataChangeChecking interface.

Additionaly OnInit event handler created DataChangeCheckingImpl object and methods
DataChangeCheckingImpl.OnInit and OnPreRender are called from the corresponding DataChangeCheckingDefaultPage event handlers.

Now I can configure data editing DotNetNuke modules, that user will see warning if he/she try to exit without saving data. 

Function to Print DirectoryEntry properties

When I debugging function that retrieved active directory properties, Visual Studio 2005 debugger show them as a collection , but not as an individual values. So I wrote function, copied from GetPropertyList function from LDAP, IIS and WinNT Directory Services  article written by

            [Conditional("DEBUG")]

            public static void PrintDirectoryEntryProperties(System.DirectoryServices.DirectoryEntry entry, string sComment)

       

            // loop through all the properties and get the key for each

            foreach (string Key in entry.Properties.PropertyNames)

            {

                string sPropertyValues = String.Empty;

                // now loop through all the values in the property;

                // can be a multi-value property

                foreach (object Value in entry.Properties[Key])

                    sPropertyValues += Convert.ToString(Value) + ";";

                // cut off the separator at the end of the value list

                sPropertyValues = sPropertyValues.Substring(0, sPropertyValues.Length - 1);

                // now add the property info to the property list

                Debug.WriteLine(Key + "=" + sPropertyValues);

            }

        }

Ideally it should be possible to write  Debug Visualizer for them. 

 

«April»
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456