Beispiel #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("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;
        }
        /// <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)
        {
            _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);
            }
            _wsAddIn = new RepairOrderAddIn(inDesignMode, _rContext);
            _wsAddIn._log = _log;
            _wsAddIn._ebsDefaultSrOwnerId = _ebsDefaultSrOwnerId;
            if (_log != null)
            {
                logMessage = "Repair Order AddIn is setup.";
                logNote = "";
                _log.DebugLog(logMessage: logMessage, logNote: logNote);
            }
            return _wsAddIn;
        }
 public static void logAssemblyVersion(Assembly assembly, LogWrapper aLog)
 {
     // Log the build version of this assembly
     LogWrapper log = (null == aLog) ? ConfigurationSetting.logWrap : aLog;
     AssemblyName assemblyName = assembly.GetName();
     StringBuilder sb = new StringBuilder(256);
     sb.Append(assemblyName.Name)
         .Append(" ")
         .Append(assemblyName.Version.ToString());
     string logMessage = sb.ToString();
     string logNote = null;
     log.DebugLog(logMessage: logMessage, logNote: logNote);
 }
        // 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;
            }
        }