internal string updatePassword(DAO.Login aLogin, string newPassword) { try { aSqlConnection.Open(); SqlCommand command = new SqlCommand("USPPasswordUpdation", aSqlConnection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@password", newPassword); command.Parameters.AddWithValue("@userName", aLogin.userName); int effectedRows = command.ExecuteNonQuery(); if (effectedRows > 0) { return("Password is updated"); } } catch (Exception e) { throw new Exception(e.Message); } finally { if (aSqlConnection != null && aSqlConnection.State == ConnectionState.Open) { aSqlConnection.Close(); } } return("Error while updating password."); }
public string login(DAO.Login aLogin) { try { { aSqlConnection.Open(); SqlCommand cmd = new SqlCommand("uspLogin", aSqlConnection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@userName", aLogin.userName); cmd.Parameters.AddWithValue("@password", aLogin.password); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.Read()) { return("Yes"); } } } catch (Exception e) { throw new Exception(e.Message); } finally { if (aSqlConnection != null && aSqlConnection.State == ConnectionState.Open) { aSqlConnection.Close(); } } return("Sorry,try again"); }
public Tuple <DataTable, int> checkLogin(string tendangnhap, string matkhau) { DAO.Login dao = new DAO.Login(); return(dao.checkLogin(tendangnhap, matkhau)); }
public int checkUsername(string tendangnhap) { DAO.Login dao = new DAO.Login(); return(dao.checkUsername(tendangnhap)); }