/// <summary>
 /// Called to initialize the add in.
 /// </summary>
 public void Register(IGlobalContext context, IExtensionDefinitionContext controllerContext)
 {
     //we have to register all of our types during this call or they won't be used at all.
     controllerContext.RegisterSessionAnalyzer(typeof(SessionAnalyzer));
     controllerContext.RegisterSessionCommand(typeof(SessionAnalyzer));
     controllerContext.RegisterSessionSummaryView(typeof(SessionFilterView), "Find By User", "Find sessions associated with an application user", null);
 }
Exemple #2
0
        // Get the CWSS_API_Siebel_Service_User ID
        public void getSiebelServiceUserId(IGlobalContext _gContext)
        {
            string query = "select Account.ID from Account where Login='******'";

            String[] rowData = null;
            try
            {
                rowData = rnSrv.queryData(query);
            }
            catch (Exception ex)
            {
                String message = "Error in query default Siebel user id from Cloud Service. Please contact the administrator.";
                if (logWrap != null)
                {
                    string logMessage = "Error in query default Siebel user id from Cloud Service. ";
                    string logNote    = "Error query: " + query + "; Error message: " + ex.Message;
                    logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);
                }
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            // Check whether account CWSS_API_Siebel_Service_User is set in Staff
            if (rowData.Length == 0)
            {
                cwssApiSiebelServiceUserId = 0;
                return;
            }
            string jsonString = rowData[0];

            cwssApiSiebelServiceUserId = Convert.ToInt32(jsonString);
        }
Exemple #3
0
 protected void Page_Init()
 {
     NavigationLoader        = new ContentProxyProvider();
     LegacyNavigationBuilder = new LegacyNavigationBuilder();
     Global = (IGlobalContext)Context.ApplicationInstance;
     IsMyHerbalife3Enabled = Global.CultureConfiguration.DefaultExperienceType != ExperienceType.Brown;
 }
        public StatusBarControl(IGlobalContext gContext)
        {
            _staffAccount = RightNowConnectService.GetService().GetAccountDetails();

            InitializeComponent(_staffAccount);
            _gContext = gContext;
        }
Exemple #5
0
 public void Initalize()
 {
     _instance         = new ProcessorFactory();
     _containerBuilder = new ContainerBuilder();
     _globalContext    = Substitute.For <IGlobalContext>();
     _elementContext   = Substitute.For <IElementContext>();
 }
Exemple #6
0
        public Boolean initializeLogger(IGlobalContext globalContext)
        {
            EndpointAddress endPointAddr = new EndpointAddress(globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));

            // Minimum required
            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

            binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            // Optional depending upon use cases
            binding.MaxReceivedMessageSize = 1024 * 1024;
            binding.MaxBufferSize          = 1024 * 1024;
            binding.MessageEncoding        = WSMessageEncoding.Mtom;

            // Create client proxy class
            RightNowSyncPortClient client = new RightNowSyncPortClient(binding, endPointAddr);

            // Ask the client to not send the timestamp
            BindingElementCollection elements = client.Endpoint.Binding.CreateBindingElements();

            elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
            client.Endpoint.Binding = new CustomBinding(elements);

            // Ask the Add-In framework the handle the session logic
            globalContext.PrepareConnectSession(client.ChannelFactory);

            this.client    = client;
            this.extObject = getExtension();
            return(true);
        }
 /// <summary>
 /// Called to initialize the add in.
 /// </summary>
 public void Register(IGlobalContext context, IExtensionDefinitionContext controllerContext)
 {
     //we have to register all of our types during this call or they won't be used at all.
     controllerContext.RegisterSessionAnalyzer(typeof(SessionAnalyzer));
     controllerContext.RegisterSessionCommand(typeof(SessionAnalyzer));
     controllerContext.RegisterSessionSummaryView(typeof(SessionFilterView), "Find By User", "Find sessions associated with an application user", null);
 }
Exemple #8
0
        public RightNowService(IGlobalContext _gContext)
        {
            // Set up SOAP API request to retrieve Endpoint Configuration -
            // Get the SOAP API url of current site as SOAP Web Service endpoint
            EndpointAddress endPointAddr = new EndpointAddress(_gContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));


            // Minimum required
            BasicHttpBinding binding2 = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

            binding2.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            // Optional depending upon use cases
            binding2.MaxReceivedMessageSize = 1024 * 1024;
            binding2.MaxBufferSize          = 1024 * 1024;
            binding2.MessageEncoding        = WSMessageEncoding.Mtom;

            // Create client proxy class
            _rnowClient = new RightNowSyncPortClient(binding2, endPointAddr);
            BindingElementCollection elements = _rnowClient.Endpoint.Binding.CreateBindingElements();

            elements.Find <SecurityBindingElement>().IncludeTimestamp = false;
            _rnowClient.Endpoint.Binding = new CustomBinding(elements);

            // Add SOAP msg inspector behavior
            //_rnowClient.Endpoint.Behaviors.Add(new LogMsgBehavior());

            // Ask the Add-In framework the handle the session logic
            _gContext.PrepareConnectSession(_rnowClient.ChannelFactory);

            // Set up query and set request
            _rnowClientInfoHeader       = new ClientInfoHeader();
            _rnowClientInfoHeader.AppID = "Case Management Accelerator Services";
        }
Exemple #9
0
        /// <summary>
        /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
        /// </summary>
        /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
        /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
        public bool Initialize(IGlobalContext context)
        {
            _globalContext = context;

            var instance = ConfigurationSetting.Instance(_globalContext);

            this.BackColor = System.Drawing.Color.Transparent;
            this.AutoSize  = true;
            this.Width     = 300;

            this.Controls.Add(ConfigurationSetting.iconLabelControl);

            // initial provider delete

            if (!ConfigurationSetting.configVerbPerfect)
            {
                MessageBox.Show(Properties.Resources.AcceleratorNotInitializedNotifyAdminError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ConfigurationSetting.logWrap.ErrorLog(logMessage: Properties.Resources.AccleratorNotInitializedConfigVerbError);
            }

            //Check if SRM configs exist asynchronously.

            if (!ConfigurationSetting.SRMAuthTokenConfigsExist)
            {
                ValidateSRMConfigs();
            }

            //Setup admin event handlers
            var oauthInstance = OAuthHelper.Instance;

            oauthInstance.TokensRemovedFromServer += oauthInstance_TokensRemovedFromServer;

            return(true);
        }
        public EBSContactSearchControl(IRecordContext recordContext, IGlobalContext globalContext)
        {
            // Set up Add-In UI
            InitializeComponent();

            ebsContactSearchListView.FullRowSelect = true;
            rnContactSearchListView.FullRowSelect = true;

            // Set necessary values
            _rContext = recordContext;
            _gContext = globalContext;

            bw_ebsContactSearch.WorkerSupportsCancellation = true;
            bw_ebsContactSearch.DoWork += new DoWorkEventHandler(bw_SearchEBSContact);
            bw_ebsContactSearch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunSearchEBSContactCompleted);

            bw_rnContactSearch.WorkerSupportsCancellation = true;
            bw_rnContactSearch.DoWork += new DoWorkEventHandler(bw_SearchRnContact);
            bw_rnContactSearch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunSearchRnContactCompleted);

            if (!assemChecked)
            {
                Assembly[] arAssem = AppDomain.CurrentDomain.GetAssemblies();
                foreach (Assembly assem in arAssem)
                {
                    if (assem.FullName.Contains("Oracle.RightNow.Cti"))
                    {
                        useCTI = true;
                        break;
                    }
                }
                assemChecked = true;
            }
        }
        public RightNowService(IGlobalContext _gContext)
        {
            // Set up SOAP API request to retrieve Endpoint Configuration -
            // Get the SOAP API url of current site as SOAP Web Service endpoint
            EndpointAddress endPointAddr = new EndpointAddress(_gContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));

            // Minimum required
            BasicHttpBinding binding2 = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
            binding2.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            // Optional depending upon use cases
            binding2.MaxReceivedMessageSize = 5 * 1024 * 1024;
            binding2.MaxBufferSize = 5 * 1024 * 1024;
            binding2.MessageEncoding = WSMessageEncoding.Mtom;

            // Create client proxy class
            _rnowClient = new RightNowSyncPortClient(binding2, endPointAddr);
            BindingElementCollection elements = _rnowClient.Endpoint.Binding.CreateBindingElements();
            elements.Find<SecurityBindingElement>().IncludeTimestamp = false;
            _rnowClient.Endpoint.Binding = new CustomBinding(elements);

            // Add SOAP msg inspector behavior
            //_rnowClient.Endpoint.Behaviors.Add(new LogMsgBehavior());

            // Ask the Add-In framework the handle the session logic
            _gContext.PrepareConnectSession(_rnowClient.ChannelFactory);

            // Set up query and set request
            _rnowClientInfoHeader = new ClientInfoHeader();
            _rnowClientInfoHeader.AppID = "Case Management Accelerator Services";
        }
Exemple #12
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 WorkspaceAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext GlobalContext)
 {
     _recordContext = RecordContext;
     _globalContext = GlobalContext;
     //  _recordContext.Saved += _recordContext_Saved;
     _rnConnectService = RightNowConnectService.GetService(_globalContext);
 }
Exemple #13
0
        /// <summary>
        /// Functional Designer. Use this one.
        /// </summary>
        /// <param name="designMode">if true we're on a workspace designer</param>
        /// <param name="globalContext">info about the session</param>
        /// <param name="recordContext">info about the workspace/record</param>
        public CopyDetailsButton(bool designMode, IGlobalContext globalContext, IRecordContext recordContext)
        {
            try
            {
                if (!designMode)
                {
                    recordContext.Saved += new EventHandler(recordContext_Saved);
                }

                //create a logic controller
                logic = new CopyDetailsLogic(designMode, globalContext, recordContext);
                this.globalContext = globalContext;
                this.recordContext = recordContext;

                //set up the UI
                InitializeComponent();

                //load the button text from the server settings
                button_copy.Text = ServerSettings.Instance.ButtonLabel;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
                globalContext.LogMessage("Incident Copy Addin - Exception: " + ex.ToString());
                this.Enabled = false;
            }
        }
        public static void RegisterOmnitureAnalyticsScript(Page currentPage, IGlobalContext globalContext)
        {
            try
            {
                if (globalContext == null || globalContext.CultureConfiguration == null)
                {
                    throw new ArgumentException("Global Context is null"); // nameof has been removed to fix mobile build
                }
                if (globalContext.CultureConfiguration == null)
                {
                    throw new ArgumentException("Culture Configuration is null"); // nameof has been removed to fix mobile build
                }

                string browseScheme = globalContext.CurrentExperience.BrowseScheme.ToString();
                AppendCommonItems(currentPage.Title, null, currentPage.Request, currentPage.User.Identity, globalContext.CurrentDistributor, browseScheme);
                var writer = new StringWriter();
                writer.WriteLine(string.Format("<!-- {0} -->", CommonItemsScriptName));
                AnalyticsProvider.Render(writer);
                currentPage.ClientScript.RegisterClientScriptBlock(currentPage.GetType(), CommonItemsScriptName, writer.GetStringBuilder().ToString(), false);
            }
            catch (Exception ex)
            {
                LoggerHelper.Exception("System.Exception", ex, "Error setting Omniture Analytics variables. ");
            }
        }
Exemple #15
0
        /// <summary>
        /// Method used to remove the tokens object from the database.  This is called when a refresh fails; the refresh token is invalid and therefor the data is invalid.
        /// The admin must reconfigure the SRM Oauth process if/when this method is called.
        /// </summary>
        /// <param name="globalContext"></param>
        /// <returns></returns>
        public bool RemoveOauthTokens(IGlobalContext globalContext)
        {
            ConfigurationSetting.logWrap.NoticeLog(logMessage: Properties.Resources.RemovingTokenNoticeLabel, logNote: Properties.Resources.RemovingTokenNoticeLabel);
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var tokenQuery = String.Format("SELECT ID FROM Accelerator.OAuthTokens WHERE Account = {0} LIMIT 1", globalContext.AccountId);
            var results    = ConfigurationSetting.rnSrv.queryData(tokenQuery);

            if (results.Length > 0)
            {
                var id     = results[0];
                var token  = GenericObjectFactory.CreateGenericObject("OAuthTokens", "Accelerator", Convert.ToInt32(id));
                var objArr = new RightNowServiceReference.RNObject[] { token };
                ConfigurationSetting.rnSrv.destroyObjects(objArr);

                if (TokensRemovedFromServer != null)
                {
                    TokensRemovedFromServer(this, EventArgs.Empty);
                }
            }
            stopwatch.Stop();
            ConfigurationSetting.logWrap.DebugLog(logMessage: Properties.Resources.RemovedTokenLabel, logNote: Properties.Resources.RemovedTokenLabel, timeElapsed: (int)stopwatch.ElapsedMilliseconds);

            return(false);
        }
Exemple #16
0
        /// <summary>
        /// create the component
        /// </summary>
        /// <param name="inDesignMode">store the inDesignMode flag</param>
        public Component(bool inDesignMode, IRecordContext context, IGlobalContext gc)
        {
            this.inDesignMode = inDesignMode;

            //create the UI control and stoactionre it
            control = new OAuthUC(inDesignMode, context, gc);
        }
Exemple #17
0
        public void Initialize()
        {
            _config          = new TextProcessorConfig();
            _numberingConfig = new NumberingConfig();
            _instance        = new TextProcessorPlugin(_config);
            _r = new Run(new Text("Some text."));
            _p = new Paragraph(new ParagraphProperties(), _r);
            _nestingHandler = Substitute.For <IContextNestingHandler>();
            _cssRegistrator = Substitute.For <ICssRegistrator>();
            _globalContext  = Substitute.For <IGlobalContext>();
            _globalContext.TryResolve(out ICssRegistrator val1).Returns(x => {
                x[0] = _cssRegistrator;
                return(true);
            });
            _globalContext.TryResolve(out NumberingConfig val2).Returns(x =>
            {
                x[0] = _numberingConfig;
                return(true);
            });
            _cssRegistrator.RegisterParagraph(null, null).ReturnsForAnyArgs(x => new CssClass());
            _cssRegistrator.RegisterRun(null, null, null).ReturnsForAnyArgs(x => new CssClass());

            _pContext = new RootElementContext(_globalContext, _p)
            {
                NestingHandler = _nestingHandler
            };
            _rContext = new ChildElementContext(_pContext)
            {
                Element = _r
            };
        }
Exemple #18
0
 public void Dispose()
 {
     if (_connection != null)
     {
         _connection.Dispose();
         _connection = null;
     }
 }
Exemple #19
0
        // Get the current host url
        public static void getCurrentHost(IGlobalContext _gContext)
        {
            // Get the server url of current site
            string _interfaceUrl = _gContext.InterfaceURL;

            string[] splittedInterfaceUrl = _interfaceUrl.Split('/');
            host = splittedInterfaceUrl[2];
        }
Exemple #20
0
        public void PostProcessing(IGlobalContext context)
        {
            var numConfig = context.Resolve <NumberingConfig>();

            context.AddCss(
                CSS(numConfig.NumberingContainerCls,
                    numConfig.NumberingNumberCls));
        }
Exemple #21
0
        /// <summary>
        /// Creates a new add-in control
        /// </summary>
        /// <param name="designMode">if true we're in a workspace designer</param>
        /// <param name="globalContext">information about the session</param>
        /// <param name="recordContext">information about the workspace</param>
        public AddinControlLauncher(bool designMode, IGlobalContext globalContext, IRecordContext recordContext)
        {
            userControl = new CopyDetailsButton(designMode, globalContext, recordContext);

            this.designMode    = designMode;
            this.globalContext = globalContext;
            this.recordContext = recordContext;
        }
        public MainController(IGlobalContext globalCtx, ITextFetcher textFetcher)
        {
            Contract.Requires(globalCtx != null);
            Contract.Requires(textFetcher != null);

            this._globalCtx   = globalCtx;
            this._textFetcher = textFetcher;
        }
Exemple #23
0
 public RootElementContext(IGlobalContext context, OpenXmlElement rootElement)
 {
     _globalContext = context;
     ViewBag        = new Dictionary <string, object>();
     RootElement    = rootElement;
     _nodes         = new List <HtmlNode>();
     _mutations     = new List <Mutation>();
 }
Exemple #24
0
 public TypeCool(string Name, IType Inherits, IGlobalContext Parent)
 {
     this.Name     = Name;
     this.Inherits = Inherits;
     Methods       = new HashSet <IMethod>(new SymbolComparer());
     Attributes    = new HashSet <IAttribute>(new SymbolComparer());
     this.Parent   = Parent;
 }
Exemple #25
0
 public WorkspaceAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext global)
 {
     if (!inDesignMode)
     {
         _recordContext = RecordContext;
         gContext       = global;
     }
 }
        /// <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;
            }
        }
        /// <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.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.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;
            }
        }
 public bool Initialize(IGlobalContext context)
 {
     GlobalContext   = context;
     Global.Context  = context;
     PrimaryEngine   = this.PrimaryCTIEngine;
     SecondaryEngine = this.SecondaryCTIEngine;
     Logger.Logger.Configure(System.Reflection.Assembly.GetExecutingAssembly().Location);
     return(true);
 }
Exemple #29
0
        /// <summary>
        /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
        /// </summary>
        /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
        /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
        public bool Initialize(IGlobalContext context)
        {
            _globalContext = context;

            ConfigurationSetting instance = ConfigurationSetting.Instance(_globalContext);

            this.BackColor = System.Drawing.Color.Transparent;
            this.AutoSize  = true;
            this.Width     = 300;

            this.Controls.Add(ConfigurationSetting.iconLabelControl);

            if (ConfigurationSetting.SiebelProvider != null)
            {
                ServiceRequest.ServiceProvider      = ConfigurationSetting.SiebelProvider;
                ServiceRequest.CreateUpdateURL      = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                ServiceRequest.LookupURL            = ConfigurationSetting.LookupSR_WSDL;
                ServiceRequest.ServiceUsername      = ConfigurationSetting.username;
                ServiceRequest.ServicePassword      = ConfigurationSetting.password;
                ServiceRequest.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                ServiceRequest.InitSiebelProvider();

                Accelerator.Siebel.SharedServices.ContactModel.ServiceProvider      = ConfigurationSetting.SiebelProvider;
                Accelerator.Siebel.SharedServices.ContactModel.ListLookupURL        = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                Accelerator.Siebel.SharedServices.ContactModel.ServiceUsername      = ConfigurationSetting.username;
                Accelerator.Siebel.SharedServices.ContactModel.ServicePassword      = ConfigurationSetting.password;
                Accelerator.Siebel.SharedServices.ContactModel.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;

                Accelerator.Siebel.SharedServices.ContactModel.InitSiebelProvider();

                Asset.ServiceProvider      = ConfigurationSetting.SiebelProvider;
                Asset.LookupURL            = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                Asset.ServiceUsername      = ConfigurationSetting.username;
                Asset.ServicePassword      = ConfigurationSetting.password;
                Asset.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Asset.InitSiebelProvider();

                Activity.ServiceProvider      = ConfigurationSetting.SiebelProvider;
                Activity.LookupURL            = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                Activity.ServiceUsername      = ConfigurationSetting.username;
                Activity.ServicePassword      = ConfigurationSetting.password;
                Activity.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Activity.InitSiebelProvider();
            }

            if (!ConfigurationSetting.configVerbPerfect)
            {
                String logMessage = "All Accelerator Add-Ins are not initialized properly. Please contact your system administrator.";
                MessageBox.Show(logMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                logMessage = "All Accelerator Add-Ins are not initialized properly because of invalid config verb.";
                ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage);
            }

            return(true);
        }
Exemple #30
0
        /// <summary>
        /// Retrieves the stored token on the OSvC server (NOT THE SRM SERVER) and caches the results for reuse.
        /// </summary>
        /// <param name="_gContext">Add-in global context</param>
        /// <param name="forceRefresh">Will indicate that we want to perform a force refresh.</param>
        private string GetTokenFromServer(IGlobalContext _gContext, DateTime requestTime)
        {
            var oauthToken   = "";
            var sessionId    = _gContext.SessionId;
            var interfaceURL = _gContext.InterfaceURL;
            var postData     = GetAgentPostData(_gContext, requestTime, "get_token");
            var endpoint     = string.Format("{0}{1}?session_id={2}", interfaceURL, _customScriptURI, sessionId);

            endpoint = endpoint.Replace(@"http://", @"https://"); //Our endpoint expects HTTPS, so force it here if the GlobalContext returns HTTP
            var stopwatch = new Stopwatch();

            // Create a request for the URL.
            var client  = new HttpClient();
            var request = new HttpRequestMessage()
            {
                RequestUri = new Uri(endpoint),
                Method     = HttpMethod.Post,
                Content    = new StringContent(postData, Encoding.UTF8, "application/x-www-form-urlencoded")
            };

            ConfigurationSetting.logWrap.DebugLog(logMessage: Properties.Resources.GETRequestAgentSessionMessage, logNote: endpoint);
            stopwatch.Start();
            // Get the response.
            var response = client.SendAsync(request).Result;

            stopwatch.Stop();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                var responseString = response.Content.ReadAsStringAsync().Result;
                ConfigurationSetting.logWrap.DebugLog(logMessage: Properties.Resources.GETOAuthTokenRequestMessage, logNote: responseString, timeElapsed: (int)stopwatch.ElapsedMilliseconds);

                if (responseString.Length == 0)
                {
                    LogSRMOAuthTokenError(responseString);
                }
                else if (responseString.Contains("<title>Access Denied</title>"))
                {
                    LogSessionAuthError(Properties.Resources.AccessDeniedError);
                }
                else
                {
                    oauthToken = ParseResponse(responseString);

                    if (TokenRetrievedFromServer != null)
                    {
                        TokenRetrievedFromServer(this, EventArgs.Empty);
                    }
                }
            }
            else
            {
                LogSessionAuthError(response.ToString());
            }

            return(oauthToken);
        }
        /// <summary>
        /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
        /// </summary>
        /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
        /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
        public bool Initialize(IGlobalContext context)
        {
            _globalContext = context;

            ConfigurationSetting instance = ConfigurationSetting.Instance(_globalContext);
            this.BackColor = System.Drawing.Color.Transparent;
            this.AutoSize = true;
            this.Width = 300;

            this.Controls.Add(ConfigurationSetting.iconLabelControl);

            if (ConfigurationSetting.SiebelProvider != null)
            {
                ServiceRequest.ServiceProvider = ConfigurationSetting.SiebelProvider;
                ServiceRequest.CreateUpdateURL = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                ServiceRequest.LookupURL = ConfigurationSetting.LookupSR_WSDL;
                ServiceRequest.ServiceUsername = ConfigurationSetting.username;
                ServiceRequest.ServicePassword = ConfigurationSetting.password;
                ServiceRequest.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;

                ServiceRequest.InitSiebelProvider();

                Accelerator.Siebel.SharedServices.Contact.ServiceProvider = ConfigurationSetting.SiebelProvider;
                Accelerator.Siebel.SharedServices.Contact.ListLookupURL = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                Accelerator.Siebel.SharedServices.Contact.ServiceUsername = ConfigurationSetting.username;
                Accelerator.Siebel.SharedServices.Contact.ServicePassword = ConfigurationSetting.password;
                Accelerator.Siebel.SharedServices.Contact.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;

                Accelerator.Siebel.SharedServices.Contact.InitSiebelProvider();

                Asset.ServiceProvider = ConfigurationSetting.SiebelProvider;
                Asset.LookupURL = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                Asset.ServiceUsername = ConfigurationSetting.username;
                Asset.ServicePassword = ConfigurationSetting.password;
                Asset.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Asset.InitSiebelProvider();

                Activity.ServiceProvider = ConfigurationSetting.SiebelProvider;
                Activity.LookupURL = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                Activity.ServiceUsername = ConfigurationSetting.username;
                Activity.ServicePassword = ConfigurationSetting.password;
                Activity.ServiceClientTimeout = ConfigurationSetting.SiebelServiceTimeout;
                Activity.InitSiebelProvider();
            }

            if (!ConfigurationSetting.configVerbPerfect)
            {
                String logMessage = "All Accelerator Add-Ins are not initialized properly. Please contact your system administrator.";
                MessageBox.Show(logMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                logMessage = "All Accelerator Add-Ins are not initialized properly because of invalid config verb.";
                ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage);
            }

            return true;
        }
 public void Register(IGlobalContext context, IExtensionDefinitionContext definitionContext)
 {
     definitionContext.RegisterRepositoryController(typeof(RepositoryController));
     definitionContext.RegisterRepositoryCommand(typeof(RepositoryCommand));
     definitionContext.RegisterSessionCommand(typeof(SessionAnalyzer));
     definitionContext.RegisterSessionAnalyzer(typeof(SessionAnalyzer));
     definitionContext.RegisterLogMessageCommand(typeof(AddDefectCommand));
     definitionContext.RegisterSessionSummaryView(typeof(FogBugzSummaryView), "FogBugz Case List", "Find sessions associated with FogBugz cases", null);
     definitionContext.RegisterSessionSummaryView(typeof(FogBugzLookupView), "FogBugz Lookup", "Find sessions associated with a FogBugz Case Id", null);
 }
 public void Register(IGlobalContext context, IExtensionDefinitionContext definitionContext)
 {
     definitionContext.RegisterRepositoryController(typeof(RepositoryController));
     definitionContext.RegisterRepositoryCommand(typeof(RepositoryCommand));
     definitionContext.RegisterSessionCommand(typeof(SessionAnalyzer));
     definitionContext.RegisterSessionAnalyzer(typeof(SessionAnalyzer));
     definitionContext.RegisterLogMessageCommand(typeof(AddDefectCommand));
     definitionContext.RegisterSessionSummaryView(typeof(FogBugzSummaryView), "FogBugz Case List", "Find sessions associated with FogBugz cases", null);
     definitionContext.RegisterSessionSummaryView(typeof(FogBugzLookupView), "FogBugz Lookup", "Find sessions associated with a FogBugz Case Id", null);
 }
 public WorkspaceRibbonAddIn(bool inDesignMode, IRecordContext RecordContext, IGlobalContext globalContext)
 {
     if (!inDesignMode)
     {
         GlobalContext         = globalContext;
         InDesignMode          = inDesignMode;
         this.RecordContext    = RecordContext;
         RecordContext.Saving += new CancelEventHandler(RecordContext_Saving);
     }
 }
        protected override void Init(IGlobalContext context)
        {
            base.Init(context);
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();

            Scheduler = schedulerFactory.GetScheduler().Result;
            //var bus = ConfigureBusRabbitMq(Scheduler);
            //BusCtrl = context.Set(bus);
            //Scheduler.JobFactory = new MassTransitJobFactory(BusCtrl);
        }
Exemple #36
0
        /// <summary>
        /// Sets the oauth headers on an HTTP request.
        /// This may be used multiple times depending on OAuth token cache invalidation performed by run methods.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="globalContext"></param>
        private static void SetAuthHeader(ref HttpRequestMessage request, ref IGlobalContext globalContext)
        {
            OAuthHelper oauth      = OAuthHelper.Instance;
            String      oauthToken = oauth.GetOAuthToken(globalContext);

            request.Headers.Remove(@"Authorization");
            request.Headers.Add(@"Authorization", String.Format(@"Bearer {0}", oauthToken));

            ConfigurationSetting.logWrap.DebugLog(logMessage: "Auth header value: " + oauthToken);
        }
        public void Register(IGlobalContext context, IExtensionDefinitionContext definitionContext)
        {
            //we have to register all of our types during this call or they won't be used at all.
            definitionContext.RegisterSessionAnalyzer(typeof(SessionAnalysisAddInSample));
            definitionContext.RegisterSessionCommand(typeof(SessionAnalysisAddInSample));
            definitionContext.RegisterSessionCommand(typeof(DemoAppAddInSample));
            definitionContext.RegisterLogMessageCommand(typeof(LogMessageCommandSample));
            definitionContext.RegisterGlobalCommand(typeof(GlobalCommandSample));

            //you have to provide more information for views because the user has to be able to pick them without them being created.
            definitionContext.RegisterSessionSummaryView(typeof(SessionSummaryViewAddInSample), "Session Search", "Find sessions based on their description, user, host, or command line information", null);
            definitionContext.RegisterSessionView(typeof(SessionViewAddInSample), "Exceptions", "Displays all of the exceptions in the session", null);
        }
 public bool Initialize(IGlobalContext context)
 {
     _globalContext = context;
     ConfigurationSetting instance = ConfigurationSetting.Instance(context);
     if (!ConfigurationSetting.configVerbPerfect)
     {
         string logMessage = "All Accelerator Add-Ins are not initialized properly because of invalid config verb.";
         ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage);
         return false;
     }
     else
         return true;
 }
        /// <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 WorkspaceAddIn(bool inDesignMode, IRecordContext recordContext, IGlobalContext globalContext, string version)
        {
            // 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 OrderManagementControl(new Proxy(this));
                _Model = bulkImportControl._Model;
                _Model.InDesignMode = inDesignMode;
                _Model.Version = version;
                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.Order.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.Order.GetOrderURL = ConfigurationSetting.GetOrder_WSDL;
                Accelerator.EBS.SharedServices.Order.OrderInboundURL = ConfigurationSetting.OrderInboundURL_WSDL;
                Accelerator.EBS.SharedServices.Order.InitEBSProvider();

                _Model.EbsOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId;

                _recordContext.DataLoaded += _rContext_DataLoaded;
                _recordContext.Closing += _recordContext_Closing;
                _recordContext.Saving += _recordContext_Saving;
                _gContext.AutomationContext.CurrentEditorTabChanged += AutomationContext_CurrentEditorTabChanged;
            }
        }
 /// <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 ContactWorkspaceAddIn(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
     {
         _recordContext = RecordContext;
         _globalContext = GlobalContext;
         _inDesingMode = inDesignMode;
         if (_recordContext != null)
         {
             _recordContext.DataLoaded += _recordContext_DataLoaded;
         }
         // Instantiate the custom control and add it to the panel controls
         _siebelContactSearchControl = new SiebelContactSearchControl(_recordContext, _globalContext);
     }
 }
        /// <summary>
        /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
        /// </summary>
        /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
        /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
        public bool Initialize(IGlobalContext GlobalContext)
        {
            _gContext = GlobalContext;
            ConfigurationSetting.logAssemblyVersion(Assembly.GetAssembly(typeof(BulkImportViewModel)), null);

            ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext);
            /* log it, but return true because will show the messagebox when the addin is opened in createControl.
             * if return false, the add-in is not loaded, and cannot show the error when add-in is opened.
             */
            if (!ConfigurationSetting.configVerbPerfect)
            {
                string logMessage = "BulkImportAddin is not initialized properly because of invalid config verb.";
                ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage);
            }
            return true;
        }
 public bool Initialize(IGlobalContext context)
 {
     _globalContext = context;
     return true;
 }
        public bool Initialize(IGlobalContext context)
        {
            GlobalContext = context;

            return RightNowConfigService.Config();
        }
        //Retrieve configuration verb via RNow SOAP and Parse it as JSON
        public static bool getConfigVerb(IGlobalContext _gContext)
        {
            //Init the RightNow Service
            //rnSrv = new RightNowService(_gContext);
            //client = rnSrv._rnowClient;
            string logMessage, logNote;

            //Query configuration from Cloud Service
            String query = "select Configuration.Value from Configuration where lookupname='CUSTOM_CFG_Accel_Ext_Integrations'";
            String[] rowData = null;
            try
            {
                rowData = rnSrv.queryData(query);
            }
            catch (Exception ex)
            {
                if (logWrap != null)
                {
                    logMessage = "EBS Integration Configuration verb is not set properly. ";
                    logNote = "Error in query config 'CUSTOM_CFG_Accel_Ext_Integrations' from Cloud Service. Error query: " + query + "; Error Message: " + ex.Message;
                    logWrap.ErrorLog();
                }
                MessageBox.Show("EBS Integration Configuration verb is not set properly. Please contact your system administrator. ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            // Check whether configuration is set
            if (rowData.Length == 0)
            {
                String message = "Integration Configuration verb does not exist. Please contact your system administrator";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (logWrap != null)
                {
                    logMessage = "Integration Configuration verb does not exist.";
                    logNote = "CUSTOM_CFG_Accel_Ext_Integrations is missing in Configuration Settings.";
                    logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);
                }
                return false;
            }

            // Get configuration value
            string jsonString = rowData[0];
            jsonString = jsonString.Replace("\"\"", "\"");

            // get the AdminProfileID
            // make sure it is located before "hosts" (if this is also missing, well, the config
            // verb is in bad shape.
            // can't use "{"AdminProfileID" because { can be followed by newline in config verb       
            if (jsonString.Contains("AdminProfileID") &&
                jsonString.Contains("hosts") &&
                jsonString.IndexOf("AdminProfileID") < jsonString.IndexOf("hosts"))
            {
                // get the AdminProfileID value
                AdminProfileID = Convert.ToInt32(jsonString.Split(',')[0].Split(':')[1]);
            }
            else
            {
                String message = "Integration Configuration verb does not contain AdminProfileID as first member of JSON.\n Please contact your system administrator";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (logWrap != null)
                {
                    logMessage = "Integration Configuration verb does not contain AdminProfileID as first member of JSON";
                    logNote = "The string is: " + jsonString;
                    logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);
                }

                AdminProfileID = 0;
                return false;

            }

            loginUserIsAdmin = _gContext.ProfileId == ConfigurationSetting.AdminProfileID;

            // Parse endpoint configuration
            int i = jsonString.IndexOf("[");
            int j = jsonString.LastIndexOf("]");  
            if (i < 0 || i > j)
            {
                String message = "EBS Integration Configuration verb is not set properly. Please contact your system administrato";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (logWrap != null)
                {
                    logMessage = "EBS Integration Configuration verb is not set properly.";
                    logNote = "Configuration cannot be parsed, the string is: " + jsonString;
                    logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);
                }
                return false;
            }
            string jsonTrim = jsonString.Substring(i, j - i + 1);

            /*  Using Serializer to parse Configuration JSON String  
             *  The parsing is based on the classes definition in the following region
             */
            var serializer = new JavaScriptSerializer();
            List<ConfigurationVerb> configVerbArray = null;
            try
            {
                configVerbArray = serializer.Deserialize<List<ConfigurationVerb>>(jsonTrim);
            }
            catch (System.ArgumentException ex)
            {
                String message = "Accelerator Integration Configuration verb JSON is invalid. Please contact your system administrator";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                logMessage = "Accelerator Integration Configuration verb JSON is invalid.";
                logNote = "Configuration cannot be parsed, the string is: " + jsonString;
                logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);

                return false;
            }
            bool found = false;

            // Get the server url of current site
            string _interfaceUrl = _gContext.InterfaceURL;
            string[] splittedInterfaceUrl = _interfaceUrl.Split('/');
            string _configServerUrl = splittedInterfaceUrl[2];

            // Get values in configuration settings
            foreach (ConfigurationVerb configVerb in configVerbArray)
            {
                if (configVerb.rnt_host.Contains(_configServerUrl))
                {
                    string extBaseUrl = configVerb.integration.ext_base_url;
                    
                    //Get EBS server type and initiate EBS Provider
                    string serverType = configVerb.integration.server_type;
                    EBSProvider = serverTypeToProvider(serverType);

                    username = configVerb.integration.username;
                    password = configVerb.integration.password;
                    ebsServiceUserId = configVerb.integration.ebs_service_user_id;
                    ebsDefaultSrOwnerId = configVerb.integration.ebs_default_sr_owner_id;
                    EBSServiceTimeout = configVerb.integration.EBSServiceTimeout;
                    if (EBSServiceTimeout == 0) // not in config verb, set to no timeout -1
                        EBSServiceTimeout = -1;
                    log_level = configVerb.integration.log_level;
                    assignLogLevelEnum();
                    rnt_host = configVerb.rnt_host;

                    //Prepare the Service Request Type Mapping
                    if (configVerb.integration.request_type_mapping != null)
                    {
                        requestTypeMapping = setRequestTypeMapping(configVerb.integration.request_type_mapping);
                    }

                    incidentsByContactReportID = configVerb.integration.incidentsByContactReportID;
                    contactSearchReportID = configVerb.integration.contactSearchReportID;

                    uspsUsername = configVerb.postalValidation.username;
                    ext_address_validate_url = configVerb.postalValidation.ext_address_validate_url;

                    Dictionary<String, Service> extServices = configVerb.integration.ext_services;
                    foreach (KeyValuePair<String, Service> extService in extServices)
                    {
                        switch (extService.Key)
                        {
                            case "service_request_detail":
                                if (extService.Value.create != null)
                                    CreateSR_WSDL = extBaseUrl + extService.Value.create.relative_path;
                                if (extService.Value.update != null)
                                    UpdateSR_WSDL = extBaseUrl + extService.Value.update.relative_path;
                                if (extService.Value.read != null)
                                    LookupSR_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "service_request_list":
                                if (extService.Value.read != null)
                                    LookupSRbyContactPartyID_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "repair_order_detail":
                                if (extService.Value.create != null)
                                    CreateRepair_WSDL = extBaseUrl + extService.Value.create.relative_path;
                                if (extService.Value.update != null)
                                    UpdateRepair_WSDL = extBaseUrl + extService.Value.update.relative_path;
                                if (extService.Value.read != null)
                                    LookupRepair_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "service_request_note":
                                if (extService.Value.create != null)
                                    CreateInteraction_WSDL = extBaseUrl + extService.Value.create.relative_path;
                                break;
                            case "contact_list":
                                if (extService.Value.read != null)
                                    LookupContactList_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "item_list":
                                if (extService.Value.read != null)
                                    ItemList_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "entitlement_list":
                                if (extService.Value.read != null)
                                    EntitlementList_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "repair_logistics_list":
                                if (extService.Value.read != null)
                                    RepairLogisticsList_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "repair_list":
                                if (extService.Value.read != null)
                                    RepairOrderList_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "order":
                                if (extService.Value.read != null)
                                    GetOrder_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "order_list":
                                if (extService.Value.read != null)
                                    GetOrdersByCust_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                            case "order_save":
                                if (extService.Value.read != null)
                                    OrderInboundURL_WSDL = extBaseUrl + extService.Value.read.relative_path;
                                break;
                        }
                    }
                    found = true; 
                    break;
                }
            }
            
            // If current site is not set in configuration.
            if (!found)
            {
                String message = "The current host, " + _configServerUrl + ", is not present in Integration Configuration verb.\n Please contact your system administrator";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (logWrap != null)
                {
                    logMessage = "Current Host is not present in Integration Configuration verb. ";
                    logNote = "Current site is not set in configuration CUSTOM_CFG_Accel_Ext_Integrations. The configuration verb is: " + jsonString;
                    logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);
                }
                return false;
            }

            configVerbPerfect = true;
            return true;         
        }
 /// <summary>
 /// Called to initialize the command.
 /// </summary>
 /// <param name="context">A standard interface to the hosting environment for the command</param>
 /// <remarks>
 /// If any exception is thrown during this call this command will not be loaded.
 /// </remarks>
 public void Initialize(IGlobalContext context)
 {
     m_AddInContext = context;
 }
        //Using lock and Singleton
        public static ConfigurationSetting Instance(IGlobalContext _gContext)
        {

                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new ConfigurationSetting(_gContext);
                    }
                    return instance;
                }
            
        }
 // Initialize CWSS
 public static void initCWSS(IGlobalContext _gContext)
 {
     rnSrv = new RightNowService(_gContext);
     client = rnSrv._rnowClient;
 }
 // Get the current host url
 public static void getCurrentHost(IGlobalContext _gContext)
 {
     // Get the server url of current site
     string _interfaceUrl = _gContext.InterfaceURL;
     string[] splittedInterfaceUrl = _interfaceUrl.Split('/');
     host = splittedInterfaceUrl[2];
 }
 /// <summary>
 /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
 /// </summary>
 /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
 /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
 public bool Initialize(IGlobalContext GlobalContext)
 {
     return true;
 }
 /// <summary>
 /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
 /// </summary>
 /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
 /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
 public bool Initialize(IGlobalContext GlobalContext)
 {
     _gContext = GlobalContext;
     ConfigurationSetting.logAssemblyVersion(Assembly.GetAssembly(typeof(RepairOrderAddInFactory)), null);
     return true;
 }
 ConfigurationSetting(IGlobalContext gContext)
 {
     _gContext = gContext;
     logHistory = new Queue();
     iconLabelControl = new IconLabelControl(_gContext);
     clearStatusBarTimer = new System.Timers.Timer();
     clearStatusBarTimer.Interval = 5000;
     clearStatusBarTimer.Enabled = true;
     configVerbPerfect = false;
     initCWSS(_gContext);
     getCurrentHost(_gContext);
     initLog();
     getConfigVerb(_gContext);
     getEBSServiceUserId(_gContext);
 }
        /// <summary>
        /// Method which is invoked from the Add-In framework and is used to programmatically control whether to load the Add-In.
        /// </summary>
        /// <param name="GlobalContext">The Global Context for the Add-In framework.</param>
        /// <returns>If true the Add-In to be loaded, if false the Add-In will not be loaded.</returns>
        public bool Initialize(IGlobalContext context)
        {
            _globalContext = context;

            ConfigurationSetting instance = ConfigurationSetting.Instance(_globalContext);
            this.BackColor = System.Drawing.Color.Transparent;
            this.AutoSize = true;
            this.Width = 300;

            this.Controls.Add(ConfigurationSetting.iconLabelControl);

            if (ConfigurationSetting.EBSProvider != null)
            {
                ServiceRequest.ServiceProvider = ConfigurationSetting.EBSProvider;
                ServiceRequest.CreateUpdateURL = ConfigurationSetting.LookupSRbyContactPartyID_WSDL;
                ServiceRequest.LookupURL = ConfigurationSetting.LookupSR_WSDL;
                ServiceRequest.ServiceUsername = ConfigurationSetting.username;
                ServiceRequest.ServicePassword = ConfigurationSetting.password;
                ServiceRequest.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;

                ServiceRequest.InitEBSProvider();

                Accelerator.EBS.SharedServices.ContactModel.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.ContactModel.ListLookupURL = ConfigurationSetting.LookupContactList_WSDL;
                Accelerator.EBS.SharedServices.ContactModel.ServiceUsername = ConfigurationSetting.username;
                Accelerator.EBS.SharedServices.ContactModel.ServicePassword = ConfigurationSetting.password;
                Accelerator.EBS.SharedServices.ContactModel.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;

                Accelerator.EBS.SharedServices.ContactModel.InitEBSProvider();

                Accelerator.EBS.SharedServices.Item.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.Item.ListURL = ConfigurationSetting.ItemList_WSDL;
                Accelerator.EBS.SharedServices.Item.ServiceUsername = ConfigurationSetting.username;
                Accelerator.EBS.SharedServices.Item.ServicePassword = ConfigurationSetting.password;
                Accelerator.EBS.SharedServices.Item.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                Accelerator.EBS.SharedServices.Item.InitEBSProvider();

                Accelerator.EBS.SharedServices.Entitlement.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.Entitlement.ListURL = ConfigurationSetting.EntitlementList_WSDL;
                Accelerator.EBS.SharedServices.Entitlement.ServiceUsername = ConfigurationSetting.username;
                Accelerator.EBS.SharedServices.Entitlement.ServicePassword = ConfigurationSetting.password;
                Accelerator.EBS.SharedServices.Entitlement.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                Accelerator.EBS.SharedServices.Entitlement.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();

                Accelerator.EBS.SharedServices.RepairLogistics.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.RepairLogistics.ListURL = ConfigurationSetting.RepairLogisticsList_WSDL;
                Accelerator.EBS.SharedServices.RepairLogistics.ServiceUsername = ConfigurationSetting.username;
                Accelerator.EBS.SharedServices.RepairLogistics.ServicePassword = ConfigurationSetting.password;
                Accelerator.EBS.SharedServices.RepairLogistics.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout;
                Accelerator.EBS.SharedServices.RepairLogistics.InitEBSProvider();

                Accelerator.EBS.SharedServices.Order.ServiceProvider = ConfigurationSetting.EBSProvider;
                Accelerator.EBS.SharedServices.Order.GetOrderURL = ConfigurationSetting.GetOrder_WSDL;
                Accelerator.EBS.SharedServices.Order.OrderInboundURL = ConfigurationSetting.OrderInboundURL_WSDL;
                Accelerator.EBS.SharedServices.Order.InitEBSProvider();
            }

            if (!ConfigurationSetting.configVerbPerfect)
            {
                string logMessage = "All Accelerator Add-Ins are not initialized properly. Please contact your system administrator.";
                MessageBox.Show(logMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                logMessage = "All Accelerator Add-Ins are not initialized properly because of invalid config verb.";
                ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage);
            }

            return true;
        }
 public IconLabelControl(IGlobalContext gContext)
 {
     InitializeComponent();
     _gContext = gContext;
 }
 /// <summary>
 /// Called to register the extension.
 /// </summary>
 /// <param name="context">A standard interface to the hosting environment for the Extension, provided to all the different extensions that get loaded.</param><param name="definitionContext">Used to register the various types used by the extension.</param>
 /// <remarks>
 /// <para>
 /// If any exception is thrown during this call this Extension will not be loaded.
 /// </para>
 /// <para>
 /// Register each of the other extension types that should be available to end users through appropriate calls to
 ///             the definitionContext.  These objects will be created and initialized as required and provided the same IExtensionContext object instance provided to this
 ///             method to enable coordination between all of the components.
 /// </para>
 /// <para>
 /// After registration the extension definition object is unloaded and disposed.
 /// </para>
 /// </remarks>
 public void Register(IGlobalContext context, IExtensionDefinitionContext definitionContext)
 {
     //we have to register all of our types during this call or they won't be used at all.
     definitionContext.RegisterSessionAnalyzer(typeof(SessionExporter));
     definitionContext.RegisterSessionCommand(typeof(SessionExporter));
 }
        // Get the CWSS_API_EBS_Service_User ID
        public void getEBSServiceUserId(IGlobalContext _gContext)
        {
            string query = "select Account.ID from Account where Login='******'";

            String[] rowData = null;
            try
            {
                rowData = rnSrv.queryData(query);
            }
            catch (Exception ex)
            {
                String message = "Error in query default EBS user id from Cloud Service. Please contact the administrator.";
                if (logWrap != null)
                {
                    string logMessage = "Error in query default EBS user id from Cloud Service. ";
                    string logNote = "Error query: " + query + "; Error message: " + ex.Message;
                    logWrap.ErrorLog(logMessage: logMessage, logNote: logNote);
                }
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                
                return;
            }

            // Check whether account CWSS_API_EBS_Service_User is set in Staff
            if (rowData.Length == 0)
            {
                cwssApiEbsServiceUserId = 0;
                return;
            }
            string jsonString = rowData[0];

            cwssApiEbsServiceUserId = Convert.ToInt32(jsonString);
        }