Example #1
0
 /// <summary>
 /// 取数据Collection
 /// </summary>
 /// <param name="doc"></param>
 /// <returns></returns>
 public static CMModelCollection GetCollection(Document doc)
 {
     Collection = VLDelegateHelper.DelegateTryCatch(
         () =>
     {
         string data = ExtensibleStorageHelper.GetData(doc, CStorageEntity, CStorageEntity.FieldOfData);
         return(new CMModelCollection(data));
     },
         () =>
     {
         return(new CMModelCollection(""));
     }
         );
     return(Collection);
 }
Example #2
0
        /// <summary>
        /// 保存Collection
        /// </summary>
        /// <param name="doc"></param>
        public static bool SaveCollection(Document doc)
        {
            if (Collection == null)
            {
                return(false);
            }
            var data = Collection.ToData();

            return(VLDelegateHelper.DelegateTryCatch(
                       () =>
            {
                ExtensibleStorageHelper.SetData(doc, CStorageEntity, CStorageEntity.FieldOfData, data);
                return true;
            },
                       () =>
            {
                ExtensibleStorageHelper.RemoveStorage(doc, CStorageEntity);
                ExtensibleStorageHelper.SetData(doc, CStorageEntity, CStorageEntity.FieldOfData, data);
                return false;
            }
                       ));
        }