示例#1
0
        private void bttAdd_Click(object sender, EventArgs e)
        {
            if (tbName.Text == String.Empty || tbPrice.Text == String.Empty || cbHouse.Text == String.Empty)
            {
                MessageBox.Show("Заполните поля",
                                "Внимание",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            classTableService = new ServiceTable(tbName.Text, Int32.Parse(cbHouse.Text), Int32.Parse(tbPrice.Text));
            if (classTableService.CheckSimilarName(tbName.Text))
            {
                MessageBox.Show("Такая услуга существует",
                                "Внимание",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            DialogResult dialogResult = MessageBox.Show("Вы уверены что хотите сохранить услугу?",
                                                        "Внимание",
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Information);

            if (dialogResult == DialogResult.No)
            {
                return;
            }



            classTableService.AddRow();
            this.Close();
        }