//# __________ PROTOCOL :: PUBLIC __________ #// public VmItemManifest AddItem( VmTag tag, int itemManifestFileIndex, int nestId, double kilograms) { lock( this ) { String tagValue = tag.Value; VmItemManifest im = new VmItemManifest(); im.TagValue = tag.Value; im.ItemId = VmAirportData.Default.AirportOutputData.IdentityFile.GetNextIdentity(); im.NestId = nestId; im.Kilograms = kilograms; im.FirstTouchTimestamp = JwTimestamp.CreateNowUtc(); VmAirportData.Default.AirportOutputData.ItemManifestFile.InsertAt(im, itemManifestFileIndex); VmItemReverseManifest rim = new VmItemReverseManifest(); rim.ItemId = im.ItemId; rim.TagValue = im.TagValue; VmAirportData.Default.AirportOutputData.ItemReverseManifestFile.InsertWhereAppropriate(rim.ItemId+"", rim); return im; } }
//# __________ PROTOCOL :: PUBLIC (NESTED ITEMS)__________ #// public void AddItemToNest(VmItemManifest item, int nestId) { if( nestId == -1 ) { item.NestId = -1; return; } _AddNestedItem(item, nestId); item.NestId = nestId; VmItemManager.Default.UpdateItem(item); }
public void UpdateItem(VmItemManifest item) { lock( this ) { VmAirportData.Default.AirportOutputData.ItemManifestFile.ReplaceWith( item.TagValue, item); } }
//# __________ PROTOCOL :: PRIVATE (NESTED ITEM) __________ #// public void _RemoveNestedItem(VmItemManifest item, int nestId) { if( nestId == -1 ) return; VmAirportData.Default.AirportOutputData.GetNestedItemFile(nestId).Delete(item.ItemId+""); VmNest n = GetNest(nestId); n.RemoveTag(item.Kilograms); }
public void _AddNestedItem(VmItemManifest item, int nestId) { VmNestedItem ni = new VmNestedItem(); ni.ItemId = item.ItemId; ni.Kilograms = item.Kilograms; VmAirportData.Default.AirportOutputData.GetNestedItemFile(nestId).InsertWhereAppropriate(item.ItemId+"", ni); VmNest n = GetNest(nestId); n.AddTag(item.Kilograms); }
public void RemoveItemFromNest(VmItemManifest item) { _RemoveNestedItem(item, item.NestId); item.NestId = -1; VmItemManager.Default.UpdateItem(item); }
public void MoveItemToNest( VmItemManifest im, int newNestId) { int oldNestId = im.NestId; _RemoveNestedItem(im, oldNestId); AddItemToNest(im, newNestId); }