Various levels of control for custom module settings
From the DNN's intrinsic html Module settings you will find the ability to apply workflow at various levels of site ranging from module instance to site level. Often this requirement triggers for custom modules in a generic way.
Below please find custom code written to perform this task such that any key/value pair can be stored for any given module refererred by module friendly name.1- Site Level
/// -----------------------------------------------------------------------------
/// <summary>
/// This method adds the key if not present and if present, updates its value.
/// Per Site or portal level: meaning all modules instances of type specified by ModuleFriendlyName placed on entire portal will be affected
/// </summary>
/// -----------------------------------------------------------------------------
public static bool UpdateModuleSettingPerSite(string ModuleFriendlyName, string key, string value, int portalId)
{
try
{
ModuleController mc = new ModuleController();
ArrayList existMods = mc.GetModulesByDefinition(portalId, ModuleFriendlyName);
{
if (!mi.IsDeleted)
{
mc.UpdateTabModuleSetting(mi.TabModuleID, key, value);
}
} return true;
}
catch
{
throw;
}
}
2- Page Level
/// -----------------------------------------------------------------------------
/// <summary>
/// This method adds the key if not present and if present, updates its value.
/// Per Page level: meaning all modules instances of type specified by ModuleFriendlyName placed on this particular page will be affected
/// </summary>
/// -----------------------------------------------------------------------------
{
try
{
ModuleController mc = new ModuleController(); ArrayList existMods = mc.GetModulesByDefinition(portalId, ModuleFriendlyName); foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods)
{
if (!mi.IsDeleted && mi.TabID == tabId)
{
mc.UpdateTabModuleSetting(mi.TabModuleId, key, value);
}
}
return true;
}
catch
{
throw;
}
}
3- Module Level
/// -----------------------------------------------------------------------------
/// <summary>
/// This method adds the key if not present and if present, updates its value.
/// Per Module level refers to current module instance, from where settings action was clicked.
/// </summary>
/// -----------------------------------------------------------------------------
{
try
{
//Verified that UpdateModuleSettings() updates the precise module instance only and not the settings common to all instances of that type
ModuleController objModules = new ModuleController();
objModules.UpdateTabModuleSetting(TabModuleId, key, value);
return true;
}
catch
{
throw;
}
}
Make a New World Record using SendKeys
Yesterday, a friend of mine came across an application game (to type a-z in least time http://apps.facebook.com/typea-z) on facebook and it was getting hard for him to manually score better than 5.12 seconds to type all the alphabet keys.
Since he had to win amongst friends, the workaround was simple. I wrote down a simple utility in VB .net to perform clicks using SendKey API. I was able to secure the goal in just 0.03 seconds. I thought to share the code right here. The point to highlight in this post is, if you would use the send method of the SendKeys class, you will fail miserably, since send method doesn't wait for the message to be processed, however sendWait method makes sure that the keys that are sent are processed by the consumer application. See if you have a better processing speed than my system to beat this record. :)Public Class Form1Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer = 0
''Give a delay so that you can manually click the Facebook browser window to gain focus
Threading.Thread.Sleep(3000)
For i = 0 To 5
SendKeys.SendWait("abcdefghijklmnopqrstuvwxyz")
Next
End Sub
End Class
About Me
Usman ur Rehman Ahmedis known as a software engineer in Lahore, Pakistan. He is renowned for having an abstract understanding of vast range of technological developments such as programming languages, web development, RIA's and documental writing, and is mainly specialized in developmental analysis.
Tags
- windows phone 7 (15)
- DNN (14)
- Dot Net Nuke (13)
- .NET (5)
- c# (5)
- manifest (4)
- Application (3)
- MySql (3)
- Provider (3)
- Sql (3)
- View all 237 tags »
- Sql Server (3)
- Stored Procedure (3)
- visual sutdio (3)
- API (2)
- Data (2)
- Mango (2)
- Module (2)
- Permission (2)
- PhoneTextBlock (2)
- User Control (2)
- Windows (2)
- config (2)
- console (2)
- developer (2)
- dot net (2)
- emulator (2)
- enumeration (2)
- expression blend (2)
- extension (2)
- loop (2)
- network (2)
- phone 7 (2)
- tools (2)
- transparent (2)
- .ascx (1)
- 3g (1)
- 5.6.2 (1)
- 7.1 (1)
- 7.5 (1)
- AJAX (1)
- Activity (1)
- App.xaml (1)
- AppManifest (1)
- ApplicationIcon (1)
- Arabic (1)
- Background.png (1)
- BuildAction (1)
- Connector (1)
- Control Panel (1)
- Core Version (1)
- Data-tier (1)
- DataBound (1)
- Database (1)
- Dependency (1)
- DeviceNetworkInterface (1)
- Directory (1)
- Dynamic (1)
- EVDO (1)
- Encryption (1)
- File (1)
- FileSystemWatcher (1)
- Filter (1)
- Foreign Key (1)
- Function (1)
- GUID (1)
- GetSiteLog (1)
- Hash (1)
- Host Settings (1)
- IIS6 (1)
- IIS7 (1)
- Integrated Mode (1)
- Internet Explorer (1)
- IsolatedStorage (1)
- Java (1)
- Koder (1)
- Linq (1)
- Lists (1)
- Log (1)
- Marketplace (1)
- Membership (1)
- Microsoft (1)
- NavigationCacheMode (1)
- NavigationContext (1)
- NavigationService (1)
- Notify (1)
- OnClientNodeChecked (1)
- PTCL (1)
- Panaroma (1)
- Password (1)
- Properties (1)
- Query String (1)
- ResXResourceReader (1)
- ResolveHostNameAsync (1)
- Right to Left (1)
- SDK (1)
- SEO (1)
- SendKeys (1)
- SendWait (1)
- SharpPCap (1)
- Stream (1)
