public static UserBase Parse(SqlString sqlStr) { if (sqlStr.IsNull) { return(null); } else { int strCnt = 0; int count = 0; UserBase userBase = new UserBase(); string str = Convert.ToString(sqlStr); string[] strSplit = null; strSplit = str.Split(new char[] { ';' }); userBase.UniqueID = Convert.ToUInt64(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; userBase.FirstName = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; userBase.LastName = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; userBase.Email = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; userBase.Phone = strSplit[strCnt] == null ? "" : strSplit[strCnt]; strCnt++; userBase.Gender = (EGender)Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; userBase.Title = (ETitle)Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; strCnt = ObjectLocation.Parse(userBase.Location, strSplit, strCnt); count = Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; for (int i = 0; i < count; i++) { if (strSplit[strCnt] == null) { break; } userBase.HoldingsInfo.Add(new HoldingsInfo(Convert.ToUInt64(strSplit[strCnt]))); strCnt++; } count = Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; for (int i = 0; i < count; i++) { if (strSplit[strCnt] == null) { break; } userBase.Events.Add(new EventBase(Convert.ToUInt64(strSplit[strCnt]))); strCnt++; } return(userBase); } }
public static int Parse(EventBase eventBase, string[] strSplit, int strCnt) { int count = 0; UInt64 eventParentUniqueID = Convert.ToUInt64(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; if (eventParentUniqueID != 0) { eventBase.EventParent = new EventBase(eventParentUniqueID); } count = Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; for (int i = 0; i < count; i++) { if (strSplit[strCnt] == null) { break; } eventBase.EventChildren.Add(new EventBase(Convert.ToUInt64(strSplit[strCnt]))); strCnt++; } count = Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; for (int i = 0; i < count; i++) { if (strSplit[strCnt] == null) { break; } eventBase.ItemChildren.Add(new ItemBase(Convert.ToUInt64(strSplit[strCnt]))); strCnt++; } strCnt = EventTimeInfo.Parse(eventBase.EventTimeInfo, strSplit, strCnt); strCnt = ObjectLocation.Parse(eventBase.EventLocation, strSplit, strCnt); eventBase.IsPublic = Convert.ToBoolean(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; return(strCnt); }