private void butBack_Click(object sender, EventArgs e) { ManagerMenu mm = new ManagerMenu(); mm.Show(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (dataGridView2[1, 0].Value != null && dataGridView2[1, 1].Value != null) { string sql = "Select * From Users Where email='" + dataGridView2[1, 0].Value.ToString() + "' and password='******'"; SqlDataAdapter dataadapter = new SqlDataAdapter(sql, connection); connection.Open(); dt = new DataTable(); dataadapter.Fill(dt); connection.Close(); if (dt.Rows.Count > 0) { if (dt.Rows[0][1].ToString() == "1") { MenuClient mc = new MenuClient(); mc.Usersmail.Text = dataGridView2[1, 0].Value.ToString(); mc.Show(); this.Close(); } else if (dt.Rows[0][1].ToString() == "2") { MenuRealtor mc = new MenuRealtor(); mc.Usersmail.Text = dataGridView2[1, 0].Value.ToString(); mc.Show(); this.Close(); } else if (dt.Rows[0][1].ToString() == "3") { ManagerMenu mc = new ManagerMenu(); mc.Usersmail.Text = dataGridView2[1, 0].Value.ToString(); mc.Show(); this.Close(); } } else { MessageBox.Show("Проверьте введенные данные", "Ошибка"); } } else { MessageBox.Show("Попробуй еще раз!", "Ошибка"); } }