Admin Module

Logging Customization

Default Logging methodology used in Admin module uses Microsoft’s Enterprise Library for logging. Configuration for the same is as below:

Web.config > configuration > appSettings

 

<add key="LoggingAssembly" value="<Your path>\SE.LoggingEnterprise.dll" />

<add key="LoggingClass" value="SE.LoggingImpl.ExceptionDetails" />

 

<add key="LoggingAssembly" value="<Your path>\SE.LoggingEnterprise.dll" />

<add key="LoggingClass" value="SE.LoggingImpl.ExceptionDetails" />

  


For customizing logging mechanism, follow the steps below:

  1. Create a .NET Class library project for writing the logging implementation.
  2. Create a class in this project and create this method:
    public static void LogException(stringtitle, Exception ex)
     

  3. Write the own logging mechanism in this method.
  4. Compile the .NET class library project and place its DLL along with the Admin module DLLs.
  5. Navigate to Web.config > configuration > appSettings and update the following entries:

<add key "LoggingAssembly" value="<Your path>\<Your Assembly>.dll" />

<add key LoggingClass" value="<Full Class Name>" />

  

Customizing Admin Modules aspx Pages

Use the Ajax client lifecycle Events to customize the Admin modules aspx pages. The client events enable customizing the UI for both postbacks and for asynchronous postbacks (partial-page updates). The client events also help in managing the custom script components during the lifetime of the page in a browser.

 

Example for customizing the UserManagement.aspx page:

 

Add the script after the </asp:UpdatePanel> tag in UserManagement.aspx page. This key is found at the location ~\SE-Modules-Sql\ Admin\AMClient\UserManagement\UserManagement.aspx

 

 

<script type=”text/javascript”> var username = “”;

var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance(); if (pageRequestManager != null) {

pageRequestManager.add_beginRequest(function (sender, e) {

//Event raised when the Async Postback is started. username = “”;

//Detect whether the request is Async

var isAsync = sender._postBackSettings.async;

//Detect Id of the control that caused the postback.

var controlId = sender._postBackSettings.sourceElement.id;

if (sender._form.ctl00$ContentPlaceHolder1$txtUniqueId != “undefined” && (sender._postBackSettings.sourceElement. id == “ContentPlaceHolder1_btnSubmit” || sender._postBackSettings.sourceElement.id == “ContentPlaceHolder1_btnUpdate”))

{

username = sender._form.ctl00$ContentPlaceHolder1$txtUniqueId.value;

}});

}

pageRequestManager.add_pageLoaded(function (sender, e) {

if (sender._activeElement!=null && sender._activeElement.defaultValue != null) {

if ((sender._activeElement.defaultValue == “Submit” && document.getElementById(‘ContentPlaceHolder1_lblSelection’) != null

//TODO:Write your custom logic here

alert(username+” added/updated successfully”);

}

else

}

if(document.getElementById(‘ContentPlaceHolder1_lblUploadResult’) != null)

ed.”)>=0{)

if(document.getElementById(‘ContentPlaceHolder1_lblUploadResult’).textContent.indexOf(“users add-

//TODO:Write your custom logic here

alert(“Upload successful”);

}

}

}

}

);

pageRequestManager.add_endRequest(function (sender, e) {

});

</script>

{

 

 

 

 

 

 

 

  

Use the below mentioned Ajax client side events for checking which event of the page is triggered and extracting data based on the event/ async postback triggered for the page.

 

Other client side events can be used as well for writing the custom logic in these methods. {Make the APIs call custom updates etc. in these methods, set/fetch the values of the controls present on the page etc.}

  • pageRequestManager.add_beginRequest
  • pageRequestManager.add_pageLoaded

In this example, text entered in Unique Id textbox is obtained in the below mentioned scenarios:

  • When a user clicks on submit button for adding a user
  • When a user clicks on update button for editing users

An alert is raised when admin performs bulk upload of user details and at least one user is inserted into the database. In this case we have access to user information and can add additional custom attributes such as user’s geography, user’s department etc. and call custom API’s for inserting the values in the database on User added successfully, User details updated successfully, or on Bulk upload. Placeholders for writing your custom code can be found at location where the below mentioned comment is present.

 

NOTE:  

Make changes only in the .aspx pages without making any changes to the server side code.

  

For Ajax client Life-Cycle events, refer to the link https://msdn.microsoft.com/en-in/library/bb386417.aspx.