/// <summary> /// /// </summary> /// <param name="login"></param> /// <param name="password"></param> /// <param name="type1 for user / type 2 for admin"></param> /// <returns></returns> public bool validateUserType(string login, string password, string type) { connector.Connect(); string request = ""; string verif = login + password; string verifbdd = ""; if (type.Equals("user")) { request = "SELECT * from utilisateurs where Login='******' and Password='******'"; } else if (type.Equals("admin")) { request = "Select * from administrateurs where Login='******' and Password='******'"; } MySqlCommand cmd = new MySqlCommand(request, connector.db); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { verifbdd = reader[0] + "" + reader[1]; } if (verif.Equals(verifbdd)) { connector.Disconnect(); return(true); } connector.Disconnect(); return(false); }
public int getCommandID() { connector.Connect(); string request = "SELECT * from commandeencours where IdUser='******'"; MySqlCommand cmd = new MySqlCommand(request, connector.db); MySqlDataReader reader = cmd.ExecuteReader(); int id = 0; if (reader.Read()) { id = (int)reader[1]; } connector.Disconnect(); return(id); }