Esempio n. 1
0
        /// <summary>
        /// Сохранить изменения
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxName.Text) ||
                string.IsNullOrEmpty(textBoxName.Text) ||
                string.IsNullOrEmpty(textBoxSurgeons.Text) ||
                string.IsNullOrEmpty(comboBoxScrubNurse.Text) ||
                string.IsNullOrEmpty(comboBoxScrubNurse.Text))
            {
                MessageBox.Show("Поля, отмеченные звёздочкой, обязательны для заполнения", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                PutDataToOperation(_operationInfo);

                if (_operationInfo.Id == 0)
                {
                    _patientInfo.AddOperation(_operationInfo);
                }
                else
                {
                    _patientInfo.UpdateOperation(_operationInfo);
                }

                _operationForm.ShowOperations();

                _isFormClosingByButton = true;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }