Наследование: IRegistration
Пример #1
0
 private void UpdateRegistrationFromWebHook(string user, WebHook webHook, Registration registration)
 {
     registration.User = user;
     registration.Id = webHook.Id;
     string content = JsonConvert.SerializeObject(webHook, _serializerSettings);
     string protectedData = _protector.Protect(content);
     registration.ProtectedData = protectedData;
 }
Пример #2
0
        private WebHook ConvertToWebHook(Registration registration)
        {
            if (registration == null)
            {
                return null;
            }

            try
            {
                string content = _protector.Unprotect(registration.ProtectedData);
                WebHook webHook = JsonConvert.DeserializeObject<WebHook>(content, _serializerSettings);
                return webHook;
            }
            catch (Exception ex)
            {
                string msg = string.Format(CultureInfo.CurrentCulture, SqlStorageResources.SqlStore_BadWebHook, typeof(WebHook).Name, ex.Message);
                _logger.Error(msg, ex);
            }
            return null;
        }
Пример #3
0
 private Registration ConvertFromWebHook(string user, WebHook webHook)
 {
     string content = JsonConvert.SerializeObject(webHook, _serializerSettings);
     string protectedData = _protector.Protect(content);
     var registration = new Registration
     {
         User = user,
         Id = webHook.Id,
         ProtectedData = protectedData
     };
     return registration;
 }
Пример #4
0
 private WebHook ConvertFromRegistration(Registration registration)
 {
     string content = _protector.Unprotect(registration.ProtectedData);
     WebHook webHook = JsonConvert.DeserializeObject<WebHook>(content, _serializerSettings);
     return webHook;
 }