private void CTMenuQuery_RenameQuery_Click(object sender, EventArgs e) { try { DBValues.queriesName = FzQueryBLL.ListOfQueryName(fdbEntity); frmNewName frm = new frmNewName(2); frm.ShowDialog(); String oldName = childCurrentNode.Text; foreach (var item in fdbEntity.Queries) { if (oldName.Equals(item.QueryName)) { item.QueryName = frm.Name; childCurrentNode.Text = frm.Name; break; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void renameSchemeToolStripMenuItem_Click(object sender, EventArgs e) { try { String oldName = childCurrentNode.Text; FzSchemeEntity newScheme = FzSchemeBLL.GetSchemeByName(oldName, fdbEntity); currentScheme = FzSchemeBLL.GetSchemeByName(oldName, fdbEntity); if (FzSchemeBLL.IsInherited(newScheme, fdbEntity.Relations)) { MessageBox.Show("This scheme is inherited by some relation!"); return; } DBValues.schemesName = FzSchemeBLL.GetListSchemeName(fdbEntity); frmNewName frm = new frmNewName(3); frm.ShowDialog(); if (frm.Name == null) return; if (currentScheme != null && newScheme.Equals(currentScheme)) { if (xtraTabDatabase.TabPages[1].Text.Contains("Create Relation")) xtraTabDatabase.TabPages[1].Text = "Create Relation " + frm.Name; else xtraTabDatabase.TabPages[1].Text = "Relation " + frm.Name; childCurrentNode.Name = childCurrentNode.Text = frm.Name; } else childCurrentNode.Name = childCurrentNode.Text = frm.Name; //Save to database FzSchemeBLL.RenameScheme(oldName, frm.Name, fdbEntity); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CTMenuDB_Rename_Click(object sender, EventArgs e) { try { if (fdbEntity == null) { MessageBox.Show("Current database is empty!"); return; } frmNewName frm = new frmNewName(1); frm.ShowDialog(); if (frm.Name != null) { //Save the database DialogResult result = MessageBox.Show("Do you want to save all changed to the database ?", "Close Fuzzy Database " + fdbEntity.FdbName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { new FdbBLL().DropFuzzyDatabase(fdbEntity); new FdbBLL().SaveFuzzyDatabase(fdbEntity); } //Close the databse treeList1.Nodes.Clear(); fdbEntity = null; ResetObject(); ActiveDatabase(false); iOpenExistingDatabase.Enabled = true; iNewDatabase.Enabled = true; //Change the name of the database String path = ""; int length = this.path.LastIndexOf("\\"); path = this.path.Substring(0, length); path += "\\" + frm.Name + ".tbb"; System.IO.File.Move(this.path, path); //ReOpen the database NewFuzzyDatabaseEntity(path); if (new FdbBLL().OpenFuzzyDatabase(fdbEntity)) { ShowTreeList(); ShowTreeListNode(); ActiveDatabase(true); iOpenExistingDatabase.Enabled = false; iNewDatabase.Enabled = false; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CTMenuRelNode_RenameRelation_Click(object sender, EventArgs e) { try { if (fdbEntity == null) { MessageBox.Show("Current Database is empty!"); return; } String relationName = ""; if (currentRelation != null) relationName = currentRelation.RelationName; else relationName = childCurrentNode.Name; //Set currtn relation currentRelation = FzRelationBLL.GetRelationByName(relationName, fdbEntity); renamedRelation = FzRelationBLL.GetRelationByName(relationName, fdbEntity); DBValues.relationsName = FzRelationBLL.GetListRelationName(fdbEntity); frmNewName frm = new frmNewName(4); frm.ShowDialog(); renamedRelation.RelationName = frm.Name; if (frm.Name == null) return; if (currentRelation != null) { if (renamedRelation.Equals(currentRelation)) { if (xtraTabDatabase.TabPages[1].Text.Contains("Create Relation")) xtraTabDatabase.TabPages[1].Text = "Create Relation " + frm.Name; else xtraTabDatabase.TabPages[1].Text = "Relation " + frm.Name; childCurrentNode.Name = childCurrentNode.Text = frm.Name; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }