Пример #1
0
        public ExStoreMgr(AWindow w, Document doc)
        {
            this.doc = doc;
            W        = w;

            dsMgr  = new DataStoreManager(doc);
            scMgr  = SchemaManager.Instance;
            show   = new ShowInfo(w);
            exData = ExStorData.Instance;
        }
Пример #2
0
        /// <summary>
        /// create a datastorage element and assign the entity
        /// </summary>
        /// <param name="schema"></param>
        /// <param name="e"></param>
        /// <param name="ds"></param>
        /// <returns></returns>
        // public ExStoreRtnCodes CreateDataStorage(Schema schema,
        //  out Entity e, out DataStorage ds)
        // {
        //  e = null;
        //  ds = null;
        //
        //  try
        //  {
        //      ds = DataStorage.Create(doc);
        //
        //      e = new Entity(schema);
        //
        //      ds.SetEntity(e);
        //  }
        //  catch
        //  {
        //      return ExStoreRtnCodes.XRC_FAIL;
        //  }
        //
        //  return ExStoreRtnCodes.XRC_GOOD;
        // }

        // /// <summary>
        // /// find an existing datastorage element
        // /// </summary>
        // /// <param name="schema"></param>
        // /// <param name="ex"></param>
        // /// <param name="dx"></param>
        // /// <returns></returns>
        // public bool GetDataStorage(Schema schema, out Entity ex, out DataStorage dx)
        // {
        //  ex = null;
        //  dx = null;
        //
        //  FilteredElementCollector collector = new FilteredElementCollector(doc);
        //
        //  FilteredElementCollector dataStorages =
        //      collector.OfClass(typeof(DataStorage));
        //
        //  if (dataStorages == null) return false;
        //
        //  foreach (DataStorage ds in dataStorages)
        //  {
        //      Entity e = ds.GetEntity(schema);
        //
        //      if (!e.IsValid()) continue;
        //
        //      ex = e;
        //      dx = ds;
        //
        //      return true;
        //  }
        //
        //  return false;
        // }

        public ExStoreRtnCodes FindDataStorages(string docKey, out IList <DataStorage> dx)
        {
            ExStoreRtnCodes result;
            string          vendIdPrefix = ExStorData.MakeVendIdPrefix();

            dx = new List <DataStorage>(1);
            oldDataStorages = new List <string>();

            IList <DataStorage> dataStorList;

            result = FindDataStorages(out dataStorList);

            foreach (Element ds in dataStorList)
            {
                if (ds.Name.StartsWith(docKey))
                {
                    dx.Add((DataStorage)ds);
                }
                else if (ds.Name.StartsWith(vendIdPrefix))
                {
                    oldDataStorages.Add(ds.Name);
                }
            }

            if (oldDataStorages.Count > 0)
            {
                result = ExStoreRtnCodes.XRC_SEARCH_FOUND_PRIOR;

                if (dx.Count > 0)
                {
                    result = ExStoreRtnCodes.XRC_SEARCH_FOUND_PRIOR_AND_NEW;
                }
            }
            else if (dx.Count > 0)
            {
                result = ExStoreRtnCodes.XRC_GOOD;
            }

            return(result);
        }
Пример #3
0
        public MainFields(Document doc)
        {
            this.doc = doc;

            InitializeComponent();

            fm     = new FieldsManager(this, doc);
            scMgr  = SchemaManager.Instance;
            et     = new ExTests01(this, doc);
            exData = ExStorData.Instance;

            docName = doc.Title;

            // temp to just creata a bogus old DS entry and name
            // docName = "HasDataStorage X";

            // save a local copy
            DocKey        = ExStorData.MakeKey(docName);
            exData.DocKey = docKey;

            // save a record copy
            // DataStoreManager.DocKey = ExStorData.MakeKey(docName);
        }
Пример #4
0
        public FieldsManager(AWindow w, Document doc)
        {
            this.doc = doc;

            W      = w;
            scMgr  = SchemaManager.Instance;
            exMgr  = new ExStoreMgr(w, doc);
            dsMgr  = new DataStoreManager(doc);
            show   = new ShowInfo(w);
            exData = ExStorData.Instance;

            rData = new SchemaRootData();
            rData.Configure(SchemaGuidManager.GetNewAppGuidString());

            aData = new SchemaAppData();
            aData.Configure("App Data Name", "App Data Description");

            raData = new SchemaRootAppData();
            raData.Configure("Root-App Data Name", "Root-App Data Description");

            cData = new SchemaCellData();
            cData.Configure("new name", "A1", UpdateRules.UR_AS_NEEDED,
                            "cell Family", false, "xl file path", "worksheet name");
        }
Пример #5
0
 public DataStoreManager(Document doc)
 {
     this.doc = doc;
     exData   = ExStorData.Instance;
 }