Ejemplo n.º 1
0
        public void UpdateClients(string propertyName, Dictionary <string, object> values)
        {
            InitOnece();
            PropertyInfo propertyInfo = typeof(ClientData).GetProperty(propertyName);

            if (propertyInfo != null)
            {
                if (propertyInfo.PropertyType == typeof(Guid))
                {
                    foreach (var kv in values)
                    {
                        values[kv.Key] = VirtualRoot.ConvertToGuid(kv.Value);
                    }
                }
                foreach (var kv in values)
                {
                    string objectId = kv.Key;
                    object value    = kv.Value;
                    if (_dicByObjectId.TryGetValue(objectId, out ClientData clientData))
                    {
                        propertyInfo.SetValue(clientData, value, null);
                        clientData.ModifiedOn = DateTime.Now;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void UpdateClient(string objectId, string propertyName, object value)
 {
     InitOnece();
     if (objectId == null)
     {
         return;
     }
     if (_dicByObjectId.TryGetValue(objectId, out ClientData clientData))
     {
         PropertyInfo propertyInfo = typeof(ClientData).GetProperty(propertyName);
         if (propertyInfo != null)
         {
             if (propertyInfo.PropertyType == typeof(Guid))
             {
                 value = VirtualRoot.ConvertToGuid(value);
             }
             propertyInfo.SetValue(clientData, value, null);
             clientData.ModifiedOn = DateTime.Now;
         }
     }
 }