private void showValueForm() { if (lvValues.SelectedItems.Count > 0) { var origValue = lvValues.SelectedItems[0].Text; var f = new frmCodeValue(); f.GroupName = txtName.Text; f.ID = Toolkit.ToInt32(lvValues.SelectedItems[0].Tag, -1); if (DialogResult.OK == MainFormPopupForm(f, this, false)) { if (_touchedTables == null) { _touchedTables = new List <string>(); } if (f.TouchedTables != null) { foreach (var t in f.TouchedTables) { if (!_touchedTables.Contains(t)) { _touchedTables.Add(t); } } } RefreshData(); MainFormUpdateStatus(getDisplayMember("showValueForm{saved}", "Saved changes to code value '{0}'", origValue), true); } } }
private void promptForNewValue() { var f = new frmCodeValue(); f.GroupName = txtName.Text; if (DialogResult.OK == MainFormPopupForm(f, this, false)) { _originalGroupName = txtName.Text; RefreshData(); } }
private bool save() { // if name changed, tell user it might bust something... if (IsControlDirty(txtName)) { if (lvReferencedBy.Items.Count > 0) { if (DialogResult.No == MessageBox.Show(this, getDisplayMember("save{referenced_body}", "This group is referenced by {0} tables and dataviews.\r\nChanging the name will update those references as well.\r\nDo you want to continue?", lvReferencedBy.Items.Count.ToString()), getDisplayMember("save{referenced_title}", "Update Group References?"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)) { return(false); } } var dt = AdminProxy.ListCodeGroups(null).Tables["list_code_groups"]; var drs = dt.Select("group_name = '" + txtName.Text.Replace("'", "''") + "'"); if (drs.Length > 0) { MessageBox.Show(this, getDisplayMember("save{uniquegroup_body}", "The code group name must be unique. {0} already exists.\r\nPlease specify a different one.", txtName.Text), getDisplayMember("save{uniquegroup_title}", "Group Name Exists"), MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); txtName.SelectAll(); return(false); } } if (lvValues.Items.Count == 0) { if (DialogResult.No == MessageBox.Show(this, getDisplayMember("save{onevalueminimum_body}", "A code group must contain at least one value.\r\nWould you like to add one now?"), getDisplayMember("save{onevalueminimum_title}", "Value Required"), MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return(false); } else { var f = new frmCodeValue(); f.GroupName = txtName.Text; if (DialogResult.Cancel == MainFormPopupForm(f, this, false)) { RefreshData(); return(true); } } } if (String.IsNullOrEmpty(_originalGroupName)) { this.Close(); MainFormRefreshData(); MainFormUpdateStatus(getDisplayMember("save{added}", "Added code group '{0}'", txtName.Text), true); } else { // if deleted row(s), check existing data for orphaned values... AdminProxy.RenameCodeGroup(_originalGroupName, txtName.Text); var nd = MainFormCurrentNode(); nd.Tag = txtName.Text; nd.Text = txtName.Text; RefreshData(); MainFormUpdateStatus(getDisplayMember("save{renamed}", "Renamed group to '{0}'", txtName.Text), true); } return(true); }