private void btAddMessageBase_Click(object sender, EventArgs e) { var messageBaseEditor = new MessageBaseEditor(); messageBaseEditor.Initialize(MODE_ADD, _dataInterface); if (messageBaseEditor.ShowDialog() == DialogResult.OK) { var messageBase = new MessageBase(); messageBaseEditor.ReturnValues(ref messageBase); _dataInterface.CreateMessageBase(messageBase); _formUtils.RefreshMessageAreas(dgMessageBases); } }
private void btEditMessageBase_Click(object sender, EventArgs e) { int messageBaseId = (int)(dgMessageBases.SelectedRows[0].Cells[0].Value); var messageBase = _dataInterface.GetMessageBaseById(messageBaseId); if (messageBase != null) { var messageBaseEditor = new MessageBaseEditor(); messageBaseEditor.Initialize(MODE_EDIT, _dataInterface); messageBaseEditor.SetValues(messageBase); if (messageBaseEditor.ShowDialog() == DialogResult.OK) { messageBaseEditor.ReturnValues(ref messageBase); _dataInterface.UpdateMessageBase(messageBase); _formUtils.RefreshMessageBases(dgMessageBases); } } }