/// <summary> /// Called when the "open" button is clicked on this form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOpen_Click(object sender, EventArgs e) { FileInfo currentDB = this.getSelectedDatabase(); if (currentDB == null) return; MainForm parent = this.MdiParent as MainForm; BaseInfoDAO dao = new BaseInfoDAO(currentDB.FullName); BaseInfo baseInfo = dao.GetBaseInfo(); if (!baseInfo.Password.Equals("")) { PasswordPrompt prompt = new PasswordPrompt(baseInfo.Password); if (prompt.ShowDialog() != DialogResult.OK) return; } MainForm form = (MainForm)this.MdiParent; form.CurrentDatabase = currentDB; this.Close(); foreach (Form f in parent.MdiChildren) f.Close(); ViewBooksForm booksForm = new ViewBooksForm(Constants.LibraryMode.LIBRARY); booksForm.MdiParent = form; booksForm.Show(); }
private void btnDelete_Click(object sender, EventArgs e) { FileInfo currentDB = this.getSelectedDatabase(); //make sure there isn't a password in this database BaseInfoDAO dao = new BaseInfoDAO(currentDB.FullName); BaseInfo baseInfo = dao.GetBaseInfo(); if (!baseInfo.Password.Equals("")) { PasswordPrompt prompt = new PasswordPrompt(baseInfo.Password); if (prompt.ShowDialog() != DialogResult.OK) { return; } } if (MessageBox.Show(Messages.ViewDBForm.DB_DELETE_CONFIRM, "Delete This Library?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { currentDB.Delete(); if (currentDB.Exists) { MessageBox.Show(ErrorMessages.Common.COULD_NOT_DELETE_DB, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(Messages.Common.DB_DELETED, "Library Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); } MainForm form = (MainForm)this.MdiParent; form.CurrentDatabase = null; } this.refreshGrid(); }
/// <summary> /// Called when the "open" button is clicked on this form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOpen_Click(object sender, EventArgs e) { FileInfo currentDB = this.getSelectedDatabase(); if (currentDB == null) { return; } MainForm parent = this.MdiParent as MainForm; BaseInfoDAO dao = new BaseInfoDAO(currentDB.FullName); BaseInfo baseInfo = dao.GetBaseInfo(); if (!baseInfo.Password.Equals("")) { PasswordPrompt prompt = new PasswordPrompt(baseInfo.Password); if (prompt.ShowDialog() != DialogResult.OK) { return; } } MainForm form = (MainForm)this.MdiParent; form.CurrentDatabase = currentDB; this.Close(); foreach (Form f in parent.MdiChildren) { f.Close(); } ViewBooksForm booksForm = new ViewBooksForm(Constants.LibraryMode.LIBRARY); booksForm.MdiParent = form; booksForm.Show(); }
private void btnDelete_Click(object sender, EventArgs e) { FileInfo currentDB = this.getSelectedDatabase(); //make sure there isn't a password in this database BaseInfoDAO dao = new BaseInfoDAO(currentDB.FullName); BaseInfo baseInfo = dao.GetBaseInfo(); if (!baseInfo.Password.Equals("")) { PasswordPrompt prompt = new PasswordPrompt(baseInfo.Password); if (prompt.ShowDialog() != DialogResult.OK) return; } if (MessageBox.Show(Messages.ViewDBForm.DB_DELETE_CONFIRM, "Delete This Library?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { currentDB.Delete(); if (currentDB.Exists) MessageBox.Show(ErrorMessages.Common.COULD_NOT_DELETE_DB, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else MessageBox.Show(Messages.Common.DB_DELETED, "Library Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); MainForm form = (MainForm)this.MdiParent; form.CurrentDatabase = null; } this.refreshGrid(); }