/// <summary> /// This method is used to create the table /// </summary> /// <param name="query"></param> private string CreateTable(string name, string query, DataSourceTable.eDSTableType DSTableType = DataSourceTable.eDSTableType.GingerKeyValue) { string fileName = string.Empty; try { DataSourceTable dsTableDetails = new DataSourceTable(); dsTableDetails.Name = name; dsTableDetails.DSC = DSDetails.DSC; dsTableDetails.DSTableType = DSTableType; DataSourceTableTreeItem DSTTI = new DataSourceTableTreeItem(); DSTTI.DSTableDetails = dsTableDetails; DSTTI.DSDetails = DSDetails; dsTableDetails.DSC.AddTable(dsTableDetails.Name, query); mTreeView.Tree.AddChildItemAndSelect(this, DSTTI); DSDetails.DSTableList.Add(dsTableDetails); fileName = this.DSDetails.FileFullPath; } catch (Exception ex) { Reporter.ToUser(eUserMsgKey.CreateTableError, ex.Message); Reporter.ToLog(eLogLevel.ERROR, ex.StackTrace); } return(fileName); }
private void AddNewTable(object sender, System.Windows.RoutedEventArgs e) { AddNewTablePage ANTP = new AddNewTablePage(); ANTP.ShowAsWindow(); DataSourceTable dsTableDetails = ANTP.DSTableDetails; if (dsTableDetails != null) { dsTableDetails.DSC = DSDetails.DSC; DataSourceTableTreeItem DSTTI = new DataSourceTableTreeItem(); DSTTI.DSTableDetails = dsTableDetails; DSTTI.DSDetails = DSDetails; if (dsTableDetails.DSTableType == DataSourceTable.eDSTableType.GingerKeyValue) { dsTableDetails.DSC.AddTable(dsTableDetails.Name, "[GINGER_ID] AUTOINCREMENT,[GINGER_KEY_NAME] Text,[GINGER_KEY_VALUE] Text,[GINGER_LAST_UPDATED_BY] Text,[GINGER_LAST_UPDATE_DATETIME] Text"); } else if (dsTableDetails.DSTableType == DataSourceTable.eDSTableType.Customized) { dsTableDetails.DSC.AddTable(dsTableDetails.Name, "[GINGER_ID] AUTOINCREMENT,[GINGER_USED] Text,[GINGER_LAST_UPDATED_BY] Text,[GINGER_LAST_UPDATE_DATETIME] Text"); } mTreeView.Tree.AddChildItemAndSelect(this, DSTTI); DSDetails.DSTableList.Add(dsTableDetails); } }
List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); if (mDataSourcePage == null) { mDataSourcePage = new DataSourcePage(DSDetails); } //Add Data Sources DSDetails.DSTableList = mDataSourcePage.GetTableList(); if (DSDetails.DSTableList == null) { DSDetails.DSTableList = new ObservableList <DataSourceTable>(); } foreach (DataSourceTable dsTable in DSDetails.DSTableList) { DataSourceTableTreeItem DSTTI = new DataSourceTableTreeItem(); DSTTI.DSTableDetails = dsTable; DSTTI.DSDetails = DSDetails; Childrens.Add(DSTTI); } return(Childrens); }
List <ITreeViewItem> ITreeViewItem.Childrens() { List <ITreeViewItem> Childrens = new List <ITreeViewItem>(); //Get Data Source Tables List DSDetails.DSTableList = DSDetails.GetTablesList(); if (DSDetails.DSTableList == null) { DSDetails.DSTableList = new ObservableList <DataSourceTable>(); } foreach (DataSourceTable dsTable in DSDetails.DSTableList) { if (TableTreeView == DataSourceFolderTreeItem.eDataTableView.All || (TableTreeView == DataSourceFolderTreeItem.eDataTableView.Key && dsTable.DSTableType == DataSourceTable.eDSTableType.GingerKeyValue) || (TableTreeView == DataSourceFolderTreeItem.eDataTableView.Customized && dsTable.DSTableType == DataSourceTable.eDSTableType.Customized)) { DataSourceTableTreeItem DSTTI = new DataSourceTableTreeItem(); DSTTI.DSTableDetails = dsTable; DSTTI.DSDetails = DSDetails; Childrens.Add(DSTTI); } } return(Childrens); }