Esempio n. 1
0
        public void DoEdit()
        {
            var pars = new ObjectEditorPars {
            };

            MainWindow.Instance.OpenContent(new DomainEditFrame(m_conn, m_domain));
        }
Esempio n. 2
0
 public void CreateNewObject()
 {
     if (m_conn.DatabaseCaps.ExecuteSql)
     {
         OpenQueryParameters pars    = new OpenQueryParameters();
         IPhysicalConnection newconn = GetConnection().Clone();
         string dbname = TreeNodeExtension.GetDatabaseName(this);
         if (dbname != null)
         {
             newconn.AfterOpen += ConnTools.ChangeDatabaseCallback(dbname);
         }
         pars.GenerateSql = delegate(IPhysicalConnection conn)
         {
             return(m_dbtype.GenerateCreateNew(conn.SystemConnection, TreeNodeExtension.GetAnyObjectPath(this)));
         };
         pars.HideDesign       = true;
         pars.ExecutedCallback = this.CompleteRefresh;
         MainWindow.Instance.OpenContent(new QueryFrame(newconn, pars));
     }
     else
     {
         string sql  = m_dbtype.GenerateCreateNew(m_conn.Connection.SystemConnection, TreeNodeExtension.GetAnyObjectPath(this));
         var    pars = new ObjectEditorPars {
             SavedCallback = this.CompleteRefresh
         };
         var frm = new SpecificObjectFrame(m_conn, m_repr.ObjectType, sql, pars);
         MainWindow.Instance.OpenContent(frm);
     }
 }
Esempio n. 3
0
 public SpecificObjectFrame(IDatabaseSource conn, string objtype, string initsql, ObjectEditorPars pars)
 {
     InitializeComponent();
     m_conn    = conn;
     m_objtype = objtype;
     m_pars    = pars;
     m_repr    = SpecificRepresentationAddonType.Instance.FindRepresentation(m_objtype);
     if (initsql != null)
     {
         codeEditor1.Text = initsql;
     }
 }
Esempio n. 4
0
 public SpecificObjectFrame(IDatabaseSource conn, ISpecificObjectStructure obj, ObjectEditorPars pars)
 {
     InitializeComponent();
     m_pars    = pars;
     m_conn    = conn;
     m_obj     = obj;
     m_objtype = obj.ObjectType;
     if (m_conn != null)
     {
         codeEditor1.Dialect = m_conn.Dialect;
         m_reformat          = new ReformatToolkit(m_conn.Dialect, codeEditor1);
     }
     else
     {
         m_reformat = new ReformatToolkit(new GenericDialect(), codeEditor1);
     }
     m_repr = SpecificRepresentationAddonType.Instance.FindRepresentation(m_obj.ObjectType);
     FillFromStructure();
 }
Esempio n. 5
0
        public override void CreateNew(AppObject appobj, ConnectionPack connpack)
        {
            var tp = _Type;

            if (tp.ObjectType == "table")
            {
                var pars = new AlterTableEditorPars {
                    SavedCallback = RefreshList
                };
                MainWindow.Instance.OpenContent(new TableEditFrame(appobj.CreateDatabaseConnection(), null, pars));
            }
            else
            {
                var dbconn = appobj.FindDatabaseConnection(connpack);
                var dbtype = dbconn.Dialect.GetSpecificObjectType(tp.ObjectType);
                if (dbconn.DatabaseCaps.ExecuteSql)
                {
                    OpenQueryParameters pars    = new OpenQueryParameters();
                    IPhysicalConnection newconn = dbconn.Connection.Clone();
                    string dbname = appobj.FindDatabaseName();
                    if (dbname != null)
                    {
                        newconn.AfterOpen += ConnTools.ChangeDatabaseCallback(dbname);
                    }
                    pars.GenerateSql = delegate(IPhysicalConnection conn)
                    {
                        return(dbtype.GenerateCreateNew(conn.SystemConnection, appobj.GetObjectPath()));
                    };
                    pars.HideDesign       = true;
                    pars.ExecutedCallback = RefreshList;
                    MainWindow.Instance.OpenContent(new QueryFrame(newconn, pars));
                }
                else
                {
                    string sql  = dbtype.GenerateCreateNew(dbconn.Connection.SystemConnection, appobj.GetObjectPath());
                    var    pars = new ObjectEditorPars {
                        SavedCallback = RefreshList
                    };
                    var frm = new SpecificObjectFrame(dbconn, tp.ObjectType, sql, pars);
                    MainWindow.Instance.OpenContent(frm);
                }
            }
        }