示例#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.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);
        }
 public static string 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);
     return logMessage;
 }
        // 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("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;
        }
        /// <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;
        }
示例#6
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("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;
        }