// Кнопка добавления записи в Transport private async void transportConfirmButton_Click(object sender, EventArgs e) { AddResult addResult = AddResult.Failed; string number = transportNumberTextBox.Text; string makeId = transportMakeIDTextBox.Text; string modelId = transportModelIDTextBox.Text; string categoryId = transportCategoryIDTextBox.Text; string fuelId = transportFuelIDTextBox.Text; string clientId = transportClientIDTextBox.Text; string resultMessage = "Something went wrong, try again"; if (string.IsNullOrEmpty(number) || string.IsNullOrEmpty(makeId) || string.IsNullOrEmpty(modelId) || string.IsNullOrEmpty(categoryId) || string.IsNullOrEmpty(fuelId) || string.IsNullOrEmpty(clientId)) { resultMessage = "Required fields are not filled, try again"; } else { addResult = await transportManager.AddRecord(number, int.Parse(makeId), int.Parse(modelId), int.Parse(fuelId), int.Parse(categoryId), int.Parse(clientId)); if (addResult == AddResult.Success) { resultMessage = "Record was successfully added"; } } MessageBox.Show(resultMessage, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (addResult == AddResult.Success) { OnTransportPanelLeave(); await DataGridDataInitialize(DbTable.Transport); } }