Created
October 8, 2012 15:23
-
-
Save n3dst4/3853093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string ZoneDataJSON | |
{ | |
get | |
{ | |
var newCount = 0L; | |
if (EntityInstance.IsNew()) return BlankZoneDataJSON; | |
var members = IoCContainer.Resolve<IZoneService>(). | |
GetImmediateZoneMembers(this.EntityId).ToList<IZoneMember>(). | |
Select(mem => new | |
{ | |
id = mem.ZoneMemberId, | |
type = GetZoneMemberTypeName(mem.TableCatalogId), | |
entityId = GetMemberId(mem.EntityPrimaryKeyId, ref newCount), | |
pathData = mem.PathData, | |
transformation = mem.Transformation | |
}).ToArray(); | |
return new JavaScriptSerializer().Serialize(new | |
{ | |
floorPlanId = this.EntityInstance.ConceptDocumentId, | |
members = members | |
}); | |
} | |
} | |
private long GetMemberId(long entityPrimaryKeyId, ref long newCount) | |
{ | |
if (entityPrimaryKeyId <= 0) | |
{ | |
if (entityPrimaryKeyId < newCount) | |
newCount = entityPrimaryKeyId; | |
else | |
entityPrimaryKeyId = --newCount; | |
} | |
return entityPrimaryKeyId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment