/// <summary> /// Method which is called when any Workspace Rule Action is invoked. /// </summary> /// <param name="ActionName">The name of the Workspace Rule Action that was invoked.</param> public void RuleActionInvoked(string ActionName) { string logMessage = "Invoke Action : " + ActionName; _log.DebugLog(logMessage: logMessage); // contact search with AddIn WS has 2 action rules if (ActionName == "searchEBSContact") { string _wsTypeName = this._recordContext.WorkspaceTypeName; if (_wsTypeName == "Chat") { this._enableAutoSearchInChat = true; } else { _ebsContactSearchControl.autoSearchParameterInvoke(); } } else if (ActionName == "searchEBSNewContactCtiPhone") { try { _ebsContactSearchControl.autoSearchNewContactInvoke(); } catch (FileNotFoundException ex) { /* for case where CTI is not enabled, and it will throw * FileNotFoundException (dll not loaded). Simply ignore * it, so that the normal new Contact can resume. */ } } }
// Initiate Log based on configuration public void initLog() { Type t = Type.GetType(logClass); try { Log log = Activator.CreateInstance(t, scLogProductExtSignature, scLogProductExtName, scLogBusinessFunction) as Log; logWrap = new LogWrapper(log); if (logWrap != null) { string logMessage = "Log is set up."; string logNote = "Log information " + logWrap.ToString(); logWrap.DebugLog(logMessage: logMessage, logNote: logNote); } } catch (Exception) { String message = "Error in setting up log. Please contact the administrator."; MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
/// <summary> /// Method which is invoked by the AddIn framework when the control is created. /// </summary> /// <param name="inDesignMode">Flag which indicates if the control is being drawn on the Workspace Designer. (Use this flag to determine if code should perform any logic on the workspace record)</param> /// <param name="RecordContext">The current workspace record context.</param> /// <returns>The control which implements the IWorkspaceComponent2 interface.</returns> public IWorkspaceComponent2 CreateControl(bool inDesignMode, IRecordContext RecordContext) { if (!ConfigurationSetting.configVerbPerfect) { if (!ConfigurationSetting.loginUserIsAdmin) { MessageBox.Show("RepairOrderAddIn is not initialized properly. \nPlease contact your system administrator.\n You are now logged out."); _gContext.Logout(); } else // don't want to logout admin { MessageBox.Show("RepairOrderAddIn is not loaded because of invalid configuration verb."); return new RepairOrderAddIn(inDesignMode, RecordContext, isEnabledEditing); } } _rContext = RecordContext; string logMessage, logNote; if (!inDesignMode && _rContext != null) { // Set config according to custom configuration verb ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _log = ConfigurationSetting.logWrap; _ebsDefaultSrOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider; RepairOrder.CreateURL = ConfigurationSetting.CreateRepair_WSDL; RepairOrder.UpdateURL = ConfigurationSetting.UpdateRepair_WSDL; //RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL; //RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL; RepairOrder.ListURL = ConfigurationSetting.RepairOrderList_WSDL; RepairOrder.ServiceUsername = _usr; RepairOrder.ServicePassword = _pwd; RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout; RepairOrder.InitEBSProvider(); logMessage = "Repair Order is initiated."; logNote = ""; _log.DebugLog(logMessage: logMessage, logNote: logNote); } /* bool isEnabled = false; if (isEnabledEditing == "true") { isEnabled = true; }*/ _wsAddIn = new RepairOrderAddIn(inDesignMode, _rContext, isEnabledEditing); _wsAddIn._log = _log; _wsAddIn._ebsDefaultSrOwnerId = _ebsDefaultSrOwnerId; if (_log != null) { logMessage = "Repair Order AddIn is setup."; logNote = ""; _log.DebugLog(logMessage: logMessage, logNote: logNote); } return _wsAddIn; }