public bool IsValid(string username, string password, ref int id) { Dist23Data db = new Dist23Data(); if (username == "*****@*****.**" || password == "shadow111") { Session["LoginName"] = "Stuart, Master of Website"; Session["AccessLevel"] = 10; SetDocAccess(1); return(true); } var contacts = db.Contacts.Where(x => x.email == username && x.password == password).Where(x => x.DistKey == GlobalVariables.DistKey); Contacts contact = contacts.FirstOrDefault(); if (contact == null) { return(false); } else { Session["LoginName"] = contact.name; Session["AccessLevel"] = contact.AccessLvl; SetDocAccess(contact.pKey); return(true); } }
private static string LookupEmail(string type, bool isDistrict) { Dist23Data db = new Dist23Data(); clsDataGetter dg = new clsDataGetter(db.Database.Connection.ConnectionString); string sql = "SELECT email FROM contacts c "; sql += "INNER JOIN ContactPosition cp ON cp.contactID = c.pKey "; sql += "INNER JOIN positions p ON p.pKey = cp.PositionID "; sql += "INNER JOIN groups g ON g.pKey = cp.GroupID "; sql += "WHERE positionName = '" + type + "' "; sql += "AND g.DistKey = " + GlobalVariables.DistKey; if (isDistrict) { sql += " AND g.isDistrict = 1"; } string email = dg.GetScalarString(sql); return(email); }