Example #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("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>
        /// 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;
        }