示例#1
0
 public void SetState(VOState pState)
 {
     if (pState != null)
     {
         foreach (PropertyInfo info in mValueObjectInstance.GetType().GetProperties())
         {
             if (info.CanRead && info.CanWrite && mPropertyNames.Contains(info.Name))
             {
                 info.SetValue(mValueObjectInstance, pState.GetMember(info.Name), null);
             }
         }
     }
 }
示例#2
0
        public VOState GetState()
        {
            VOState result = new VOState();

            try
            {
                foreach (PropertyInfo info in mValueObjectInstance.GetType().GetProperties())
                {
                    if (info.CanRead && info.CanWrite && mPropertyNames.Contains(info.Name))
                    {
                        result.SetMember(info.Name, info.GetValue(mValueObjectInstance, null));
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(result);
        }
示例#3
0
        public bool StateIsEqualTo(VOState pState)
        {
            VOState       myState         = GetState();
            List <string> attributes      = myState.GetAttributes();
            List <string> otherAttributes = pState.GetAttributes();

            if (attributes.Count != pState.GetAttributes().Count)
            {
                return(false);
            }

            foreach (string attribute in attributes)
            {
                if (!myState.GetMember(attribute).Equals(pState.GetMember(attribute)) ||
                    !otherAttributes.Remove(attribute))
                {
                    return(false);
                }
            }

            return(true);
        }
示例#4
0
 public void StoreState()
 {
     mLastStoredState = GetState();
 }