//jobseeker password or admin 2 public void chgpwdjswkey(string keyval, string pwds) { //recalc password hash CLPwdhash clpdh = new CLPwdhash(); string hashedpwd = clpdh.getMd5Hash(pwds); // using (MySqlConnection con = new MySqlConnection()) { //Clconnect kenect = new Clconnect(); con.ConnectionString = Clconnect.makeconn(); con.Open(); using (MySqlCommand com = con.CreateCommand()) { com.CommandType = System.Data.CommandType.Text; com.CommandText = "UPDATE users set uPassword = '******' where uPasswordresetcode= '" + keyval + "' and uUserType = 2; "; com.Parameters.Add("@keyval", MySqlDbType.VarChar).Value = keyval; int reslt = com.ExecuteNonQuery(); } con.Close(); } }
//get employee id ony for employees public string userwelcomename(string pusername, int uusertype, int empid) { MySqlConnection connreader = new MySqlConnection(); //Clconnect kenect = new Clconnect(); connreader.ConnectionString = Clconnect.makeconn(); //get hashcode // CLPwdhash passhash = new CLPwdhash(); //string to hold data string tmphld = string.Empty; using (connreader) { MySqlCommand command = new MySqlCommand("SELECT concat(ufirstname,' ',ulastname)as names FROM users where uusername = '******' and uusertype = " + uusertype + "; ", connreader); connreader.Open(); MySqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { tmphld = reader.GetString(0); } } else { return(null); } reader.Close(); } return(tmphld); }
//check the usertype for the main windows like is it recruiter of single user public int checkusertype(string uusername, int uusertypes) { MySqlConnection connreader = new MySqlConnection(); //Clconnect kenect = new Clconnect(); connreader.ConnectionString = Clconnect.makeconn(); //get hashcode // CLPwdhash passhash = new CLPwdhash(); int plhash = 0; using (connreader) { MySqlCommand command = new MySqlCommand("SELECT uusertype from users where uusername = '******'and uusertype=" + uusertypes + " ; ", connreader); connreader.Open(); MySqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { plhash = reader.GetInt16(0); } } else { //return null; } reader.Close(); } return(plhash); }
//check if the recruiter exists in the database public string checkrecusern(string userns) { MySqlConnection connreader = new MySqlConnection(); //Clconnect kenect = new Clconnect(); connreader.ConnectionString = Clconnect.makeconn(); //get hashcode // CLPwdhash passhash = new CLPwdhash(); string plhash = string.Empty; using (connreader) { MySqlCommand command = new MySqlCommand("SELECT uUsername FROM users where uusername='******' and uusertype = 1; ", connreader); connreader.Open(); MySqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { plhash = reader.GetString(0); } } else { return(null); } reader.Close(); } return(plhash); }
//this is admin user //1 is admin public string getuser(string userns, string pwds) { MySqlConnection connreader = new MySqlConnection(); //Clconnect kenect = new Clconnect(); connreader.ConnectionString = Clconnect.makeconn(); //get hashcode // CLPwdhash passhash = new CLPwdhash(); //string to hold data string tmphld = string.Empty; using (connreader) { MySqlCommand command = new MySqlCommand("SELECT uUsername FROM users where upassword = '******' and uusername='******' and uusertype = 1; ", connreader); connreader.Open(); MySqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { tmphld = reader.GetString(0); } } else { return(null); } reader.Close(); } return(tmphld); }
//check the password key against the database public string getkeyuser(string keyids, int utype) { MySqlConnection connreader = new MySqlConnection(); //Clconnect kenect = new Clconnect(); connreader.ConnectionString = Clconnect.makeconn(); //get hashcode // CLPwdhash passhash = new CLPwdhash(); //string to hold data string tmphld = string.Empty; using (connreader) { MySqlCommand command = new MySqlCommand("SELECT upasswordresetcode FROM users where upasswordresetcode = '" + keyids + "' and uusertype = " + utype + "; ", connreader); connreader.Open(); MySqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { tmphld = reader.GetString(0); } } else { return(null); } reader.Close(); } return(tmphld); }