protected async override Task Ready() { var Data = ShowPage.GetDataFrom(GetDataString()); var TableInfo = TableFinder.FindTable(Data.TableName); if (Data.RelationName == "") { MainElement.ReplaceChilds(TableInfo.MakeShowViewForItems( OnUpdate: (c) => { new UpdatePage().Show(c.TableInfo.TableName, c.Key); }, OnDelete: (c) => { c.TableInfo.Delete(c.Key); this.Ready(); })); } else { var RelationInfo = TableInfo.FindRelation(Data.RelationName); MainElement.ReplaceChilds(RelationInfo.MakeShowViewForItems(Data.ItemKey, OnUpdate: (c) => { new UpdatePage().Show(c.TableInfo.TableName, c.Key); }, OnDelete: (c) => { c.TableInfo.Delete(c.Key); this.Ready(); })); } }
protected async override Task Ready() { var Data = GetDataString(); var SpratorPos = Data.IndexOf(","); var TableName = Data.Substring(0, SpratorPos); var Key = Uri.UnescapeDataString(Data.Substring(SpratorPos + 1)); var TableInfo = TableFinder.FindTable(TableName); MainElement.ReplaceChilds(TableInfo.MakeEditView(Key, () => js.GoBack())); }
public static HTMLElement MakeInsertView <ValueType, KeyType>( this Table <ValueType, KeyType> Table, Action Done = null) where KeyType : IComparable <KeyType> { var TableInfo = TableFinder.FindTable(Table.TableName); return((Table, Value : default(ValueType)).MakeEditView( (c) => { TableInfo.Insert(c.NewValue.Value); Done?.Invoke(); })); }
public static HTMLElement MakeInsertView <ValueType, KeyType>( this PartOfTable <ValueType, KeyType> Table, Action Done = null) where KeyType : IComparable <KeyType> { var TableInfo = TableFinder.FindTable((string)Table.HolderTable.Table.TableName); var RelationInfo = TableInfo.FindRelation(Table.TableName); return((Table, Value : default(ValueType)).MakeEditView( (c) => { RelationInfo.Insert(Table.HolderTable.Key, c.NewValue.Value); Done?.Invoke(); })); }
public static HTMLElement MakeEditView <ValueType, KeyType>( this Table <ValueType, KeyType> Table, KeyType Key, Action Done = null) where KeyType : IComparable <KeyType> { var Value = Table[Key].Value; var TableInfo = TableFinder.FindTable(Table.TableName); return((Table, Value).MakeEditView( (c) => { TableInfo.Update(Key, c.NewValue.Value); Done?.Invoke(); })); }
public static async Task SyncUpdate <ValueType, KeyType>( this Table <ValueType, KeyType> Table) where KeyType : IComparable <KeyType> { if (Table == null) { throw new Exception("Table is null!"); } switch (Table) { case PartOfTable <ValueType, KeyType> : var PartTable = Table as PartOfTable <ValueType, KeyType>; await Remote( async (c) => { var Info = await c.GetData <(string TableName, object Key, string RealtionName)>(); await TableFinder.FindTable(Info.TableName) .FindRelation(Info.RealtionName) .SendUpdate(Info.Key, c); }, async (c) => { await c.SendData(( (string)PartTable.HolderTable.Table.TableName, PartTable.HolderTable.Key, PartTable.TableName)); await c.GetUpdate(Table); }); break; case Table <ValueType, KeyType> : await Remote( async (c) => { var TableName = await c.GetData <string>(); await TableFinder.FindTable(TableName).SendUpdate(c); }, async (c) => { await c.SendData(Table.TableName); await c.GetUpdate(Table); }); break; } }
protected async override Task Ready() { var Data = ShowPage.GetDataFrom(GetDataString()); var TableInfo = TableFinder.FindTable(Data.TableName); if (Data.RelationName == "") { MainElement.ReplaceChilds(TableInfo.MakeInsertView(() => js.GoBack())); } else { var RelationInfo = TableInfo.FindRelation(Data.RelationName); MainElement.ReplaceChilds(RelationInfo.MakeInsertView( Data.ItemKey, () => js.GoBack())); } }