public static TrackableUserDataTrackerSurrogate Convert(TrackablePocoTracker <IUserData> tracker) { if (tracker == null) { return(null); } var surrogate = new TrackableUserDataTrackerSurrogate(); foreach (var changeItem in tracker.ChangeMap) { switch (changeItem.Key.Name) { case "Nickname": surrogate.Nickname = new EnvelopedObject <string> { Value = (string)changeItem.Value.NewValue }; break; case "RegisterTime": surrogate.RegisterTime = new EnvelopedObject <DateTime> { Value = (DateTime)changeItem.Value.NewValue }; break; } } return(surrogate); }
public static TrackablePocoTracker <IUserData> Convert(TrackableUserDataTrackerSurrogate surrogate) { if (surrogate == null) { return(null); } var tracker = new TrackablePocoTracker <IUserData>(); if (surrogate.Name != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.Name, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.Name.Value }); } if (surrogate.RegisterTime != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.RegisterTime, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.RegisterTime.Value }); } if (surrogate.LastLoginTime != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.LastLoginTime, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.LastLoginTime.Value }); } if (surrogate.LoginCount != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.LoginCount, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.LoginCount.Value }); } if (surrogate.PlayCount != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.PlayCount, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.PlayCount.Value }); } if (surrogate.WinCount != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.WinCount, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.WinCount.Value }); } if (surrogate.LoseCount != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.LoseCount, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.LoseCount.Value }); } if (surrogate.DrawCount != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.DrawCount, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.DrawCount.Value }); } return(tracker); }
public static TrackablePocoTracker <IUserData> Convert(TrackableUserDataTrackerSurrogate surrogate) { if (surrogate == null) { return(null); } var tracker = new TrackablePocoTracker <IUserData>(); if (surrogate.Nickname != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.Nickname, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.Nickname.Value }); } if (surrogate.RegisterTime != null) { tracker.ChangeMap.Add(TrackableUserData.PropertyTable.RegisterTime, new TrackablePocoTracker <IUserData> .Change { NewValue = surrogate.RegisterTime.Value }); } return(tracker); }
public static TrackableUserDataTrackerSurrogate Convert(TrackablePocoTracker <IUserData> tracker) { if (tracker == null) { return(null); } var surrogate = new TrackableUserDataTrackerSurrogate(); foreach (var changeItem in tracker.ChangeMap) { switch (changeItem.Key.Name) { case "Name": surrogate.Name = new EnvelopedObject <string> { Value = (string)changeItem.Value.NewValue }; break; case "RegisterTime": surrogate.RegisterTime = new EnvelopedObject <DateTime> { Value = (DateTime)changeItem.Value.NewValue }; break; case "LastLoginTime": surrogate.LastLoginTime = new EnvelopedObject <DateTime> { Value = (DateTime)changeItem.Value.NewValue }; break; case "LoginCount": surrogate.LoginCount = new EnvelopedObject <int> { Value = (int)changeItem.Value.NewValue }; break; case "PlayCount": surrogate.PlayCount = new EnvelopedObject <int> { Value = (int)changeItem.Value.NewValue }; break; case "WinCount": surrogate.WinCount = new EnvelopedObject <int> { Value = (int)changeItem.Value.NewValue }; break; case "LoseCount": surrogate.LoseCount = new EnvelopedObject <int> { Value = (int)changeItem.Value.NewValue }; break; case "DrawCount": surrogate.DrawCount = new EnvelopedObject <int> { Value = (int)changeItem.Value.NewValue }; break; } } return(surrogate); }