예제 #1
0
        /// <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.Contact.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.Contact.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL;
                Accelerator.EBS.SharedServices.Contact.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                Accelerator.EBS.SharedServices.Contact.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                Accelerator.EBS.SharedServices.Contact.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;
            }
        }
 // Initialize CWSS
 public static void initCWSS(IGlobalContext _gContext)
 {
     rnSrv = new RightNowService(_gContext);
     client = rnSrv._rnowClient;
 }
        /// <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("Service Request 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("Service Request Add-In is not loaded because of invalid configuration verb.");
                    return new ServiceRequestAddIn(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;
                _ebsServiceUserId = ConfigurationSetting.ebsServiceUserId;
                _ebsDefaultSrOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId;

                ServiceRequest.ServiceProvider = ConfigurationSetting.EBSProvider;
                ServiceRequest.CreateUpdateURL = ConfigurationSetting.CreateSR_WSDL;
                ServiceRequest.LookupURL = ConfigurationSetting.LookupSR_WSDL;
                ServiceRequest.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                ServiceRequest.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                ServiceRequest.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                ServiceRequest.InitEBSProvider();

                Interaction.ServiceProvider = ConfigurationSetting.EBSProvider;
                Interaction.CreateInteractionURL = ConfigurationSetting.CreateInteraction_WSDL;
                Interaction.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                Interaction.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                Interaction.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                Interaction.InitEBSProvider();

                Item.ServiceProvider = ConfigurationSetting.EBSProvider;
                Item.ListURL = ConfigurationSetting.ItemList_WSDL;
                Item.ServiceUsername = ConfigurationSetting.username;
                Item.ServicePassword = ConfigurationSetting.password;
                Item.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                Item.InitEBSProvider();
            }
            _wsAddIn = new ServiceRequestAddIn(inDesignMode, _rContext);

            _wsAddIn._rnSrv = _rnSrv;
            _wsAddIn._log = _log;
            _wsAddIn._ebsServiceUserId = _ebsServiceUserId;
            _wsAddIn._ebsDefaultSrOwnerId = _ebsDefaultSrOwnerId;

            if (_log != null)
            {
                string logMessage = "Service Request AddIn is setup.";
                _log.DebugLog(logMessage: logMessage);
            }

            return _wsAddIn;
        }
예제 #4
0
        /// <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.Contact.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.Contact.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL;
                Accelerator.EBS.SharedServices.Contact.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                Accelerator.EBS.SharedServices.Contact.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                Accelerator.EBS.SharedServices.Contact.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                Accelerator.EBS.SharedServices.Contact.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;
        }
예제 #5
0
 // Initialize CWSS
 public static void initCWSS(IGlobalContext _gContext)
 {
     rnSrv  = new RightNowService(_gContext);
     client = rnSrv._rnowClient;
 }