Esempio n. 1
0
        private void lblOpenTable_Click(object sender, EventArgs e)
        {
            string selectedTable = treeProject.SelectedNode.Text;
            string projectName   = treeProject.SelectedNode.Parent.Text;

            formNovaTablica newTable = new formNovaTablica(selectedTable, projectName, true);

            newTable.Show();

            panelTableOptions.Height = 0;
            isTableMenuOpen          = false;
        }
Esempio n. 2
0
        private void btnSaveTableName_Click(object sender, EventArgs e)
        {
            NewTableController controller   = new NewTableController();
            LoadProjects       loadProjects = new LoadProjects();
            bool exists = false;

            foreach (var table in loadProjects.LoadTables(projectName))
            {
                if ((table) == (tableName1 + ".dat") && rename1)
                {
                    string projectPath            = loadProjects.CreateProjectDirectory() + "\\" + projectName + "\\" + tableName1.Replace(" ", "_") + ".dat";
                    string projectPath1           = loadProjects.CreateProjectDirectory() + "\\" + projectName + "\\" + txtTableName.Text.Replace(" ", "_") + ".dat";
                    string projectPathForChangeFK = loadProjects.CreateProjectDirectory() + "\\" + projectName;

                    controller.ChangeFKNameInDatAfterRenaming(tableName1.Replace(" ", "_"), txtTableName.Text.Replace(" ", "_"), projectName, projectPathForChangeFK);
                    if (!loadProjects.LoadTables(projectName).Contains(txtTableName.Text + ".dat"))
                    {
                        if (controller.CheckTextInput(txtTableName.Text.Replace(" ", "_")))
                        {
                            System.IO.File.Move(projectPath, projectPath1);
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Invalid input");
                        }
                    }
                }
                if (table == txtTableName.Text + ".dat")
                {
                    MessageBox.Show("Table already exists!");
                    exists = true;
                }
            }

            if (controller.CheckTextInput(txtTableName.Text) && !rename1 && !exists)
            {
                string     projectPath = loadProjects.CreateProjectDirectory() + "\\" + projectName + "\\" + txtTableName.Text.Replace(" ", "_") + ".dat";
                FileStream fs          = File.Create(projectPath);
                fs.Close();
                formNovaTablica frmNewTable = new formNovaTablica(txtTableName.Text, projectPath, projectName);
                frmNewTable.Show();
                this.Close();
            }
            else if (!controller.CheckTextInput(txtTableName.Text) && !rename1)
            {
                MessageBox.Show("Invalid input!");
            }
        }