/// <summary> /// Запись значений из RecED в DBDictionary /// В переданном родительском словаре создается вложенный словарь с именем DicED.Name /// </summary> public static void SetDicED(ObjectId idDicParent, [CanBeNull] DicED edDic) { if (edDic == null) { return; } var dicId = GetDic(idDicParent, edDic.Name, true, true); if (!dicId.IsValidEx()) { return; } // Запись списка значений в XRecord if (edDic.Recs != null) { foreach (var item in edDic.Recs) { SetRecXD(dicId, item); } } // Запись вложенных словарей if (edDic.Inners != null) { foreach (var item in edDic.Inners) { SetDicED(dicId, item); } } }
public void AddInner(string name, [CanBeNull] DicED dic) { if (dic != null) { dic.Name = name; AddInner(dic); } }
public void AddInner(string name, DicED dic) { if (dic != null) { dic.Name = name; AddInner(dic); } }
public void AddInner(DicED dic) { if (dic == null || dic.IsEmpty()) return; if (!IsCorrectName(dic.Name)) throw new Exception("Invalid Name - " + dic.Name); if (Inners == null) Inners = new List<DicED>(); Inners.Add(dic); }
public static DicED GetDicEd(ObjectId dicId) { DicED res; if (!dicId.IsValidEx()) { return(null); } using (var dic = dicId.Open(OpenMode.ForRead) as DBDictionary) { if (dic == null) { return(null); } res = new DicED { Inners = new List <DicED>(), Recs = new List <RecXD>() }; foreach (var item in dic) { if (item.Value.ObjectClass == General.ClassRecord) { using (var xrec = item.Value.Open(OpenMode.ForRead) as Xrecord) { if (xrec == null) { continue; } var values = xrec.Data.AsArray(); var rec = new RecXD { Name = item.Key, Values = values.ToList() }; res.Recs.Add(rec); } } else if (item.Value.ObjectClass == General.ClassDBDic) { var dicEdInner = GetDicEd(item.Value); if (dicEdInner != null) { dicEdInner.Name = item.Key; res.Inners.Add(dicEdInner); } } } } return(res); }
public void TestSaveExtDataNOD() { deep = 0; var nod = new DictNOD("Test", true); var rec = new DicED(); rec.Name = "Test"; rec.Recs = GetRecs("RecsTest", 5); rec.Inners = GetInners("InnersTest", 3); nod.Save(rec); }
public void AddInner([CanBeNull] DicED dic) { if (dic == null || dic.IsEmpty()) { return; } if (!IsCorrectName(dic.Name)) { throw new Exception("Invalid Name - " + dic.Name); } if (Inners == null) { Inners = new List <DicED>(); } Inners.Add(dic); }
private List<DicED> GetInners(string name, int number) { var res = new List<DicED>(); if (deep > 3) return res; deep++; for (int i = 0; i < number; i++) { var recEd = new DicED(); recEd.Name = name + i; recEd.Recs = GetRecs("Recs_" + recEd.Name, 5); recEd.Inners = GetInners("Inners_" + recEd.Name, 2); res.Add(recEd); } return res; }
/// <summary> /// Сохранение словаря /// </summary> /// <param name="dicEd">Словарь для сохранения</param> public void Save(DicED dicEd) { if (dicEd == null || string.IsNullOrEmpty(dicEd.Name)) return; var dicId = GetDicPlugin(true); ExtDicHelper.SetDicED(dicId, dicEd); }
public static void SaveDicNOD(this Database db, [NotNull] DicED dic) { var nod = new DictNOD(dic.Name, db); nod.Save(dic); }
/// <summary> /// Сохранение словаря в объект. /// dbo\ExtDic\Pik\Plugin\dic /// </summary> /// <param name="dic">Словарь для сохранения</param> public void Save(DicED dic) { var dicId = GetDicPlugin(true); ExtDicHelper.SetDicED(dicId, dic); }