} // method internal int GetInstanceSize() { int retVal = 0; int szInt = sizeof(int), szDate = 8; // Id, Number, Uid, CreateDate, HallName, TableName, Waiter, DivisionColorRGB, OrderStatusId, // WaitingTimerString retVal = szInt + szInt + (Uid.IsNull()?0:Uid.Length) + szDate + (HallName.IsNull() ? 0 : HallName.Length) + (TableName.IsNull() ? 0 : TableName.Length) + (Waiter.IsNull() ? 0 : Waiter.Length) + (DivisionColorRGB.IsNull() ? 0 : DivisionColorRGB.Length) + szInt + (WaitingTimerString.IsNull() ? 0 : WaitingTimerString.Length); int szDishes = 0; foreach (OrderDishModel dish in this.Dishes.Values) { szDishes += dish.GetInstanceSize(); } retVal += szDishes; return(retVal); }
} // constructor internal int GetInstanceSize() { int retVal = 0; int szInt = sizeof(int), szDate = 8, szDecimal = 16; // Id, Uid, CreateDate, Name, FilingNumber, Quantity, ParentUid, Comment, // EstimatedTime, DelayedStartTime, DishStatusId, DepartmentId, // ServiceErrorMessage // WaitingTimerString - 14 retVal = szInt + (Uid.IsNull() ? 0 : Uid.Length) + szDate + (Name.IsNull() ? 0 : Name.Length) + szInt + szDecimal + (ParentUid.IsNull() ? 0 : ParentUid.Length) + (Comment.IsNull() ? 0 : Comment.Length) + szInt + szInt + szInt + szInt + (ServiceErrorMessage.IsNull() ? 0 : ServiceErrorMessage.Length) + (WaitingTimerString.IsNull() ? 0 : WaitingTimerString.Length); return(retVal); }