示例#1
0
        public void Resubmit(IBaseMessage msg, bool preserveRetryCount, object userData)
        {
            SystemMessageContext context = new SystemMessageContext(msg.Context);

            if (preserveRetryCount)
            {
                UpdateProperty[] updates = new UpdateProperty[1];
                updates[0]           = new UpdateProperty();
                updates[0].Name      = retryCountProp.Name.Name;
                updates[0].NameSpace = retryCountProp.Name.Namespace;
                updates[0].Value     = context.RetryCount++;

                context.UpdateProperties(updates);

                // If preserveRetryCount is true, ignore RetryInterval
                // Request the redelivery immediately!!
                base.Resubmit(msg, DateTime.Now, userData);
            }
            else
            {
                // This is retry in case of error/failure (i.e. normal retry)
                if (context.RetryCount > 0)
                {
                    DateTime retryAt = DateTime.Now.AddMinutes(context.RetryInterval);
                    base.Resubmit(msg, retryAt, userData);
                }
                else
                {
                    base.MoveToNextTransport(msg, userData);
                }
            }
        }
        public void Resubmit(IBaseMessage msg, bool preserveRetryCount, object userData)
        {
            SystemMessageContext context = new SystemMessageContext(msg.Context);

            if (preserveRetryCount)
            {
                UpdateProperty[] updates = new UpdateProperty[1];
                updates[0] = new UpdateProperty();
                updates[0].Name = retryCountProp.Name.Name;
                updates[0].NameSpace = retryCountProp.Name.Namespace;
                updates[0].Value = context.RetryCount++;

                context.UpdateProperties(updates);

                // If preserveRetryCount is true, ignore RetryInterval
                // Request the redelivery immediately!!
                base.Resubmit(msg, DateTime.Now, userData);
            }
            else
            {
                // This is retry in case of error/failure (i.e. normal retry)
                if (context.RetryCount > 0)
                {
                    DateTime retryAt = DateTime.Now.AddMinutes(context.RetryInterval);
                    base.Resubmit(msg, retryAt, userData);
                }
                else
                {
                    base.MoveToNextTransport(msg, userData);
                }
            }
        }
示例#3
0
        /// <summary>IPC通信.Model</summary>
        public ServerModel(UpdateProperty updateProperty)
        {
            _UpdateProperty = updateProperty;

            // サーバ設定
            _Host = new ServiceHost(this, new System.Uri(Service.GetBaseAddress()));
            _Host.AddServiceEndpoint(typeof(IExecute), new NetNamedPipeBinding(), Service.GetEndpoint());
            _Host.Open();
        }
示例#4
0
        public UpdateTimerValue(UpdateProperty updaterProperty)
        {
            _onPropertyChanged = updaterProperty;

            var timer = new Timer(500);

            timer.Elapsed += (sender, args) => UpdateTimerProperty();
            timer.Start();
        }
示例#5
0
        public async Task UpdateProperty_WhenNonExistingProperty_ReturnsNotFound()
        {
            var updateProperty = new UpdateProperty()
            {
                Name = "Some updated name"
            };

            var response = await UpdateProperty(1111, updateProperty);

            Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
        }
示例#6
0
        public async Task UpdateProperty_WhenUpdatingName_ShouldUpdateProperty(CreateProperty property)
        {
            var createPropertyResponse = await CreateProperty(property);

            var updateProperty = new UpdateProperty()
            {
                Name = "Some updated name"
            };

            var response = await UpdateProperty(createPropertyResponse.Property.Id, updateProperty);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(response.Property);
            Assert.AreEqual(updateProperty.Name, response.Property.Name);
            Assert.AreEqual(createPropertyResponse.Property.Type, response.Property.Type);
        }
示例#7
0
 public IHttpActionResult PutProperty(UpdatePropertyRequest req)
 {
     try
     {
         DAL.Models.Property property = db.Properties.Find(req.Id);
         if (property == null)
         {
             return(NotFound());
         }
         UpdateProperty update = new UpdateProperty();
         return(Ok(update.Update(req)));
     }
     catch (Exception e)
     {
         return(InternalServerError());
     }
 }
 set => SetValue(UpdateProperty, value);
示例#9
0
 /// <summary>解放処理</summary>
 public void Dispose()
 {
     _Host.Close();
     _UpdateProperty = null;
 }
示例#10
0
 public NameValueInfo(String s, UpdateProperty u)
 {
     Name = new Label(s); Value = new TextBox(); Update = u;
 }
示例#11
0
 public NameValueInfo()
 {
     Name = null; Value = null; Update = null;
 }
示例#12
0
 public NameValueInfo(Label l, TextBox v, UpdateProperty u)
 {
     Name = l; Value = v; Update = u;
 }
        internal static void WalkObjectGraph <TAttribute>(object source, bool intoCollections, UpdateProperty action, Stack <object> parentObjectStack = null)
            where TAttribute : Attribute
        {
            if (null == parentObjectStack)
            {
                parentObjectStack = new Stack <object>();
            }
            else
            {
                if (parentObjectStack.Contains(source))
                {
                    // We've already walked this object, so we have a circular reference, let's not overflow the stack.
                    return;
                }
            }
            parentObjectStack.Push(source);

            // Find the properties that are [Sortable]
            var matchingProperties = source.GetType().GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
                                     .Where(p => p.GetCustomAttributes <TAttribute>(true).Any());

            foreach (var prop in matchingProperties)
            {
                action(prop, source, parentObjectStack);
            }

            // Recurse into the properties of this object that might also be sortable
            var objectProperties = source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => p.PropertyType.IsClass);

            foreach (var prop in objectProperties)
            {
                if (!prop.CanRead || !prop.CanWrite)
                {
                    continue;
                }

                object value;
                try
                {
                    value = prop.GetValue(source);
                } catch (Exception)
                {
                    continue;
                }
                if (null != value)
                {
                    if (intoCollections && value is IEnumerable && !(value is string))
                    {
                        foreach (var obj in (IEnumerable)value)
                        {
                            WalkObjectGraph <TAttribute>(obj, intoCollections, action, parentObjectStack);
                        }
                    }
                    else if (!(value is IEnumerable))
                    {
                        WalkObjectGraph <TAttribute>(value, intoCollections, action, parentObjectStack);
                    }
                }
            }
            parentObjectStack.Pop();
        }
示例#14
0
        public async Task <(Property Property, HttpStatusCode StatusCode)> UpdateProperty(int propertyId, UpdateProperty property)
        {
            using (var content = new StringContent(JsonConvert.SerializeObject(property), Encoding.UTF8, "application/json"))
            {
                var response = await Client.PutAsync($"properties/{propertyId}/", content);

                return(SerializationHelpers.GetEntityFromStream <Property>(await response.Content.ReadAsStreamAsync()), response.StatusCode);
            }
        }