Exemplo n.º 1
0
        public ExStoreMgr()
        {
            ExStorageTests.location = 100;

            XRoot = ExStoreRoot.Instance();
            XApp  = ExStoreApp.Instance();

            Initialize();
            Configure();
        }
Exemplo n.º 2
0
        public ExStoreRtnCodes WriteAppAndCellsData(ExStoreApp xApp, ExStoreCell xCell, DataStorage ds)
        {
            Transaction t = null;

            try
            {
                // SchemaBuilder sb = new SchemaBuilder(xApp.ExStoreGuid);
                //
                // makeSchemaDef(sb, xApp.Name, xApp.Description);
                //
                // makeSchemaFields(sb, xApp.Data);
                //
                // makeSchemaSubSchemaFields(sb, xCell);

                // Schema schema = sb.Finish();
                Schema schema =
                    MakeAppSchema(xApp, xCell);
                // GetAppSchemaCurr();

                Entity e = new Entity(schema);

                makeSubSchemasFields(e, schema, xCell);

                writeData(e, schema, xApp.Data);
                writeCellData(e, schema, xCell);

                // using (t = new Transaction(AppRibbon.Doc, "Save Cells Default Config Info"))
                // {
                //  t.Start();
                ds.SetEntity(e);
                //  t.Commit();
                // }
            }
            catch (InvalidOperationException ex)
            {
                if (t != null && t.HasStarted())
                {
                    t.RollBack();
                    t.Dispose();
                }

                if (ex.HResult == -2146233088)
                {
                    return(ExStoreRtnCodes.XRC_DUPLICATE);
                }

                return(ExStoreRtnCodes.XRC_FAIL);
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }
Exemplo n.º 3
0
        public bool GetAppEntity(ExStoreApp xApp, ExStoreCell xCell, out Entity e, out DataStorage ds)
        {
            ExStorageTests.location = 260;
            e  = null;
            ds = null;

            Schema schema =
                MakeAppSchema(xApp, xCell);

            if (schema == null)
            {
                return(false);
            }

            ExStorageTests.location = 265;
            return(DsMgr.GetDataStorage(schema, out e, out ds));
        }
Exemplo n.º 4
0
        /*
         * update method
         * get new data
         * erase schema
         * save new data
         */

        public ExStoreRtnCodes UpdateCellData(ExStoreApp xApp, ExStoreCell xCell, DataStorage ds)
        {
            ExStoreRtnCodes result;

            result = DeleteAppSchema();

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            result = WriteAppAndCellsData(xApp, xCell, ds);

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }
Exemplo n.º 5
0
        public ExStoreRtnCodes ReadAppData(ref ExStoreApp xApp)
        {
            Entity e;
            Schema s;

            ExStoreRtnCodes result = getAppSchemaAndEntity(out e, out s);

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            result = ReadData <SchemaAppKey, SchemaDictionaryApp, SchemaDictionaryApp>(e, s, xApp);

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }
Exemplo n.º 6
0
        public Schema MakeAppSchema(ExStoreApp xApp, ExStoreCell xCell)
        {
            ExStorageTests.location = 270;
            Schema schema = null;

            try
            {
                // schema = Schema.Lookup(xApp.ExStoreGuid);
                //
                // if (schema != null) return schema;

                SchemaBuilder sb = new SchemaBuilder(xApp.ExStoreGuid);

                ExStorageTests.location = 273;
                makeSchemaDef(ref sb, xApp.Name, xApp.Description);

                ExStorageTests.location = 275;
                makeSchemaFields(ref sb, xApp.Data);

                if (xCell != null)
                {
                    ExStorageTests.location = 277;
                    makeSchemaSubSchemaFields(ref sb, xCell);
                }

                ExStorageTests.location = 278;
                schema = sb.Finish();
            }
            catch (Exception e)
            {
                string ex  = e.Message;
                string iex = e?.InnerException.Message ?? "none";

                return(null);
            }

            ExStorageTests.location = 279;
            return(schema);
        }