private void SubmitRequestButton_Click(object sender, EventArgs e) { string name = NameTextBox.Text; string surname = SurnameTextBox.Text; string objectName = ObjectNameTextBox.Text; string area = AreaTextBox.Text; string priority = PriorityObjectComboBox.Text; string address = AddressTextBox.Text; if (name.Length == 0 || surname.Length == 0 || objectName.Length == 0 || area.Length == 0 || priority.Length == 0 || address.Length == 0) { var msg = MessageBox.Show("Please, fill all boxes", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { OpenConnection(ConnectionString); int result = InsertRequest(connect, name, surname, objectName, area, priority, address); CloseConnection(); if (result == 0) { DialogResult msg = MessageBox.Show("User not found\nDo you want to create this user?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (msg == DialogResult.Yes) { ActiveForm.Hide(); PersonalProtect personalProtect = new PersonalProtect(); personalProtect.NameTextBox.Text = name; personalProtect.SurnameTextBox.Text = surname; personalProtect.ShowDialog(); Close(); } else if (msg == DialogResult.No) { ActiveForm.Hide(); Security security = new Security(); security.ShowDialog(); Close(); } } else { var msg = MessageBox.Show("Data added", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); NameTextBox.Text = ""; SurnameTextBox.Text = ""; ObjectNameTextBox.Text = ""; AreaTextBox.Text = ""; PriorityObjectComboBox.Text = ""; AddressTextBox.Text = ""; } } }