Пример #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (posBox.Text == "" || salaryBox.Text == "")
            {
                MessageBox.Show("Please enter a name of position and salary!");
                return;
            }

            if (Position.GetPositionList().Any(position => position.GetPosition() == posBox.Text))
            {
                MessageBox.Show("Sorry, but this position already exists! :(");
                return;
            }

            string nameP  = posBox.Text;
            float  salary = float.Parse(salaryBox.Text);

            if (!DBConnection.InsertPosition(nameP, salary))
            {
                MessageBox.Show("There was and error with inserting!");
            }
            else
            {
                MessageBox.Show("Insert successfuly");
            }
        }