/// <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); }
/// <summary> /// Default constructor. /// </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> public BulkImportAddin(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _gContext = globalContext; _recordContext = recordContext; bulkImportControl = new BulkImportControl(new Proxy(this)); _Model = bulkImportControl._Model; _Model.InDesignMode = inDesignMode; var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = bulkImportControl, }; Controls.Add(elementHost); if (inDesignMode) { return; } //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; Accelerator.EBS.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL; Accelerator.EBS.SharedServices.ContactModel.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr; Accelerator.EBS.SharedServices.ContactModel.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd; Accelerator.EBS.SharedServices.ContactModel.InitEBSProvider(); Accelerator.EBS.SharedServices.RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL; Accelerator.EBS.SharedServices.RepairOrder.ListURL = ConfigurationSetting.RepairOrderList_WSDL; Accelerator.EBS.SharedServices.RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.CreateURL = ConfigurationSetting.CreateRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.UpdateURL = ConfigurationSetting.UpdateRepair_WSDL; Accelerator.EBS.SharedServices.RepairOrder.ServiceUsername = ConfigurationSetting.username; Accelerator.EBS.SharedServices.RepairOrder.ServicePassword = ConfigurationSetting.password; Accelerator.EBS.SharedServices.RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout; Accelerator.EBS.SharedServices.RepairOrder.InitEBSProvider(); _Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; _recordContext.DataLoaded += _rContext_DataLoaded; _recordContext.Closing += _recordContext_Closing; _recordContext.Saving += _recordContext_Saving; _gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged; } }
/// <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("Activity Add-In 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("Activity Add-In is not loaded because of invalid configuration verb."); return(new ActivityAddIn(inDesignMode, RecordContext)); } } _rContext = RecordContext; if (!inDesignMode && _rContext != null) { ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; //_client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; _log = ConfigurationSetting.logWrap; _siebelServiceUserId = ConfigurationSetting.siebelServiceUserId; _siebelDefaultSrOwnerId = ConfigurationSetting.siebelDefaultSrOwnerId; Activity.ServiceProvider = ConfigurationSetting.SiebelProvider; Activity.LookupURL = ConfigurationSetting.CreateSR_WSDL; Activity.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr; Activity.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd; Activity.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout; Activity.InitSiebelProvider(); } _wsAddIn = new ActivityAddIn(inDesignMode, _rContext); _wsAddIn._rnSrv = _rnSrv; _wsAddIn._log = _log; _wsAddIn._siebelServiceUserId = _siebelServiceUserId; if (_log != null) { string logMessage = "Activity AddIn is setup."; _log.DebugLog(logMessage: logMessage); } return(_wsAddIn); }
public bool Initialize(IGlobalContext context) { _globalContext = context; ConfigurationSetting instance = ConfigurationSetting.Instance(context); if (!ConfigurationSetting.configVerbPerfect) { string logMessage = "All Accelerator Add-Ins are not initialized properly because of invalid config verb."; ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage); return(false); } else { return(true); } }
/// <summary> /// Default constructor. /// </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> public WorkspaceAddIn(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext, string version) { // do nothing so framework won't throw exception once it gets to GetControl if (!ConfigurationSetting.configVerbPerfect && ConfigurationSetting.loginUserIsAdmin) { // do nothing } else { _gContext = globalContext; _recordContext = recordContext; bulkImportControl = new OrderManagementControl(new Proxy(this)); _Model = bulkImportControl._Model; _Model.InDesignMode = inDesignMode; _Model.Version = version; var elementHost = new ElementHost { Dock = DockStyle.Fill, Child = bulkImportControl, }; Controls.Add(elementHost); if (inDesignMode) { return; } //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; Accelerator.EBS.SharedServices.Order.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.Order.GetOrderURL = ConfigurationSetting.GetOrder_WSDL; Accelerator.EBS.SharedServices.Order.OrderInboundURL = ConfigurationSetting.OrderInboundURL_WSDL; Accelerator.EBS.SharedServices.Order.InitEBSProvider(); _Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; _recordContext.DataLoaded += _rContext_DataLoaded; _recordContext.Closing += _recordContext_Closing; _recordContext.Saving += _recordContext_Saving; _gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged; } }
/// <summary> /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In. /// </summary> /// <param name="GlobalContext">The Global Context for the Add-In framework.</param> /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns> public bool Initialize(IGlobalContext GlobalContext) { _gContext = GlobalContext; ConfigurationSetting.logAssemblyVersion(Assembly.GetAssembly(typeof(BulkImportViewModel)), null); ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext); /* log it, but return true because will show the messagebox when the addin is opened in createControl. * if return false, the add-in is not loaded, and cannot show the error when add-in is opened. */ if (!ConfigurationSetting.configVerbPerfect) { string logMessage = "BulkImportAddin is not initialized properly because of invalid config verb."; ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage); } return(true); }
/// <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) { ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext); if (!ConfigurationSetting.configVerbPerfect) { if (!ConfigurationSetting.loginUserIsAdmin) { System.Windows.Forms.MessageBox.Show("BulkImportAddin is not initialized properly. \nPlease contact your system administrator.\n You are now logged out."); _gContext.Logout(); } else // don't want to logout admin { System.Windows.Forms.MessageBox.Show("BulkImportAddin is not loaded because of invalid configuration verb."); return(new BulkImportAddin(inDesignMode, RecordContext, _gContext)); } } return(new BulkImportAddin(inDesignMode, RecordContext, _gContext)); }
/// <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("Contact Search Add-In is not initialized properly. \nPlease contact your system administrator.\n You are now logged out."); _globalContext.Logout(); } else // don't want to logout admin { MessageBox.Show("Contact Search Add-In is not loaded because of invalid configuration verb."); return(new ContactWorkspaceAddIn(inDesignMode, RecordContext, _globalContext)); } } _rContext = RecordContext; if (!inDesignMode && RecordContext != null) { //Get configuration ConfigurationSetting instance = ConfigurationSetting.Instance(_globalContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _client = ConfigurationSetting.client; _rnSrv = ConfigurationSetting.rnSrv; _log = ConfigurationSetting.logWrap; Accelerator.EBS.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.EBSProvider; Accelerator.EBS.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL; Accelerator.EBS.SharedServices.ContactModel.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr; Accelerator.EBS.SharedServices.ContactModel.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd; Accelerator.EBS.SharedServices.ContactModel.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout; Accelerator.EBS.SharedServices.ContactModel.InitEBSProvider(); Contact_Search_Report_ID = ConfigurationSetting.contactSearchReportID; } _wsAddIn = new ContactWorkspaceAddIn(inDesignMode, RecordContext, _globalContext); _wsAddIn._contactSearchReportId = Contact_Search_Report_ID; _wsAddIn._rnSrv = _rnSrv; _wsAddIn._log = _log; return(_wsAddIn); }