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); } } } }
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); }
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); }
public void StoreState() { mLastStoredState = GetState(); }