public ActionResult Questions(Account User) { ViewData["id"] = User.AccountId; ViewData["questions"] = PModel.Questions; ViewData["multAnswers"] = PModel.MultipleChoiceAnswers; ViewData["isValid"] = "true"; ViewData["answers"] = ViewData["answers"] = new string[92] { "0True", "1True", "2True", "3True", "4True", "5False", "test", "7False", "8False", "9very little", "10False", "11False", "12at the end", "13very little to no time", "14False", "15False", "16Fast", "17False", "18Less than a Year", "19False", "20Every 1-3 weeks", "21Every 1-3 weeks", "22False", "23False", "24False", "25very", "26True", "27very", "28False", "29False", "30little", "31little", "32average amount", "33love it", "34False", "35spread out across country", "36low - Medium", "37High", "38False", "39False", "40True", "41False", "42False", "43low", "44True", "45One", "46False", "47True", "48True", "49True", "50None", "51True", "52True", "53False", "54Medium", "55True", "56True", "57False", "58False", "59False", "60Updated Often", "61False", "62False", "63False", "64Low Budget", "65Low Budget", "66Low Budget", "67Low Budget", "68False", "69False", "70False", "71Small", "72True", "73False", "74Flexable", "75True", "76True", "77True", "78True", "79True", "80True", "81True", "82True", "83True", "84False", "85False", "86False", "87False", "88True", "89False", "90False", "91False" }; return View("Questions",User); }
public ActionResult AddtoTableLeader(int id, string role, int Aid, int Uid) { int AID = Aid; string Role = role; AddAccount(AID, Role, id); leaderTableV2 leader = db.leaderTableV2.Find(Uid); Account User = new Account(); User.AccountId = leader.Id; User.Rank = "Leader"; User.UserName = leader.UserName; return RedirectToAction("ExistingProjects", "Project", User); }
public ActionResult AddProjects(Project ListofProjects) { dynamic myModel = new ExpandoObject(); myModel.ProjectTable = possibleProjectsAdd(ListofProjects.Rank,ListofProjects.AccountId); JunctionTableProjectAndAccountV2 table = new JunctionTableProjectAndAccountV2(); table.AID = ListofProjects.AccountId; table.Role = ListofProjects.Rank; myModel.JunctionTableProjectAndAccount = table; Account user = new Account(); user.AccountId = ListofProjects.AccountId; myModel.user = user; //Needs to go to the page that allows them to add a project return View("AddProjects", myModel); }
public ActionResult Result(FormCollection form, Account User) { Debug.Print("ANS COUNT IN CONTROLLER"); //BRad Removed this //string[] Answers = new string[form.Count]; //for now hard code it //form.CopyTo(Answers, 0); //End Brads Remove /*Debug.Print("Length of form is: "); Debug.Print(Answers.Length.ToString()); for (int i = 0; i < Answers.Length; i++) { Debug.Write(Answers[i] +","); }*/ /**** Brads Code Adding the Account Id makes the form length 1 more larger, I had to fix it */ string[] Answers = new string[form.Count - 1]; string[] wrongAnswers = new string[form.Count]; form.CopyTo(wrongAnswers, 0); for (int i = 0; i < wrongAnswers.Length - 1; i++) { Answers[i] = wrongAnswers[i + 1]; } // BRads code ends if (PModel.IsValid(Answers)) { Answers = PModel.RemoveQuestionIDS(Answers); PModel.Answers = Answers; PModel.EliminateProcessModels(); string Result=PModel.ChooseProcessModels(); ViewData["result"] = Result; return View("Result",User); } else { ViewData["questions"] = PModel.Questions; ViewData["multAnswers"] = PModel.MultipleChoiceAnswers; ViewData["isValid"] = "false"; ViewData["answers"] = Answers; return View("Questions", User); } }
public ActionResult AddtoTable(int id, string role, int Aid, int Uid) { int AID = Aid; string Role = role; AddAccount(AID, Role, id); Account User = new Account(); if (Role == "Member") { memberTableV2 member = db.memberTableV2.Find(Uid); User.AccountId = member.Id; User.Rank = "Member"; User.UserName = member.UserName; } else { administrationV2 admin = db.administrationV2.Find(Uid); User.AccountId = admin.Id; User.Rank = "Admin"; User.UserName = admin.UserName; } return View("SuccessPage", User); }
public ActionResult ChangedPassword(Account User) { ViewData["Password"] = ConfirmedUser.UpdatePassword(User.UserName, User.Password); return View("InputPassword", User); }
/** Called: after the user hits the 'Sign In' button Routes to: Index if invalid or Project if valid **/ //[HttpPost] public ActionResult SignIn(Account user) { ConfirmedUser = user.Verify(user); ViewData["isValid"] = ConfirmedUser.Rank; ViewData["Email"] = ConfirmedUser.ConfirmEmail; if (ConfirmedUser.Rank != "Fail" && ConfirmedUser.ConfirmEmail == true) { return RedirectToAction("ExistingProjects", "Project", user); } else{return View("Index");} }
/** Called: after inputting email and clicking 'reset password' **/ public ActionResult SendForgotEmail(Account user) { if (user.Rank == "Member" || user.Rank == "Leader" || user.Rank == "Admin") { if(user.Rank == "Member") { string queryM = "SELECT * FROM memberTableV2 WHERE UserName='******'"; memberTableV2 MT = db.memberTableV2.SqlQuery(queryM).SingleOrDefault(); if (MT == null) { string queryM2 = "SELECT * FROM memberTableV2 WHERE Email='" + user.Email + "'"; memberTableV2 MT2 = db.memberTableV2.SqlQuery(queryM2).SingleOrDefault(); if (MT2 == null) { ViewData["UserName"] = "******"; return View("ForgotPassword"); } else { ViewData["Email"] = user.sendEmailPassword(MT2.Email, MT2.UserName); return View("EmailForgotPage"); } } else { ViewData["Email"] = user.sendEmailPassword(MT.Email, MT.UserName); return View("EmailForgotPage"); } } else if(user.Rank == "Leader") { string queryL = "SELECT * FROM leaderTableV2 WHERE UserName='******'"; leaderTableV2 LT = db.leaderTableV2.SqlQuery(queryL).SingleOrDefault(); if (LT == null) { string queryL2 = "SELECT * FROM leaderTableV2 WHERE Email='" + user.Email + "'"; leaderTableV2 LT2 = db.leaderTableV2.SqlQuery(queryL2).SingleOrDefault(); if (LT2 == null) { ViewData["UserName"] = "******"; return View("ForgotPassword"); } else { ViewData["Email"] = user.sendEmailPassword(LT2.Email, LT2.UserName); return View("EmailForgotPage"); } } else { ViewData["Email"] = user.sendEmailPassword(LT.Email, LT.UserName); return View("EmailForgotPage"); } } else { string queryA = "SELECT * FROM administrationV2 WHERE UserName='******'"; administrationV2 AT = db.administrationV2.SqlQuery(queryA).SingleOrDefault(); if (AT == null) { string queryA2 = "SELECT * FROM administrationV2 WHERE Email='" + user.Email + "'"; administrationV2 AT2 = db.administrationV2.SqlQuery(queryA2).SingleOrDefault(); if (AT2 == null) { ViewData["UserName"] = "******"; return View("ForgotPassword"); } else { ViewData["Email"] = user.sendEmailPassword(AT2.Email, AT2.UserName); return View("EmailForgotPage"); } } else { ViewData["Email"] = user.sendEmailPassword(AT.Email, AT.UserName); return View("EmailForgotPage"); } } } else { ViewData["Rank"] = "Fail"; return View("ForgotPassword"); } }
public ActionResult ResendPass(Account PossibleUser) { SendForgotEmail(PossibleUser); return View("EmailForgotPage"); }
/** Called: after the user hits the 'Sign Up' button at the end of the sign up form Routes to: itself if form was filled out incorrectly, emailconfirationpage if was filled out correctly **/ public ActionResult Resend(Account PossibleUser) { ConfirmedUser = PossibleUser.Verify(PossibleUser); ConfirmedUser.sendEmail(ConfirmedUser.Email,ConfirmedUser.UserName); return View("EmailConfirmationPage"); }
public ActionResult InputPassword(Account User) { ViewData["Password"] = "******"; return View("InputPassword", User); }
public ActionResult EditTable(string DropChoice) { string result = DropChoice; Regex r = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))"); string[] strArray; strArray = r.Split(DropChoice); string resp = strArray[0]; int id = Int32.Parse(strArray[1]); int AID = Int32.Parse(strArray[3]); string Role = strArray[2]; int Uid = Int32.Parse(strArray[4]); string query = "SELECT * FROM JunctionTableProjectAndAccountV2 WHERE AID= " + AID + " AND Role= '" + Role + "' AND PId = " + id; JunctionTableProjectAndAccountV2 JT = db.JunctionTableProjectAndAccountV2.SqlQuery(query).SingleOrDefault(); JT.Responsibilities = resp; db.Entry(JT).State = EntityState.Modified; db.SaveChanges(); leaderTableV2 leader = db.leaderTableV2.Find(Uid); Account User = new Account(); User.AccountId = leader.Id; User.Rank = "Leader"; User.UserName = leader.UserName; return RedirectToAction("ExistingProjects", "Project", User); }
public ActionResult SuccessToExisting(Account User) { return RedirectToAction("ExistingProjects", "Project", User); }
public ActionResult ReturnExistingProjects(int UId) { administrationV2 admin = db.administrationV2.Find(UId); Account User = new Account(); User.AccountId = admin.Id; User.Rank = "Admin"; User.UserName = admin.UserName; return RedirectToAction("ExistingProjects", "Project", User); }
public ActionResult RemoveTable(int id, string role, int Aid, int Uid) { int AID = Aid; string Role = role; string query = "SELECT * FROM JunctionTableProjectAndAccountV2 WHERE AID= " + Aid + " AND Role= '" + Role + "' AND PId = " + id; JunctionTableProjectAndAccountV2 JT = db.JunctionTableProjectAndAccountV2.SqlQuery(query).SingleOrDefault(); db.JunctionTableProjectAndAccountV2.Remove(JT); db.SaveChanges(); leaderTableV2 leader = db.leaderTableV2.Find(Uid); Account User = new Account(); User.AccountId = leader.Id; User.Rank = "Leader"; User.UserName = leader.UserName; return RedirectToAction("ExistingProjects", "Project", User); }
public ActionResult LeaderSwitch(int oldLid, int newLid, int PId, int UId) { leaderToAndFrom(oldLid, newLid, PId); administrationV2 admin = db.administrationV2.Find(UId); Account User = new Account(); User.AccountId = admin.Id; User.Rank = "Admin"; User.UserName = admin.UserName; return RedirectToAction("ExistingProjects", "Project", User); }
// GET: Project public ActionResult ExistingProjects(Account User) { Project ListofProjects = new Project(); ListofProjects = ListofProjects.UsersProjects(User); //Needs to go get the Projects the user is in than display those projects return View("ExistingProjects", ListofProjects); }
public ActionResult VerifyPassword() { string UserName = (string)RouteData.Values["id"]; Account User = new Account(); User.UserName = UserName; ViewData["Password"] = "******"; return View("InputPassword", User); }
/** Method forms queries to look in the member, admin and leader DB. If the query returns anything other than null it is in the DB. **/ private Account Find(Account PossibleUser) { string queryM = "SELECT * FROM memberTableV2 WHERE UserName='******' AND Password='******'"; memberTableV2 MT = db.memberTableV2.SqlQuery(queryM).SingleOrDefault(); string queryL = "SELECT * FROM leaderTableV2 WHERE UserName='******' AND Password='******'"; leaderTableV2 LT = db.leaderTableV2.SqlQuery(queryL).SingleOrDefault(); string queryA = "SELECT * FROM administrationV2 WHERE UserName='******' AND Password='******'"; administrationV2 AT = db.administrationV2.SqlQuery(queryA).SingleOrDefault(); if (MT != null) { PossibleUser.Rank = "Member"; PossibleUser.ConfirmEmail = MT.ConfirmEmail; PossibleUser.Email = MT.Email; PossibleUser.AccountId = MT.Id; } else if (LT != null) { PossibleUser.Rank = "Leader"; PossibleUser.ConfirmEmail = LT.ConfirmEmail; PossibleUser.Email = LT.Email; PossibleUser.AccountId = LT.Id; } else if (AT != null) { PossibleUser.Rank = "Admin"; PossibleUser.ConfirmEmail = AT.ConfirmEmail; PossibleUser.Email = AT.Email; PossibleUser.AccountId = AT.Id; } else { PossibleUser.Rank = "Fail"; } return PossibleUser; }
//protected RegistrationEntities1 db2 = new RegistrationEntities1(); public Project UsersProjects(Account User) { List<JunctionTableProjectAndAccountV2> projects = db2.JunctionTableProjectAndAccountV2.ToList(); List<ProjectTable> projectsProess = db2.ProjectTables.ToList(); Project UsersProjects = new Project(); int j = 0; UsersProjects.ProjectId = new int[projects.Count]; UsersProjects.UserName = User.UserName; UsersProjects.Rank = User.Rank; UsersProjects.AccountId = User.AccountId; foreach (JunctionTableProjectAndAccountV2 project in projects) { try { if (project.Role.Contains(User.Rank) && project.AID == User.AccountId) { UsersProjects.ProjectId[j] = new int(); UsersProjects.ProjectId[j] = (int)project.PId; j++; } } catch (ArgumentNullException){} } int numberOfIds = UsersProjects.ProjectId.Length; if (numberOfIds > 0) { UsersProjects.ProjectProcess = new string[numberOfIds]; int k = 0; foreach (int id in UsersProjects.ProjectId) { foreach (ProjectTable process in projectsProess) { if (id == process.ProjectId) { UsersProjects.ProjectProcess[k] = process.ProcessModelChosen; } } k++; } k = 0; UsersProjects.Responsibiltes = new string[numberOfIds]; foreach (JunctionTableProjectAndAccountV2 project in projects) { if (project.Role.Contains(User.Rank) && project.AID == User.AccountId) { UsersProjects.Responsibiltes[k] = project.Responsibilities; k++; } } } return UsersProjects; }
public ActionResult Test(FormCollection form) { string[] info = new string[form.Count]; form.CopyTo(info, 0); int id = Convert.ToInt16(info[0]); string model = info[1]; //RegistrationEntities1Entities1 db = new RegistrationEntities1Entities1(); RegistrationEntities1 db = new RegistrationEntities1(); db.ProjectTables.Add(new ProjectTable { ProcessModelChosen = model }); db.SaveChanges(); List<ProjectTable> projectTables = db.ProjectTables.ToList(); ProjectTable justAdded = projectTables.Last(); db.JunctionTableProjectAndAccountV2.Add(new JunctionTableProjectAndAccountV2 { AID = id, PId = justAdded.ProjectId, Responsibilities = "Leader", Role = "Leader" }); db.SaveChanges(); leaderTableV2 leader = db.leaderTableV2.Find(id); Account User = new Account(); User.AccountId = leader.Id; User.Rank = "Leader"; User.UserName = leader.UserName; return RedirectToAction("ExistingProjects", "Project", User); }
//protected RegistrationEntities1Entities1 db = new RegistrationEntities1Entities1(); //protected RegistrationEntities1 db = new RegistrationEntities1(); //protected RegistrationEntities1 db = new RegistrationEntities1(); //instance of the registration DB /**** Verifies the possible user If the user filled out the username and password fields the try to find the user in the registration DB ****/ public Account Verify(Account PossibleUser) { if (PossibleUser.Password != null && PossibleUser.UserName != null) { return PossibleUser.Find(PossibleUser); } else { PossibleUser.Rank = "Fail"; return PossibleUser; } }