예제 #1
0
        private void ButtonParticipantSignIn_Click(object sender, EventArgs e)
        {
            SqlDataAdapter sda = new SqlDataAdapter("Select count(*) From groups Where g_username='******' COLLATE SQL_Latin1_General_CP1_CS_AS and g_password= '******' COLLATE SQL_Latin1_General_CP1_CS_AS", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                SqlCommand cmd = new SqlCommand("Select group_id from groups where g_username='******' COLLATE SQL_Latin1_General_CP1_CS_AS and g_password= '******' COLLATE SQL_Latin1_General_CP1_CS_AS", con);

                con.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Program.group_id = Convert.ToInt32(dr["group_id"]);
                }
                dr.Close();
                con.Close();

                //Program.PSession_id = TextboxUsername.Text; //For Session
                //  Dialogue.Show("Login Successful!", "", "Ok", "Cancel");
                this.Hide();

                GroupMain mm = new GroupMain();
                mm.Show();
            }
            else
            {
                Dialogue.Show("Login Failed! \r\n Please Check your Username and Password!", "", "Ok", "Cancel");
            }
        }
예제 #2
0
        private void TextboxPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    SqlDataAdapter sda = new SqlDataAdapter("Select count(*) From groups Where g_username='******' COLLATE SQL_Latin1_General_CP1_CS_AS and g_password= '******' COLLATE SQL_Latin1_General_CP1_CS_AS", con);
                    DataTable      dt  = new DataTable();
                    sda.Fill(dt);
                    if (dt.Rows[0][0].ToString() == "1")
                    {
                        SqlCommand cmd = new SqlCommand("Select group_id from groups where g_username='******' COLLATE SQL_Latin1_General_CP1_CS_AS and g_password= '******' COLLATE SQL_Latin1_General_CP1_CS_AS", con);

                        con.Open();
                        SqlDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            Program.group_id = Convert.ToInt32(dr["group_id"]);
                        }
                        dr.Close();
                        con.Close();

                        //Program.PSession_id = TextboxUsername.Text; //For Session
                        //  Dialogue.Show("Login Successful!", "", "Ok", "Cancel");
                        this.Hide();

                        GroupMain mm = new GroupMain();
                        mm.Show();
                    }
                    else
                    {
                        Dialogue.Show("Login Failed! \r\n Please Check your Username and Password!", "", "Ok", "Cancel");
                    }
                }

                catch (Exception ex)
                {
                    Dialogue.Show(" ' " + ex.Message.ToString() + "' ", "", "Ok", "Cancel");
                }

                e.SuppressKeyPress = true;
            }
        }