Пример #1
0
     // wrappers for logging
 private void Log(ConfigurationSetting.LogLevelEnum level, string msg, string note, int _RntIncidentId, int _RntContactId)
 {
     string sub = msg + String.Format(" for iid {0}, cid {1}", _RntIncidentId, _RntContactId);
     var log = ConfigurationSetting.logWrap;
     switch(level)
     {
         case ConfigurationSetting.LogLevelEnum.Error:
             log.ErrorLog(_RntIncidentId, _RntContactId, sub, note);
             break;
         case ConfigurationSetting.LogLevelEnum.Notice:
             log.NoticeLog(_RntIncidentId, _RntContactId, sub, note);
             break;
         default:
             log.DebugLog(_RntIncidentId, _RntContactId, sub, note);
             break;
     }
 }
Пример #2
0
 // wrappers for logging
 private void Log(ConfigurationSetting.LogLevelEnum level, string msg, string note)
 {
     var sb = new StringBuilder(string.Format("{0} Order Management ", _Model.ServerType));
     var sub = sb.Append(msg )
         .Append(String.Format(" for iid {0}, cid {1}", _Model.RntIncidentId, _Model.RntContactId))
         .ToString();
     var log = ConfigurationSetting.logWrap;
     switch (level)
     {
         case ConfigurationSetting.LogLevelEnum.Error:
             log.ErrorLog(_Model.RntIncidentId, _Model.RntContactId, sub, note);
             break;
         case ConfigurationSetting.LogLevelEnum.Notice:
             log.NoticeLog(_Model.RntIncidentId, _Model.RntContactId, sub, note);
             break;
         default:
             log.DebugLog(_Model.RntIncidentId, _Model.RntContactId, sub, note);
             break;
     }
 }
        //Using lock and Singleton
        public static ConfigurationSetting Instance(IGlobalContext _gContext)
        {

                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new ConfigurationSetting(_gContext);
                    }
                    return instance;
                }
            
        }
Пример #4
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.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);
        }