//Update new password to database public void ChangePassword(string login, string email, string newPassword) { //UPDATE [dbo].[pracownik] SET pr_st_id = 9, pr_szef_id = 9 WHERE pr_id BETWEEN 12 AND 14; string querry = "USE db_Clinic UPDATE tbl_User SET Password=@Password WHERE Login=@Login AND Email=@Email "; List <ClassSQLParameters> listOfParameters = new List <ClassSQLParameters>(); ClassSQLParameters p1 = new ClassSQLParameters("@Login", login); ClassSQLParameters p2 = new ClassSQLParameters("@Email", email); ClassSQLParameters p3 = new ClassSQLParameters("@Password", newPassword); listOfParameters.Add(p1); listOfParameters.Add(p2); listOfParameters.Add(p3); List <int> retrievedColumns = new List <int>(); Querry(querry, listOfParameters, retrievedColumns); }
//Check if login and password is correct if you want to login public bool CheckLoginAndEmail(string login, string email) { bool find = false; string querry = "SELECT [Login],[Email] FROM tbl_User WHERE login=@login AND Email=@Email "; List <ClassSQLParameters> listOfParameters = new List <ClassSQLParameters>(); ClassSQLParameters p1 = new ClassSQLParameters("@Login", login); ClassSQLParameters p2 = new ClassSQLParameters("@Email", email); listOfParameters.Add(p1); listOfParameters.Add(p2); List <int> retrievedColumns = new List <int>(); retrievedColumns.Add(0); List <string> answer = Querry(querry, listOfParameters, retrievedColumns); if (answer.Count >= 1) { find = true; } return(find); }
//Check if login and password is correct if you want to login public bool CheckLoginDetails(string login, string password) { string querry = "SELECT [Login],[Password] FROM tbl_User WHERE Login=@Login AND Password=@Password"; List <ClassSQLParameters> listOfParameters = new List <ClassSQLParameters>(); ClassSQLParameters p1 = new ClassSQLParameters("@Login", login); ClassSQLParameters p2 = new ClassSQLParameters("@Password", password); listOfParameters.Add(p1); listOfParameters.Add(p2); List <int> retrievedColumns = new List <int>(); retrievedColumns.Add(0); List <string> answer = Querry(querry, listOfParameters, retrievedColumns); if (answer.Count < 1) { return(false); } return(true); }