private void button1_Click(object sender, EventArgs e) { DBConnection.Authorization(txtLogin.Text, txtPassword.Text); switch (DBConnection.Role) { case "R": DBConnection.GetEmail = txtLogin.Text; tr = true; this.Close(); RunnerMenu Form = new RunnerMenu(); Form.Show(); break; case "A": tr = true; this.Close(); AdminMenu AdminMenuFrm = new AdminMenu(); AdminMenuFrm.Show(); break; case "c": tr = true; this.Close(); CoordinatorMenu coordinatorMenu = new CoordinatorMenu(); coordinatorMenu.Show(); break; case null: MessageBox.Show("Неверные данные"); break; } }
private void button1_Click(object sender, EventArgs e) { tr = true; this.Close(); RunnerMenu Form = new RunnerMenu(); Form.Show(); }
private void button4_Click(object sender, EventArgs e) { if (cbFM.Checked == true || cbSM.Checked == true || cbSD.Checked == true || rbtnA.Checked == true || rbtnB.Checked == true || rbtnC.Checked == true || cmbContribution.SelectedIndex != -1 || txtAmount.Text != "") { DialogResult = MessageBox.Show("Leave Form?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult == DialogResult.Yes) { switch (RegForm.Cross) { case 0: case 1: case 2: tr = true; this.Close(); RegForm.Cross = 3; RegForm RegForm1 = new RegForm(); RegForm1.Show(); return; case 4: tr = true; Cross = 0; this.Close(); RunnerMenu RunnerMenu = new RunnerMenu(); RunnerMenu.Show(); return; } } } else { switch (RegForm.Cross) { case 0: case 1: case 2: tr = true; this.Close(); RegForm.Cross = 3; RegForm RegForm1 = new RegForm(); RegForm1.Show(); return; case 4: tr = true; Cross = 0; this.Close(); RunnerMenu RunnerMenu = new RunnerMenu(); RunnerMenu.Show(); return; } } }
private void button2_Click(object sender, EventArgs e) { DialogResult = MessageBox.Show("Leave Regestration?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult == DialogResult.Yes) { switch (RegForm.Cross) { case 1: tr = true; this.Close(); RunnerControl RCForm = new RunnerControl(); RCForm.Show(); return; case 0: case 2: case 4: tr = true; Cross = 0; this.Close(); RunnerMenu RunnerMenu = new RunnerMenu(); RunnerMenu.Show(); return; } } else { switch (RegForm.Cross) { case 1: tr = true; this.Close(); RunnerControl RCForm = new RunnerControl(); RCForm.Show(); return; case 0: case 2: case 4: tr = true; Cross = 0; this.Close(); RunnerMenu RunnerMenu = new RunnerMenu(); RunnerMenu.Show(); return; } } }
private void button4_Click(object sender, EventArgs e) { if (MyRecords.RecorcdsArrow == 1) { tr = true; this.Close(); RunnerMenu RMForm = new RunnerMenu(); RMForm.Show(); } else { tr = true; this.Close(); RunnerControl RCForm = new RunnerControl(); RCForm.Show(); } }
private void Button1_Click(object sender, EventArgs e) { try { Connection.connection.Open(); string sqlExp = "select [Email], [Password],[RoleId] from [dbo].[User] where [Email]=@login"; SqlCommand cmd = new SqlCommand(sqlExp, Connection.connection); cmd.Parameters.AddWithValue("@login", textBox_email.Text); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { reader.Read(); if ((string)reader[1] == textBox_password.Text) { Connection.userLogin = textBox_email.Text; switch ((string)reader[2]) { case "R": RunnerMenu mr = new RunnerMenu(); mr.Show(); this.Close(); break; case "C": CoordinatorMenu mc = new CoordinatorMenu(); mc.Show(); this.Close(); break; case "A": AdminMenu ma = new AdminMenu(); ma.Show(); this.Close(); break; default: MessageBox.Show("Нет такой роли"); break; } } else { MessageBox.Show("Неверный пароль"); } } else { MessageBox.Show("Неверный логин"); } reader.Close(); } catch (SqlException ex) { MessageBox.Show(ex.Message); } Connection.connection.Close(); }
private void button1_Click(object sender, EventArgs e) { if ((cbFM.Checked == true || cbSM.Checked == true || cbSD.Checked == true) && (rbtnA.Checked == true || rbtnB.Checked == true || rbtnC.Checked == true)) { switch (RegForm.Cross) { case 0: { DBConnection.AddUserAndRunner(DBConnection.GetEmail, RegForm.Password, RegForm.FirstName, RegForm.SurName, RegForm.Gender, RegForm.DateOfBirth, RegForm.County, RegForm.PathToPhoto); DBConnection.RegOnMarathon(swichOption, TotalAmount.ToString(), cmbContribution.SelectedValue.ToString(), txtAmount.Text); DBConnection.AddCharity(cmbContribution.Text, txtAmount.Text); tr = true; this.Close(); ConfirmReg Form = new ConfirmReg(); Form.Show(); break; } case 4: case 1: case 2: { if (RegForm.Cross != 4) { DBConnection.EditUserAndRunner(DBConnection.GetEmail, RegForm.Password, RegForm.FirstName, RegForm.SurName, RegForm.Gender, RegForm.DateOfBirth, RegForm.County, RegForm.PathToPhoto); } DBConnection.EditMarathon(swichOption, TotalAmount.ToString(), cmbContribution.SelectedValue.ToString(), txtAmount.Text); DBConnection.EditCharity(cmbContribution.Text, txtAmount.Text); if (cbSD.Checked == true) { DBConnection.AddFR(); } else { DBConnection.DeleteFR(); } if (cbSM.Checked == true) { DBConnection.AddHM(); } else { DBConnection.DeleteHM(); } if (cbFM.Checked == true) { DBConnection.AddFM(); } else { DBConnection.DeleteFM(); } switch (RegForm.Cross) { case 1: tr = true; this.Close(); RunnerControl RCMenu = new RunnerControl(); RCMenu.Show(); break; case 4: case 2: tr = true; this.Close(); RunnerMenu RMenu = new RunnerMenu(); RMenu.Show(); break; } break; } } } else { lblError.Visible = true; lblError.Text = "At least 1 marathon must be selected"; } }
private void button3_Click(object sender, EventArgs e) { if (txtEmail.Text != "" || txtPassword.Text != "" || txtCPassword.Text != "" || txtName.Text != "" || txtSurname.Text != "" || GenderComboBox.SelectedIndex != -1 || CountrycomboBox.SelectedIndex != -1) { DialogResult = MessageBox.Show("Leave Form?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult == DialogResult.Yes) { switch (Cross) { case 0: tr = true; Cross = 0; this.Close(); RegOrLoginForm RegOrLoginForm1 = new RegOrLoginForm(); RegOrLoginForm1.Show(); return; case 1: tr = true; Cross = 0; lblCaption.Text = "Sign Up"; this.Close(); RunnerControl RunnerControl = new RunnerControl(); RunnerControl.Show(); return; case 2: tr = true; Cross = 0; lblCaption.Text = "Sign Up"; this.Close(); RunnerMenu RunnerMenu = new RunnerMenu(); RunnerMenu.Show(); return; } } } else { switch (Cross) { case 4: case 0: tr = true; Cross = 0; this.Close(); RegOrLoginForm RegOrLoginForm1 = new RegOrLoginForm(); RegOrLoginForm1.Show(); return; case 1: tr = true; Cross = 0; lblCaption.Text = "Sign Up"; this.Close(); RunnerControl RunnerControl = new RunnerControl(); RunnerControl.Show(); return; case 2: tr = true; Cross = 0; lblCaption.Text = "Sign Up"; this.Close(); RunnerMenu RunnerMenu = new RunnerMenu(); RunnerMenu.Show(); return; } } }