private void btAddMessageArea_Click(object sender, EventArgs e) { var messageAreaEditor = new MessageAreaEditor(); messageAreaEditor.Initialize(MODE_ADD, _dataInterface); if (messageAreaEditor.ShowDialog() == DialogResult.OK) { var messageBaseArea = new MessageBaseArea(); messageAreaEditor.ReturnValues(ref messageBaseArea); _dataInterface.CreateMessageBaseArea(messageBaseArea); _formUtils.RefreshMessageAreas(dgMessageBaseAreas); } }
private void btEditMessageArea_Click(object sender, EventArgs e) { int messageBaseAreaId = (int)(dgMessageBaseAreas.SelectedRows[0].Cells[0].Value); var messageBaseArea = _dataInterface.GetMessageBaseAreaById(messageBaseAreaId); if (messageBaseArea != null) { var messageAreaEditor = new MessageAreaEditor(); messageAreaEditor.Initialize(MODE_EDIT, _dataInterface); messageAreaEditor.SetValues(messageBaseArea); if (messageAreaEditor.ShowDialog() == DialogResult.OK) { messageAreaEditor.ReturnValues(ref messageBaseArea); _dataInterface.UpdateMessageBaseArea(messageBaseArea); _formUtils.RefreshMessageAreas(dgMessageBaseAreas); } } }