예제 #1
0
 /// <summary>
 /// Actualizes translation.
 /// </summary>
 public void ActualizeTranslation()
 {
     try {
         TranslationActualizer.ActualizeTranslation(TranslationActualizedOn);
         SysSettings.SetDefValue(UserConnection, TranslationActualizedOnSysSettingCode, DateTime.UtcNow);
     } catch (Exception ex) {
         MsgChannelUtilities.PostMessage(UserConnection, TranslationActualizedErrorMessageName, ex.Message);
         throw;
     }
 }
        public virtual void ActualizeTranslation()
        {
            const string translationActualizedOnSysSettingsCode = "TranslationActualizedOn";
            DateTime     dateTime = SysSettings.GetValue <DateTime>(UserConnection, translationActualizedOnSysSettingsCode,
                                                                    DateTime.MinValue);
            DataValueType dataValueType           = UserConnection.DataValueTypeManager.GetDataValueTypeByValueType(typeof(DateTime));
            DateTime      translationActualizedOn = (DateTime)dataValueType.GetValueForSave(UserConnection, dateTime);
            ITranslationActualizersFactory translationActualizersFactory = ClassFactory.Get <TranslationActualizersFactory>(
                new ConstructorArgument("userConnection", UserConnection));
            ITranslationActualizer translationActualizer = translationActualizersFactory.GetTranslationActualizer();

            translationActualizer.ActualizeTranslation(translationActualizedOn);
            SysSettings.SetDefValue(UserConnection, translationActualizedOnSysSettingsCode, DateTime.UtcNow);
        }
예제 #3
0
        /// <summary>
        /// Returns bpm'online new email events endpoint uri.
        /// </summary>
        /// <returns>Bpm'online new email events endpoint uri.</returns>
        public string GetBpmEndpointUrl()
        {
            var endpointUrl = SysSettings.GetValue(_uc, "BpmonlineExchangeEventsEndpointUrl", "");

            if (endpointUrl.IsEmpty())
            {
                endpointUrl = GetNewBpmonlineExchangeEventsEndpointUrl();
                SysSettings.SetDefValue(_uc, "BpmonlineExchangeEventsEndpointUrl", endpointUrl);
            }
            if (endpointUrl.IsEmpty())
            {
                throw new InvalidObjectStateException("Bpmonline exchange events endpoint url cannot be created. " +
                                                      "Fill BpmonlineExchangeEventsEndpointUrl system setting.");
            }
            return(endpointUrl);
        }
예제 #4
0
        /// <summary>
        /// Start event tracking.
        /// </summary>
        /// <param name="userConnection">UserConnection.</param>
        /// <param name="apiKey">Api key.</param>
        /// <returns>Result code.</returns>
        public static int StartTracking(UserConnection userConnection, string apiKey)
        {
            var    apiKeyRequest      = new ApiKeyRequest();
            string eventTrackingLogin = SysSettings.GetValue(userConnection,
                                                             "EventTrackingLogin").ToString();
            string eventTrackingPassword = SysSettings.GetValue(userConnection,
                                                                "EventTrackingPassword").ToString();

            SysSettings.SetDefValue(userConnection, "EventTrackingApiKey", apiKey);
            string eventTrackingWebAppUrl = SysSettings.GetValue(userConnection,
                                                                 "EventTrackingWebAppUrl").ToString() + "/SetupTracking?format=json";
            string bpmUrl = SysSettings.GetValue(userConnection,
                                                 "BpmEventTrackingServiceUrl").ToString();
            string bpmAuthKey = SysSettings.GetValue(userConnection,
                                                     "BpmAuthKey").ToString();

            if (string.IsNullOrEmpty(bpmUrl) || string.IsNullOrEmpty(bpmAuthKey))
            {
                return((int)EventTrackingResult.SysSettingIsEmpty);
            }
            var trackingDomainESQ        = new EntitySchemaQuery(userConnection.EntitySchemaManager, "TrackingDomain");
            var nameColumn               = trackingDomainESQ.AddColumn("Name");
            var trackingDomainCollection = trackingDomainESQ.GetEntityCollection(userConnection);

            apiKeyRequest.TrackingDomainList = trackingDomainCollection.Select(item =>
                                                                               item.GetColumnValue(nameColumn.Name).ToString()).ToList();
            if (!apiKeyRequest.TrackingDomainList.Any())
            {
                return((int)EventTrackingResult.DomainIsEmpty);
            }
            apiKeyRequest.SetBasicAuth(eventTrackingLogin, eventTrackingPassword);
            apiKeyRequest.SetRequestMethod("POST");
            apiKeyRequest.ApiKey     = apiKey;
            apiKeyRequest.BpmAuthKey = bpmAuthKey;
            apiKeyRequest.BpmUrl     = bpmUrl;
            int result = apiKeyRequest.Execute(eventTrackingWebAppUrl);

            if (!apiKeyRequest.Success)
            {
                return((int)EventTrackingResult.OtherError);
            }
            EventTypePostProcess.SetEventType(userConnection);
            return(result);
        }