コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Views.cs プロジェクト: SMITHSTEPH/FundamentalsOfSE
 public void AddPeopleTest()
 {
     Project ListofProjects = new Project();
     var Result = ProjectTestController.AddPeople(ListofProjects) as ViewResult;
     Assert.AreEqual("AddPeople", Result.ViewName);
 }
コード例 #3
0
 public ActionResult AddPeople(Project ListofProjects)
 {
     return View("AddPeople", ListofProjects);
 }
コード例 #4
0
        public ActionResult LeaderExchange(Project ListofProjects)
        {
            dynamic myModel = new ExpandoObject();
            myModel.ProjectTable = possibleProjects();
            JunctionTableProjectAndAccountV2 table = new JunctionTableProjectAndAccountV2();
            table.AID = ListofProjects.AccountId;
            myModel.JunctionTableProjectAndAccount = table;

            return View("LeaderExchange", myModel);
        }
コード例 #5
0
        // 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);
        }
コード例 #6
0
 public ActionResult EditPeople(Project ListofProjects)
 {
     dynamic myModel = new ExpandoObject();
     myModel.Members = db.memberTableV2.ToList();
     myModel.Leaders = db.leaderTableV2.ToList();
     JunctionTableProjectAndAccountV2 table = new JunctionTableProjectAndAccountV2();
     table.AID = ListofProjects.AccountId;
     table.Role = ListofProjects.Rank;
     myModel.JunctionTable = table;
     return View("EditPeople", myModel);
 }
コード例 #7
0
        public ActionResult ChangeRank(string role, int Aid, int UId)
        {
            if(role == "Member")
            {
                memberTableV2 mem = db.memberTableV2.Find(Aid);
                leaderTableV2 leader = new leaderTableV2();

                db.leaderTableV2.Add(new leaderTableV2
                {
                    UserName = mem.UserName,
                    Email = mem.Email,
                    ConfirmEmail = mem.ConfirmEmail,
                    OptionalPhoneNumber = mem.OptionalPhoneNumber,
                    Password = mem.Password,
                    Address = mem.Address,
                    BirthDate = mem.BirthDate,
                    Gender = mem.Gender,
                    FirstName = mem.FirstName,
                    MiddleName = mem.MiddleName,
                    LastName = mem.LastName,
                    PhoneNumber = mem.PhoneNumber
                });
                db.memberTableV2.Remove(mem);
                db.SaveChanges();

                List<leaderTableV2> leadList = db.leaderTableV2.ToList();
                leaderTableV2 newLeader = leadList.Last();
                UpdateJunction(Aid, "Member", newLeader.Id, "Leader", UId);

            }
            else
            {
                memberTableV2 mem = new memberTableV2();
                leaderTableV2 leader = db.leaderTableV2.Find(Aid);

                db.memberTableV2.Add(new memberTableV2
                {
                    UserName = leader.UserName,
                    Email = leader.Email,
                    ConfirmEmail = leader.ConfirmEmail,
                    OptionalPhoneNumber = leader.OptionalPhoneNumber,
                    Password = leader.Password,
                    Address = leader.Address,
                    BirthDate = leader.BirthDate,
                    Gender = leader.Gender,
                    FirstName = leader.FirstName,
                    MiddleName = leader.MiddleName,
                    LastName = leader.LastName,
                    PhoneNumber = leader.PhoneNumber
                });
                db.leaderTableV2.Remove(leader);
                db.SaveChanges();

                List<memberTableV2> memList = db.memberTableV2.ToList();
                memberTableV2 newMem = memList.Last();
                UpdateJunction(Aid, "Leader", newMem.Id, "Member", UId);

            }
            administrationV2 admin = db.administrationV2.Find(UId);

            Project ListOfProjects = new Project();
            ListOfProjects.AccountId = admin.Id;

            return RedirectToAction("EditPeople", ListOfProjects);
        }
コード例 #8
0
        //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;
        }