Esempio n. 1
0
        public string SelectLogin()
        {
            string username = SingleTon.GetUser();
            //string query = "SELECT * FROM bankusers";
            string query = "SELECT username, password FROM bankusers WHERE bankusers.username = '******'";

            //List<string>[] list = new List<string>[2];
            //list[0] = new List<string>();
            //list[1] = new List<string>();
            string username1;
            string password;

            if (this.OpenConnection())
            {
                MySqlCommand    cmd        = new MySqlCommand(query, connection);
                MySqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    username1 = Convert.ToString(dataReader["username"] + "");

                    password = Convert.ToString(dataReader["password"] + "");
                    //list[0].Add(dataReader["username"] + "");
                    //list[1].Add(dataReader["password"] + "");
                }

                dataReader.Close();
                this.CloseConnection();
                return(username1, password);
            }
            else
            {
                return(username1, password);
            }
        }
Esempio n. 2
0
        private void login_button_Click(object sender, EventArgs e)
        {
            SingleTon.SetUser(Username_TB.Text);

            List <string>[] list = mysql.SelectLogin();
            if (UserCheck(list[0], list[1], Username_TB.Text, Password_TB.Text))
            {
                SingleTon.SetID(ID_);
                Form2 form2 = new Form2();
                form2.Show();
                this.Hide();
            }
            else
            {
                Form error = new error_login();
                error.Show();
                Username_TB.Text = "";
                Password_TB.Text = "";
            }
        }
Esempio n. 3
0
        public List <string>[] account()
        {
            accounts = SingleTon.GetID();

            List <string>[] list = new List <string> [10];
            for (int i = 0; i <= accounts + 1; i++)
            {
                list[i] = new List <string>();
            }

            string username = SingleTon.GetUser();

            string query = "SELECT username, password FROM bankusers WHERE bankusers.username = '******'";

            if (this.OpenConnection())
            {
                MySqlCommand cmd = new MySqlCommand(query, connection);

                /*for (int i = 0; i <= accounts + 1; i++)
                 * {
                 *  MySqlDataReader dataReader = cmd.ExecuteReader();
                 *  while (dataReader.Read())
                 *  {
                 *      list[i].Add(dataReader["balance" + i] + "");//rediger for at få det rigtige beløb ud når vi trækker balance for lige nu tager den det nummer på rækken og sender ud istedetfor det tal der står på den plads
                 *  }
                 *  dataReader.Close();
                 * }*/

                this.CloseConnection();
                return(list);
            }
            else
            {
                return(list);
            }
        }
Esempio n. 4
0
        private void RFID_Click(object sender, EventArgs e)
        {
            RFID   RFid = new RFID();
            string ID   = RFid.main();
            string PIN  = RFid.RFID_PIN();

            ID  = ID.Remove(0, 1);
            PIN = PIN.Remove(0, 1);
            List <string>[] RFIDd = mysql.RFID();
            if (RFID_check(RFIDd[0], RFIDd[1], ID.Remove(12, 1), PIN.Remove(PIN.Length - 1, 1)))
            {
                SingleTon.SetID(ID_);
                Form2 form2 = new Form2();
                form2.Show();
                this.Hide();
            }
            else
            {
                Form error = new error_login();
                error.Show();
                Username_TB.Text = "";
                Password_TB.Text = "";
            }
        }
Esempio n. 5
0
 private void Account_Check()
 {
     User_ID = SingleTon.GetID();
 }