Esempio n. 1
0
        private void btnLoggin_Click(object sender, EventArgs e)
        {
            Registret   reg   = new Registret();
            AdminInlogg adlog = new AdminInlogg();

            //adlog.Show();
            try
            {
                con.Open();
                SqlDataAdapter sqlDa = new SqlDataAdapter("Select Count (*) From Medlemmar Where Förnamn='" + txtinlognamn.Text + "' and LOrd='" + txtinloglord.Text + "'and Type='" + cbxInloggTyp.Text + "'", con);
                DataTable      dt    = new DataTable();
                sqlDa.Fill(dt);

                if (dt.Rows[0][0].ToString() == "1")
                {
                    SqlDataAdapter sqlDa1 = new SqlDataAdapter("Select Type From Medlemmar Where Förnamn='" + txtinlognamn.Text + "' and LOrd='" + txtinloglord.Text + "'and Type='" + cbxInloggTyp.Text + "'", con);
                    DataTable      dt1    = new DataTable();
                    sqlDa1.Fill(dt1);

                    if (dt1.Rows[0][0].ToString() == "Admin")
                    {
                        this.Hide();
                        AdminInlogg adm = new AdminInlogg();
                        adm.Show();
                    }


                    else if (dt1.Rows[0][0].ToString() == "Medlem")
                    {
                        this.Hide();
                        Registret mt = new Registret();
                        mt.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Vänligen kontrollera Namn och Lösenord");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                // this.Hide();
                con.Close();
            }
        }
Esempio n. 2
0
        private void btnTillMedlemS_Click(object sender, EventArgs e)
        {
            Registret reg = new Registret();

            reg.Show();
        }