Пример #1
0
        private void BT1_Click(object sender, EventArgs e)
        {
            var form = new LoginUser();
            form.ShowDialog();
            if(form.connect==null)
                return;
            Usermanager.Connection.MySqlConnection=new MySqlConnection(form.connect);
            if (Usermanager.Connection.ConnectionString!=null||Usermanager.Connection.ConnectionStatus().Confirmation)
            {
                if (form.SuccesLogin)
                {
                    Usermanager.Connection.Userinfo(form.TBUser.Text, form.TBPass.Text, form.TBDatabase.Text,
                        form.TBServer.Text);

                    for (int i = 0; i < treeView1.Nodes[0].Nodes.Count; i++)
                    {
                        treeView1.Nodes[0].Nodes[i].Nodes.Clear();
                    }
                    if (treeView1.Nodes.Count>1)
                    {

                            treeView1.Nodes[1].Remove();

                    }
                    LoadTree();
                }
            }
            else
            {
                Usermanager = new UserManager(new ConnectionManager(connect));
                Usermanager.Connection.ConnectionStatus();
            }
        }
Пример #2
0
        public DataTable MySqlQuery(UserManager currentUserrData, String Query)
        {
            var datatable = new DataTable();
            currentUserrData.Connection.MySqlConnection.Open();
            MySqlCommand mySqlCommand = new MySqlCommand();
            mySqlCommand.CommandTimeout = 200;
            mySqlCommand.CommandText = Query;
            mySqlCommand.Connection = currentUserrData.Connection.MySqlConnection;
            MySqlDataReader mySqlReader;
            try
            {
                mySqlReader = mySqlCommand.ExecuteReader();

                if (mySqlReader.HasRows)
                {

                    datatable.Load(mySqlReader);
                    mySqlReader.Close();
                }
                SuccessQuery = true;
            }
            catch (Exception e)
            {
                    Errormessage = e.Message;
                    MessageBox.Show(e.Message);
                    SuccessQuery = false;

            }
            currentUserrData.Connection.MySqlConnection.Close();
            return datatable;
        }
Пример #3
0
        public bool CheckquerySyntax(UserManager currentUserrData, String Query)
        {
            var datatable= new DataTable();
            currentUserrData.Connection.MySqlConnection.Open();
            MySqlCommand mySqlCommand = new MySqlCommand();
            mySqlCommand.CommandTimeout = 200;
            mySqlCommand.CommandText = Query;
            mySqlCommand.Connection = currentUserrData.Connection.MySqlConnection;
            MySqlDataReader mySqlReader;
            try
            {
                mySqlReader = mySqlCommand.ExecuteReader();

                if (mySqlReader.HasRows)
                {

                    datatable.Load(mySqlReader);
                    mySqlReader.Close();
                }
            }
            catch (Exception e)
            {
                if (!e.Message.EndsWith("exists"))
                {
                    currentUserrData.Connection.MySqlConnection.Close();
                    return false;
                }

            }

            currentUserrData.Connection.MySqlConnection.Close();
            return true;
        }
 public Table_ColumnView(UserManager user)
 {
     this.user = user;
     edited = false;
     InitializeComponent();
     Editbox.Lexer = Lexer.Sql;
     Editbox.Margins[0].Width = 20;
     Editbox.Styles[ScintillaNET.Style.Sql.Number].ForeColor = Color.DarkOrange;
     Editbox.Styles[ScintillaNET.Style.Sql.String].ForeColor = Color.SaddleBrown;
     Editbox.Styles[ScintillaNET.Style.Sql.Character].ForeColor = Color.LimeGreen;
     Editbox.Styles[ScintillaNET.Style.Sql.Word].ForeColor = Color.Blue;
     Editbox.Styles[ScintillaNET.Style.Sql.Word2].ForeColor = Color.Blue;
     Editbox.SetKeywords(0, Words.Reserved1);
     Editbox.SetKeywords(1, Words.Reserved2);
 }
Пример #5
0
        public Form1()
        {
            InitializeComponent();
            Usermanager = new UserManager(new ConnectionManager(connect));
            Console.WriteLine(Usermanager.Connection.ConnectionStatus().message);
            Editbox.Lexer = Lexer.Sql;
            Editbox.Margins[0].Width = 20;
            Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
            Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
            Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
            Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
            Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
            Editbox.SetKeywords(0,Words.Reserved1);
            Editbox.SetKeywords(1,Words.Reserved2);

            LoadtreeDB();
        }
Пример #6
0
        public NewDatabase(ToolManager tool, UserManager usermanager)
        {
            Tool = tool;
            User = usermanager;

            InitializeComponent();
            Editbox.Lexer = Lexer.Sql;
            Editbox.Margins[0].Width = 20;
            Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
            Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
            Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
            Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
            Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
            Editbox.SetKeywords(0, Words.Reserved1);
            Editbox.SetKeywords(1, Words.Reserved2);
            this.Editbox.Text = "CREATE SCHEMA 'new_schema' " + "\n";
        }
Пример #7
0
 public NewTable(ToolManager tool, UserManager usermanager)
 {
     Tool = tool;
     User = usermanager;
     InitializeComponent();
     Editbox.Lexer = Lexer.Sql;
     Editbox.Margins[0].Width = 20;
     Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
     Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
     Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
     Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
     Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
     Editbox.SetKeywords(0, Words.Reserved1);
     Editbox.SetKeywords(1, Words.Reserved2);
     this.Editbox.Text ="CREATE TABLE  'TableName' ('Column Name' 'ColumnType' 'NOT NULL' 'AUTO_INCREMENT',Repeat" +
                               ",PRIMARY KEY ('columnName'))";
 }
Пример #8
0
 public DDLView(UserManager user,string text)
 {
     this.user = user;
     InitializeComponent();
     Editbox.Lexer = Lexer.Sql;
     Editbox.Margins[0].Width = 20;
     Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
     Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
     Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
     Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
     Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
     Editbox.SetKeywords(0, Words.Reserved1);
     Editbox.SetKeywords(1, Words.Reserved2);
     Editbox.Text = text;
     current = text;
     button1.Show();
     button2.Show();
 }
Пример #9
0
        public NewProcedure(ToolManager tool, UserManager usermanager)
        {
            Tool = tool;
            User = usermanager;

            InitializeComponent();
            Editbox.Lexer = Lexer.Sql;
            Editbox.Margins[0].Width = 20;
            Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
            Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
            Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
            Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
            Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
            Editbox.SetKeywords(0, Words.Reserved1);
            Editbox.SetKeywords(1, Words.Reserved2);
            this.Editbox.Text = "CREATE PROCEDURE 'new_procedure' ()" +"\n"+
                                     "BEGIN" +"\n "+
                                     "END";
        }
Пример #10
0
        public NewIndex(ToolManager tool, UserManager usermanager)
        {
            Tool = tool;
            User = usermanager;

            InitializeComponent();
            Editbox.Lexer = Lexer.Sql;
            Editbox.Margins[0].Width = 20;
            Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
            Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
            Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
            Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
            Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
            Editbox.SetKeywords(0, Words.Reserved1);
            Editbox.SetKeywords(1, Words.Reserved2);
            this.Editbox.Text = "CREATE INDEX 'your_index_name' " + "\n" +
                                     "ON 'your_table_name'('your_column_name')" + "\n" + "USING BTREE;";
            this.RBNonUnique.Checked = true;
        }
Пример #11
0
        public NewTrigger(ToolManager tool, UserManager usermanager)
        {
            Tool = tool;
            User = usermanager;

            InitializeComponent();
            Editbox.Lexer = Lexer.Sql;
            Editbox.Margins[0].Width = 20;
            Editbox.Styles[Style.Sql.Number].ForeColor = Color.DarkOrange;
            Editbox.Styles[Style.Sql.String].ForeColor = Color.SaddleBrown;
            Editbox.Styles[Style.Sql.Character].ForeColor = Color.LimeGreen;
            Editbox.Styles[Style.Sql.Word].ForeColor = Color.Blue;
            Editbox.Styles[Style.Sql.Word2].ForeColor = Color.Blue;
            Editbox.SetKeywords(0, Words.Reserved1);
            Editbox.SetKeywords(1, Words.Reserved2);
            this.RBBefore.Checked = true;
            this.comboBox1.Text = comboBox1.Items[0].ToString();
            this.Editbox.Text = "CREATE TRIGGER 'trigger_name' 'trigger_time'" + "\n" + "'trigger_event' ON table_name FOR EACH ROW" +
              "\n" +
              "BEGIN" + "\n" + "END";
        }
Пример #12
0
 public CreateUser(UserManager user,ToolManager tool)
 {
     InitializeComponent();
     Usermanager = user;
     ToolManager = tool;
 }