public Account getAccount(string email, string password) { Account account = new Models.Account(); degreeManager dm = new degreeManager(); MailingInfoModel mim = new MailingInfoModel(); MySqlConnection conn = null; using (conn = new MySqlConnection(db.getConnString())) { conn.Open(); using (MySqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = "SELECT * FROM user WHERE email LIKE '" + email + "' and password like '" + password + "';"; using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { account.userID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { account.idNumber = reader.GetString(1); } else { account.idNumber = ""; } account.lastName = reader.GetString(2); account.firstName = reader.GetString(3); account.middleName = reader.GetString(4); account.gender = reader.GetChar(5); account.birthYear = reader.GetInt32(6); account.birthMonth = reader.GetInt32(7); account.birthDay = reader.GetInt32(8); account.citizenship = reader.GetString(9); account.placeOfBirth = reader.GetString(10); account.currentAddress = reader.GetString(11); account.phoneNo = reader.GetString(12); if (!reader.IsDBNull(13)) { account.alternatePhoneNo = reader.GetString(13); } else { account.alternatePhoneNo = ""; } account.email = reader.GetString(14); if (!reader.IsDBNull(15)) { account.alternateEmail = reader.GetString(15); } else { account.alternateEmail = ""; } account.password = reader.GetString(16); if (reader.GetString(17) == "not verified") { account.verified = false; } else { account.verified = true; } account.registeredDate = reader.GetString(18); account.degrees = dm.getDegree(account.userID); account.mailInfos = mim.getMailInfos(account.userID); account.cart = new List <Document>(); } if (!reader.HasRows) { account = null; } } } } conn.Close(); return(account); }