public ExStoreMgr() { ExStorageTests.location = 100; XRoot = ExStoreRoot.Instance(); XApp = ExStoreApp.Instance(); Initialize(); Configure(); }
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); }
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)); }
/* * 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); }
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); }
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); }