//public void UpdateBlockName(int index, string name) //{ // Blocks[index].Name = name; // if (Blocks[index].ImplementationInfo.IsSettled) // { // Blocks[index].ImplementationInfo.Unsettle(); // } //} public override void Commit(EarthworkBlockingForm storage) { BlockIdIndexMapper = new Dictionary <int, int>(); int index = 0; foreach (var block in Blocks) { BlockIdIndexMapper.Add(block.Id, index); index++; if (block.IsChanged) { block.Commit(storage); } } FaceRecorderForRevit recorder = PMSoftHelper.GetRecorder(nameof(EarthworkBlockingForm), storage.m_Doc); var jsonObj = JsonConvert.SerializeObject(this); recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking_Size, 1), jsonObj.Length.ToString()); recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlocking, 1), jsonObj); foreach (var block in Deletes) { //TODO ???Block的删除或需优化 Block总是新增节点,会造成数据量一致增加 recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock_Size, block.Id), ""); recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlock, block.Id), ""); recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings_Size, block.Id), ""); recorder.WriteValue(SaveKeyHelper.GetSaveKey(SaveKeyHelper.SaveKeyTypeForEarthWork.EarthworkBlockCPSettings, block.Id), ""); } Adds.Clear(); Deletes.Clear(); }
public override void Rollback() { Blocks = new List <EarthworkBlock>(); Blocks.AddRange(Memo.Blocks); BlockIdIndexMapper = Memo.BlockIdIndexMapper; foreach (var Block in Blocks) { Block.Rollback(); } Adds.Clear(); Deletes.Clear(); }
public override void SaveChanges() { base.SaveChanges(); var deleteFilter = DefaultWriteFilter & Builders <T> .Filter.Where(x => Deletes.ToArray().Contains(x.Id)); Collection.DeleteMany(deleteFilter); Deletes.Clear(); Updates.ForEach(ReplaceEntity); Updates.Clear(); }
public override void Rollback() { Name = Memo.Name; Adds.Clear(); Deletes.Clear(); }
/// <summary>Clears all the data from the SuggestionStaging.</summary> public void Clear() { Deletes.Clear(); Nodes.Clear(); }