Пример #1
0
 protected override void InternalRefresh()
 {
     Dataphoria.ExecuteScript("System.RefreshLibraries();");
     base.InternalRefresh();
     RefreshCurrent();
     RefreshRegistered();
 }
Пример #2
0
 private void SetAsCurrentClicked(object sender, EventArgs args)
 {
     if (Registered && !Current)
     {
         Dataphoria.ExecuteScript(String.Format("System.SetLibrary('{0}');", _libraryName));
         ((LibraryListNode)Parent).RefreshCurrent();
     }
 }
Пример #3
0
 private void UpdateReconciliationMode()
 {
     Dataphoria.ExecuteScript
     (
         String.Format
         (
             "alter device .{0} alter reconciliation {{ mode = {{ {1} }} }};",
             ObjectName,
             DAE.Language.D4.ReconcileMode.None |
             (LStartup.Checked ? DAE.Language.D4.ReconcileMode.Startup : DAE.Language.D4.ReconcileMode.None) |
             (LCommand.Checked ? DAE.Language.D4.ReconcileMode.Command : DAE.Language.D4.ReconcileMode.None) |
             (LAutomatic.Checked ? DAE.Language.D4.ReconcileMode.Automatic : DAE.Language.D4.ReconcileMode.None)
         )
     );
 }
Пример #4
0
 public void MoveFromDocument(string libraryName, string documentName)
 {
     Dataphoria.CheckDocumentOverwrite(LibraryName, documentName);
     Dataphoria.ExecuteScript
     (
         String.Format
         (
             ".Frontend.MoveDocument('{0}', '{1}', '{2}', '{3}');",
             DAE.Schema.Object.EnsureRooted(libraryName),
             DAE.Schema.Object.EnsureRooted(documentName),
             DAE.Schema.Object.EnsureRooted(LibraryName),
             documentName
         )
     );
     ReconcileChildren();
 }
Пример #5
0
        public void CopyFromDocument(string libraryName, string documentName)
        {
            string newDocumentName = FindUniqueDocumentName(LibraryName, documentName);

            Dataphoria.ExecuteScript
            (
                String.Format
                (
                    ".Frontend.CopyDocument('{0}', '{1}', '{2}', '{3}');",
                    DAE.Schema.Object.EnsureRooted(libraryName),
                    DAE.Schema.Object.EnsureRooted(documentName),
                    DAE.Schema.Object.EnsureRooted(LibraryName),
                    newDocumentName
                )
            );
            ReconcileChildren();
        }
Пример #6
0
 private void ExecuteClicked(object sender, EventArgs args)
 {
     using
     (
         DAE.Runtime.Data.IScalar script =
             Dataphoria.FrontendSession.Pipe.RequestDocument
             (
                 String.Format
                 (
                     ".Frontend.Load('{0}', '{1}')",
                     DAE.Schema.Object.EnsureRooted(LibraryName),
                     DAE.Schema.Object.EnsureRooted(DocumentName)
                 )
             )
     )
     {
         Dataphoria.ExecuteScript(script.AsString);
     }
 }
Пример #7
0
        protected virtual void Drop()
        {
            // Confirm the deletion
            Frontend.Client.Windows.IWindowsFormInterface form =
                Dataphoria.FrontendSession.LoadForm
                (
                    null,
                    ".Frontend.Form('Frontend', 'DropDependents')"
                );
            try
            {
                Frontend.Client.ISource source = (Frontend.Client.ISource)form.FindNode("Dependents");
                source.Expression =
                    String.Format
                    (
                        @"	
							DependentObjects('{0}')
								over {{ Level, Sequence, Object_Description }}
								rename {{ Object_Description Description }}
								order by {{ Level desc, Sequence }}
						"                        ,
                        ObjectName
                    );
                source.Enabled = true;
                if (form.ShowModal(Frontend.Client.FormMode.Query) != DialogResult.OK)
                {
                    throw new AbortException();
                }
            }
            finally
            {
                form.HostNode.Dispose();
            }

            // Emit and execute the drop script
            using (DAE.Runtime.Data.Scalar script = (DAE.Runtime.Data.Scalar)Dataphoria.EvaluateQuery(GetScriptDropExpression()))
                Dataphoria.ExecuteScript(script.AsString);

            ParentList.Refresh();
        }
Пример #8
0
 private void SwitchFromSQL()
 {
     Dataphoria.ExecuteScript("SetLanguage('D4');");
 }
Пример #9
0
 private void SwitchToSQL()
 {
     Dataphoria.ExecuteScript("SetLanguage('RealSQL');");
 }
Пример #10
0
 private void UpgradeLibraryClicked(object sender, EventArgs args)
 {
     Dataphoria.ExecuteScript(String.Format(".System.UpgradeLibrary('{0}');", LibraryName));
     UpgradeRequired = false;
     MessageBox.Show(Strings.UpgradeLibrarySuccess);
 }
Пример #11
0
        private void LoadToggleClicked(object sender, EventArgs args)
        {
            Dataphoria.Warnings.ClearErrors(Dataphoria);
            if (!Registered)
            {
                try
                {
                    DAE.IServerCursor cursor =
                        Dataphoria.OpenCursor
                        (
                            String.Format
                            (
                                @"
									select 
										RequiredLibraries('{0}') 
											group by {{ Library_Name }}
											add {{ Max(Level) Level }}
											where not exists (System.LoadedLibraries where Name = Library_Name) 
											order by {{ Level desc }};
								"                                ,
                                _libraryName
                            )
                        );
                    try
                    {
                        using (DAE.Runtime.Data.IRow row = cursor.Plan.RequestRow())
                        {
                            while (cursor.Next())
                            {
                                cursor.Select(row);
                                try
                                {
                                    Dataphoria.ExecuteScript(String.Format("RegisterLibrary('{0}', false);", (string)row["Library_Name"]));
                                }
                                catch (Exception exception)
                                {
                                    Dataphoria.Warnings.AppendError(Dataphoria, exception, false);
                                }
                            }
                        }
                    }
                    finally
                    {
                        Dataphoria.CloseCursor(cursor);
                    }

                    try
                    {
                        Dataphoria.ExecuteScript(String.Format("RegisterLibrary('{0}', false);", _libraryName));
                    }
                    catch (Exception exception)
                    {
                        Dataphoria.Warnings.AppendError(Dataphoria, exception, false);
                    }
                }
                finally
                {
                    ((LibraryListNode)Parent).RefreshRegistered();
                }
                ((LibraryListNode)Parent).RefreshCurrent();
            }
            else
            {
                try
                {
                    using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm())
                    {
                        Dataphoria.FrontendSession.CreateHost().Load(".Frontend.Form('Frontend', 'UnloadLibrary')", form);
                        form.MainSource.Filter = GetFilter();
                        form.HostNode.Open();
                        if (form.ShowModal(Frontend.Client.FormMode.Query) != DialogResult.OK)
                        {
                            throw new AbortException();
                        }
                        DAE.Client.DataView view = ((Frontend.Client.ISource)form.FindNode("Dependencies")).DataView;
                        view.First();
                        foreach (DAE.Runtime.Data.Row row in view)
                        {
                            try
                            {
                                Dataphoria.ExecuteScript(String.Format("UnregisterLibrary('{0}', false);", (string)row["Library_Name"]));
                            }
                            catch (Exception exception)
                            {
                                Dataphoria.Warnings.AppendError(Dataphoria, exception, false);
                            }
                        }
                    }

                    try
                    {
                        Dataphoria.ExecuteScript(String.Format("UnregisterLibrary('{0}', false);", _libraryName));
                    }
                    catch (Exception exception)
                    {
                        Dataphoria.Warnings.AppendError(Dataphoria, exception, false);
                    }
                    _canLoad = true;
                }
                finally
                {
                    ((LibraryListNode)Parent).RefreshCurrent();
                    ((LibraryListNode)Parent).RefreshRegistered();
                }
            }
        }
Пример #12
0
 protected override void InternalRefresh()
 {
     Dataphoria.ExecuteScript(String.Format(".Frontend.RefreshDocuments('{0}');", LibraryName));
     base.InternalRefresh();
 }