public void ShowCellData(SchemaCellData data, SchemaCellFields fields) { W.WriteLineAligned("this is| ", "CSToolsDelux"); W.WriteLineAligned("this is| ", $"{documentName}"); W.WriteLineAligned("Show Cell data| ", "type 1"); W.WriteAligned("\n"); string name; string type; string value; for (int i = 0; i < data.Data.Count; i++) { foreach (SchemaCellKey key in fields.KeyOrder) { data.Index = i; name = data.Data[key].FieldDef.Name; value = data.Data[key].ValueString; type = data.Data[key].ValueType.Name; W.WriteLineAligned($"key| {key}| ", formatFieldInfo(name, type, value)); } } W.WriteAligned("\n"); W.WriteLineAligned("Show Cell data| ", "finished"); W.WriteAligned("\n"); W.ShowMsg(); }
private void reset() { DocKey = null; DataStorage = null; Entity = null; Schema = null; RootAppData = null; CellData = null; }
public void Config(string docKey, DataStorage ds) { reset(); DocKey = docKey; DataStorage = ds; RootAppData = new SchemaRootAppData(); CellData = new SchemaCellData(); }
public ExStoreRtnCodes WriteRootAppData(SchemaRootAppData raData, SchemaCellData cData, DataStorage ds) { Transaction t = null; string docKey = exData.DocKey; ExStoreRtnCodes result = ExStoreRtnCodes.XRC_FAIL; raData.SetValue(SchemaRootAppKey.RAK_NAME, docKey); try { bool answer = scMgr.MakeRootAppSchema(docKey, raData, cData.DataList.Count); if (!answer) { return(ExStoreRtnCodes.XRC_FAIL); } Schema schema = scMgr.SchemaList[docKey].Schema; Entity e = new Entity(schema); scMgr.MakeSubSchemasFields(e, schema, cData); writeData(e, schema, raData.Data); writeCellData(e, schema, cData); // 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); }
private Schema makeSubSchema(int idx, Guid guid, SchemaCellData cData) { SchemaBuilder sb = new SchemaBuilder(guid); cData.Index = idx; makeSchemaDef(ref sb, cData.GetValue <string>(SchemaCellKey.CK_NAME), cData.GetValue <string>(SchemaCellKey.CK_DESCRIPTION)); makeSchemaFields(ref sb, cData.Fields); return(sb.Finish()); }
public void MakeSubSchemasFields(Entity entity, Schema schema, SchemaCellData cData) { int idx = 0; foreach (KeyValuePair <string, Guid> kvp in SchemaList[cData.DocKey].SubSchemaFields) { Field f = schema.GetField(kvp.Key); Schema subSchema = makeSubSchema(idx, kvp.Value, cData); Entity subE = new Entity(subSchema); entity.Set(f, subE); idx++; } }
private void writeCellData(Entity entity, Schema schema, SchemaCellData cData) { int j = 0; foreach (KeyValuePair <string, Guid> kvp in scMgr.SchemaList[cData.DocKey].SubSchemaFields) { Field f = schema.GetField(kvp.Key); Entity subE = entity.Get <Entity>(kvp.Key); cData.Index = j++; writeData(subE, subE.Schema, cData.Data); entity.Set(f, subE); } }
public FieldsManager(AWindow w) { W = w; show = new ShowInfo(w); 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"); cData.Configure("Another new name", "B2", UpdateRules.UR_AS_NEEDED, "second cell Family", false, "second xl file path", "second worksheet name"); }
public ExStoreRtnCodes WriteRootApp(SchemaRootAppData raData, SchemaCellData cData) { Transaction T; ExStoreRtnCodes result; using (T = new Transaction(AppRibbon.Doc, "fields")) { T.Start(); result = exMgr.WriteRootAppData(raData, cData, exData.DataStorage); if (result == ExStoreRtnCodes.XRC_GOOD) { T.Commit(); } else { T.RollBack(); } } return(result); }
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"); }