Guest User

CustomActions.cs

a guest
Jun 8th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Laserfiche.WebAccess.Common.Util;
  5. using LFSO91Lib;
  6. using System.Data;
  7. using System.IO;
  8.  
  9. namespace WebAccessCustomActions
  10. {
  11.     public class CustomActions
  12.     {
  13.         public static IDictionary<string, object> PerformAction(string actionID,
  14.                                                                IDictionary<string, object> args)
  15.         {
  16.             // Branches to your custom action function using the actionID
  17.             switch (actionID)
  18.             {
  19.                 case "GenerateLaserInvestigatorsURL":
  20.                     return GenerateLaserInvestigatorsURL(args);
  21.  
  22.                 default:
  23.                     // If unknown actionID was specified just return an empty value
  24.                     return new Dictionary<string, object>();
  25.  
  26.             }
  27.         }
  28.  
  29.         private static IDictionary<string, object>
  30.            GenerateLaserInvestigatorsURL(IDictionary<string, object> args)
  31.         {
  32.             Dictionary<string, object> retVal = new Dictionary<string, object>();
  33.             retVal["url"] = "";
  34.  
  35.             // Retrieve the active LFSO database object from the current Web Access Session
  36.             WebAccessSession WASession = WebAccessSession.GetSessionObject();
  37.             ILFDatabase db = WASession.ConnectionManager.GetLoggedInRepository();
  38.  
  39.             //if (args.ContainsKey("DocumentID"))
  40.             //{
  41.             //    int docID = (int)args["DocumentID"];
  42.             //    LFDocument doc = (LFDocument)db.GetEntryByID(docID);
  43.             //    if (doc != null)
  44.             //    {
  45.             //        LFFieldData fieldData = doc.FieldData;
  46.             //        // Check to see Case Files template is applied to the document
  47.             //        if (fieldData.Template.Name == "Case Files")
  48.             //        {
  49.             //            String formatter =
  50.             //                "http://conferencevm/InvestigationManagement/CaseNotes.cshtml/{0}";
  51.             //            String caseID = fieldData.get_FieldAsString("Case ID");
  52.             //            retVal["url"] = String.Format(formatter, caseID);
  53.             //        }
  54.             //        doc.Dispose();
  55.             //    }
  56.             //}
  57.             retVal["url"] = "http://www.google.com";
  58.             return retVal;
  59.         }
  60.  
  61.     }
  62. }
Add Comment
Please, Sign In to add comment