예제 #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                exceptionHandling.СheckingInput(textBoxCount.Text, "Количество");
                exceptionHandling.CheckingSelection(comboBoxNameFlower.SelectedValue, "цветов");
                exceptionHandling.CheckingSelection(comboBoxRequest.SelectedValue, "заявок");

                logic.CreateRequest(new RequestFlowersBindingModel
                {
                    Id        = 0,
                    FlowerId  = Convert.ToInt32(comboBoxNameFlower.SelectedValue),
                    RequestId = Convert.ToInt32(comboBoxRequest.SelectedValue),
                    Count     = Convert.ToInt32(textBoxCount.Text)
                });
                flowerLogic.FlowersRefill(new RequestFlowersBindingModel
                {
                    FlowerId  = Convert.ToInt32(comboBoxNameFlower.SelectedValue),
                    RequestId = Convert.ToInt32(comboBoxRequest.SelectedValue),
                    Count     = Convert.ToInt32(textBoxCount.Text)
                });

                MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;

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