internal void UpdateDescriptions(MenuCommandParameters menuInfo, string name) { try { using (IRepository repository = Helpers.DataConnectionHelper.CreateRepository(menuInfo.DatabaseInfo)) { var tableDesc = ExplorerControl.DescriptionCache.Where(d => d.Object == name && d.Parent == null).Select(d => d.Description).SingleOrDefault(); DescriptionDialog ro = new DescriptionDialog(tableDesc); ro.ColumnsInfo = GetSiblingColumnInfo(repository, name); ro.ShowModal(); if (ro.DialogResult.HasValue && ro.DialogResult.Value == true) { //save table description new Helpers.DescriptionHelper().SaveDescription(menuInfo.DatabaseInfo, ExplorerControl.DescriptionCache, ro.TableDescription, null, menuInfo.Name); //save all columns foreach (var item in ro.ColumnsInfo) { new Helpers.DescriptionHelper().SaveDescription(menuInfo.DatabaseInfo, ExplorerControl.DescriptionCache, item.Description, name, item.Name); } ExplorerControl.DescriptionCache = new Helpers.DescriptionHelper().GetDescriptions(menuInfo.DatabaseInfo); ((ExplorerControl)ParentWindow.Content).RefreshTables(menuInfo.DatabaseInfo); Helpers.DataConnectionHelper.LogUsage("TableUpdateDescriptions"); } } } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false); } }
public void AddDescription(object sender, ExecutedRoutedEventArgs e) { var databaseInfo = ValidateMenuInfo(sender); if (databaseInfo == null) return; try { using (IRepository repository = Helpers.DataConnectionHelper.CreateRepository(databaseInfo.DatabaseInfo)) { string desc = null; ExplorerControl.DescriptionCache = new Helpers.DescriptionHelper().GetDescriptions(databaseInfo.DatabaseInfo); desc = ExplorerControl.DescriptionCache.Where(d => d.Object == null && d.Parent == null).Select(d => d.Description).SingleOrDefault(); DescriptionDialog ro = new DescriptionDialog(desc); ro.IsDatabase = true; ro.ShowModal(); if (ro.DialogResult.HasValue && ro.DialogResult.Value == true && !string.IsNullOrWhiteSpace(ro.TableDescription) && ro.TableDescription != desc) { new Helpers.DescriptionHelper().SaveDescription(databaseInfo.DatabaseInfo, ExplorerControl.DescriptionCache, ro.TableDescription, null, null); } Helpers.DataConnectionHelper.LogUsage("DatabaseAddDescription"); } } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, databaseInfo.DatabaseInfo.DatabaseType, false); } }