Exemple #1
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.Siebel.SharedServices.ContactModel.ServiceProvider      = ConfigurationSetting.SiebelProvider;
                Accelerator.Siebel.SharedServices.ContactModel.ListLookupURL        = ConfigurationSetting.LookupContactList_WSDL;
                Accelerator.Siebel.SharedServices.ContactModel.ServiceUsername      = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                Accelerator.Siebel.SharedServices.ContactModel.ServicePassword      = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                Accelerator.Siebel.SharedServices.ContactModel.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Accelerator.Siebel.SharedServices.ContactModel.InitSiebelProvider();

                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);
        }
        /// <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.Siebel.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.SiebelProvider;
                Accelerator.Siebel.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL;
                Accelerator.Siebel.SharedServices.ContactModel.ServiceUsername = String.IsNullOrEmpty(_usr) ? "ebusiness" : _usr;
                Accelerator.Siebel.SharedServices.ContactModel.ServicePassword = String.IsNullOrEmpty(_pwd) ? "password" : _pwd;
                Accelerator.Siebel.SharedServices.ContactModel.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Accelerator.Siebel.SharedServices.ContactModel.InitSiebelProvider();

                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;
        }