public static HoldingsInfo Parse(string str) { int strCnt = 0; HoldingsInfo holdingsInfo = new HoldingsInfo(); string[] strSplit = null; strSplit = str.Split(new char[] { ';' }); strCnt = Parse(holdingsInfo, strSplit, strCnt); return(holdingsInfo); }
public static int Parse(HoldingsInfo holdingsInfo, string[] strSplit, int strCnt) { int count = 0; holdingsInfo.UniqueID = Convert.ToUInt64(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; holdingsInfo.HoldingUser.UniqueID = Convert.ToUInt64(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; holdingsInfo.EventOwner.UniqueID = Convert.ToUInt64(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; holdingsInfo.ItemOwner.UniqueID = Convert.ToUInt64(strSplit[strCnt] == null ? "0" : 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; } UserPermission userPermission = new UserPermission( holdingsInfo.UniqueID, new UserBase(Convert.ToUInt64(strSplit[strCnt++])), (EHoldingPermissions)Convert.ToInt32(strSplit[strCnt++])); holdingsInfo.UserPermissions.Add(userPermission); } count = Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; for (int i = 0; i < count; i++) { if (strSplit[strCnt] == null) { break; } holdingsInfo.HoldingTypes.Add(Convert.ToInt32(strSplit[strCnt])); strCnt++; } holdingsInfo.AllowOverBooking = Convert.ToBoolean(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; holdingsInfo.Scalable = Convert.ToBoolean(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; holdingsInfo.NeedsOwnerApprovel = Convert.ToBoolean(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; holdingsInfo.HoldingApprovel = (EHoldingApprovel)Convert.ToInt32(strSplit[strCnt] == null ? "0" : strSplit[strCnt]); strCnt++; return(strCnt); }
// Exceptions: // System.ArgumentException: // Other object is null // The argument to compare is not a UserBase // Refering object (this) is null public override int CompareTo(object other) { if (other == null) { throw new System.ArgumentException("Other object is null", "other"); } HoldingsInfo holdingsInfo = other as HoldingsInfo; if (holdingsInfo == null) { throw new System.ArgumentException("The argument to compare is not a holdingsInfo", "other"); } if (IsNull)// || (!IsLoaded())) { throw new System.ArgumentException("Refering object (this) is null", "this"); } return(this.ToString().CompareTo(holdingsInfo.ToString())); }