private void backButton_Click(object sender, EventArgs e) //Нажатие на кнопку "Отмена", переход на управление бегуном
        {
            certificateForm.ActiveForm.Hide();
            runnerManagerForm form = new runnerManagerForm();

            form.Show();
        }
Exemple #2
0
        private void runnersButton_Click(object sender, EventArgs e) //Переход на экран управления бегунами
        {
            coordinatorForm.ActiveForm.Hide();
            runnerManagerForm form = new runnerManagerForm();

            form.Show();
        }
Exemple #3
0
        private void backButton_Click(object sender, EventArgs e) //Нажатие на кнопку "Назад", возвращение на управление бегунами
        {
            runnerManagementForm.ActiveForm.Hide();
            runnerManagerForm form = new runnerManagerForm();

            form.Show();
        }
        private void registerButton_Click(object sender, EventArgs e) //изменение всех файлов для внесения их в бд и обновление всех данных в зависимости от email
        {
            string result = checkToAdd();

            if (result == "ОК")
            {
                try
                {
                    connectionSql.Open();

                    string name     = nameTextBox.Text;
                    string lastName = lastNameTextBox.Text;
                    string gender   = sexComboBox.Text;
                    string data     = birthDateTimePicker.Value.ToString();
                    string country  = countryComboBox.SelectedValue.ToString();

                    byte[] image = (byte[])row[6];
                    if (imageLocation != "")
                    {
                        FileStream   fileStream   = new FileStream(imageLocation, FileMode.Open, FileAccess.Read);
                        BinaryReader binaryReader = new BinaryReader(fileStream);
                        image = binaryReader.ReadBytes((int)fileStream.Length);
                    }

                    string password = (string)row[7];
                    if (passwordTextBox.Text != "" || passwordAgainTextBox.Text != "")
                    {
                        string resultPassword = changePassword();
                        if (resultPassword == "ОК")
                        {
                            password = passwordTextBox.Text;
                        }
                        else
                        {
                            MessageBox.Show(resultPassword);
                        }
                    }

                    command = new SqlCommand($"update[dbo].[User] set Password = '******', FirstName = '{name}', LastName = '{lastName}' where Email = '{emailUserLabel.Text}'", connectionSql);
                    command.ExecuteNonQuery();

                    command = new SqlCommand($"update[dbo].[Runner] set Gender = '{gender}', CountryCode = '{country}', DateOfBirth = CONVERT(datetime, '{data}', 4), Image = @img where Email = '{emailUserLabel.Text}'", connectionSql);
                    command.Parameters.Add(new SqlParameter("@img", image));
                    command.ExecuteNonQuery();

                    DataRowView rowRunner = (DataRowView)registrationComboBox.SelectedItem;
                    command = new SqlCommand($"update[dbo].[Registration] set RegistrationStatusId = {rowRunner[0]} where RunnerId = (select RunnerId from Runner where Email = '{emailUserLabel.Text}')", connectionSql);
                    command.ExecuteNonQuery();


                    runnerProfileForm.ActiveForm.Hide();
                    runnerManagerForm form = new runnerManagerForm();
                    form.Show();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }
                finally
                {
                    connectionSql.Close();
                }
            }
            else
            {
                MessageBox.Show(result);
            }
        }