Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            RunnerResults.ActiveForm.Hide();
            RunnerMenu runnerMenu = new RunnerMenu();

            runnerMenu.Show();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            RunnerMaraphonRegister.ActiveForm.Hide();
            RunnerMenu runnerMenu = new RunnerMenu();

            runnerMenu.Show();
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            RunnerMenu runnerMenu = new RunnerMenu();

            runnerMenu.Show();
            Close();
        }
Exemplo n.º 4
0
        private void registerButton_Click(object sender, EventArgs e)
        {
            string result = checkToAdd();

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

                    string   name        = nameTextBox.Text;
                    string   lastName    = lastNameTextBox.Text;
                    string   gender      = genderComboBox.Text;
                    string   country     = countryComboBox.SelectedValue.ToString();
                    string   photoText   = photoTextBox.Text;
                    DateTime dateOfBirth = Convert.ToDateTime(birthDateTimePicker.Value);
                    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}', Picture = '{photoText}' where Email = '{emailUserLabel.Text}'", connectionSql);
                    command.ExecuteNonQuery();
                    connectionSql.Close();

                    connectionSql.Open();
                    command = new SqlCommand($"update[dbo].[Runner] set Gender = '{gender}', CountryCode = '{country}', DateOfBirth = '{birthDateTimePicker.Value}' where Email = '{emailUserLabel.Text}'", connectionSql);
                    command.ExecuteNonQuery();

                    RunnerEdit.ActiveForm.Hide();
                    RunnerMenu form = new RunnerMenu();
                    form.Show();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }
                finally
                {
                    connectionSql.Close();
                }
            }
            else
            {
                MessageBox.Show(result);
            }
        }
Exemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                connectionSql.Open();
                dataAdapter = new SqlDataAdapter($"SELECT [Email], [Password], [RoleId] FROM [dbo].[User] WHERE [Email] = '{textBox1.Text}' and [Password] = '{textBox2.Text}'", connectionSql);
                DataSet dataSet = new DataSet();
                dataAdapter.Fill(dataSet);

                table = dataSet.Tables[0];

                if (table.Rows.Count != 0)
                {
                    email = textBox1.Text;
                    DataRow dataRow = table.Rows[0];
                    if (dataRow[2].ToString() == "A")
                    {
                        Login.ActiveForm.Hide();
                        Admin.MenuAdm form = new Admin.MenuAdm();
                        form.Show();
                    }
                    if (dataRow[2].ToString() == "C")
                    {
                        Login.ActiveForm.Hide();
                        Coordinator.CoordinatorMenu form = new Coordinator.CoordinatorMenu();
                        form.Show();
                    }
                    if (dataRow[2].ToString() == "R")
                    {
                        Login.ActiveForm.Hide();
                        Runer.RunnerMenu form = new Runer.RunnerMenu();
                        form.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Неверный логин или пароль");
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            finally
            {
                connectionSql.Close();
            }
        }