public ActionResult ConfirmCoWorker(int id)
        {
            CoWorkerRepository coWorkerRepository = new CoWorkerRepository();
            CoWorker           firstFriendShip    = coWorkerRepository.GetCoWorkerRequest(id);

            // make sure the id is actually for the proper CoWorkerUserId (logged in user) dont want people working the system
            if (firstFriendShip.CoWorkerUserId != UserHelpers.GetUserId(User.Identity.Name))
            {
                TempData["errorMessage"] = "It appears that you are not the proper recepient for the provided coworkder request";
                return(RedirectToAction("Coworkers"));
            }

            firstFriendShip.AreFriends = true;
            coWorkerRepository.Save();

            // we now create a second friendship so that we have a two way friendship
            CoWorker secondFriendship = new CoWorker();

            secondFriendship.UserId         = firstFriendShip.CoWorkerUserId;
            secondFriendship.CoWorkerUserId = firstFriendShip.UserId;
            secondFriendship.AreFriends     = true;

            coWorkerRepository.Add(secondFriendship);
            coWorkerRepository.Save();


            var coWorkerFullName = UserHelpers.GetUserFullName(firstFriendShip.CoWorkerUserId);

            TempData["message"] = coWorkerFullName + " has been added to your coworker list. Thank you for being social.";
            return(RedirectToAction("Wall"));
        }
Exemplo n.º 2
0
        public void Setup()
        {
            Boundary lobby      = new Boundary("Lobby", " You find yourself in the lobby, always on the lookout for HR and dodging darts as your coworkes shoot at you");
            Boundary mainOffice = new Boundary("Office", "You are around the office running around as you dodge the darts that are being shot at you. Meanwhile the day keeps on going. Remember HR is always lurking");
            Boundary myDesk     = new Boundary("Desk", "You come to your cubible thinking that it may be a safe space, but oh so wrong you were. You gotta keep shooting");
            Boundary breakRoom  = new Boundary("Cafe", "Even in the Cafe you aren't safe. You got to keep shooting");

            lobby.AddNeighborBoundary(mainOffice, true);
            myDesk.AddNeighborBoundary(breakRoom, true);
            mainOffice.AddNeighborBoundary(myDesk, true);
            lobby.AddNeighborBoundary(myDesk, true);
            lobby.AddNeighborBoundary(breakRoom, true);
            mainOffice.AddNeighborBoundary(breakRoom, true);

            Location = lobby;

            Item gun        = new Item("Cricket", 0, "Single Dart Nerf Blaster 10,000");
            Item playerAmmo = new Item("Dart", 5);
            Item ammoDesk   = new Item("Dart", 5);
            Item ammoMain   = new Item("Dart");
            Item ammoLobby  = new Item("Dart");
            Item ammoBreak  = new Item("Dart");

            gun.AmmoCount = 1;
            myDesk.Items.Add(ammoDesk);
            mainOffice.Items.Add(ammoMain);
            breakRoom.Items.Add(ammoBreak);
            lobby.Items.Add(ammoLobby);
            breakRoom.Items.Add(ammoBreak);

            Player = new Player("Joe");
            Player.Inventory.Add(gun);
            Player.Inventory.Add(playerAmmo);
            CoWorker = new CoWorker(Team());
        }
Exemplo n.º 3
0
    // Gets an available worker and removes it from the list of workers.
    public CoWorker getAvailableWorker()
    {
        if (availableWorkers.Count == 0)
        {
            return(null);
        }
        CoWorker ret = availableWorkers[0];

        availableWorkers.RemoveAt(0);
        return(ret);
    }
Exemplo n.º 4
0
        public void Setup()
        {
            UsingContactBook = true;

            ContactBook = new ContactBook("CodeWorks");

            Friend       friend1       = new Friend("Tom", "Jones", "Boise", "Tommy");
            FamilyMember familyMember1 = new FamilyMember("Peter", "Parker", "Queens", "Spidey");
            CoWorker     coWorker1     = new CoWorker("Charles", "Xavier", "Manhattan", "School of Gifted Students", "Professor");

            friend1.DisplayContactDetails();

            ContactBook.Contacts.Add(friend1);
            ContactBook.Contacts.Add(familyMember1);
            ContactBook.Contacts.Add(coWorker1);
        }
        public ActionResult AddCoWorker(Guid?id, string confirm)
        {
            if (id.HasValue)
            {
                CoWorkerRepository coWorkerRepository = new CoWorkerRepository();
                Guid   requesterUserId      = UserHelpers.GetUserId(User.Identity.Name);
                string requesterFullName    = UserHelpers.GetUserFullName(User.Identity.Name);
                string coWorkerEmailAddress = UserHelpers.GetUserEmailAddress(id.Value);
                string coWorkderFullName    = UserHelpers.GetUserFullName(id.Value);

                //
                // first make sure no such friendship already exist)
                if (coWorkerRepository.CoWorkersAreFriends(requesterUserId, id.Value))
                {
                    TempData["errorMessage"] = "Records indicate you and " + coWorkderFullName + " have an existing friendship. There is no need to send a coworker request.";
                    return(RedirectToAction("CoWorkers"));
                }

                //
                // Now make sure no such previous request exist
                if (coWorkerRepository.CoWorkerRequestPending(requesterUserId, id.Value))
                {
                    TempData["errorMessage"] = "There is already a coworker request for " + coWorkderFullName + " pending approval. Upon approval by " + coWorkderFullName + " we will notify you.";
                    return(RedirectToAction("CoWorkers"));
                }

                //
                // Proceed to initiate a coworker request
                CoWorker coWorker = new CoWorker()
                {
                    AreFriends = false, CoWorkerUserId = id.Value, UserId = requesterUserId
                };
                coWorkerRepository.Add(coWorker);
                coWorkerRepository.Save();


                new EmailNotificationHelpers().AddCoWorkerEmail(coWorker.CoWorkerId, requesterFullName, coWorkerEmailAddress);
                TempData["message"] = "We have sent " + coWorkderFullName + " a coworker request notification; We will notify you upon request approval.";
                return(RedirectToAction("CoWorkers"));
            }

            TempData["errorMessage"] = "There was an error processing your request";
            return(View());
        }
Exemplo n.º 6
0
 void assignToNPC()
 {
     if (!CoWorker.busyMutex)
     {
         CoWorker c = manager.getAvailableWorker();
         if (c != null)
         {
             if (c.assignTask(workTime))
             {
                 CoWorker.busyMutex = true;
                 Invoke("setCoWorkerBusyMutex", 0.0001f);
                 UnlockMutex();
                 Destroy(gameObject, 0.001f);
             }
         }
         else
         {
             Debug.Log("No Workers!");
         }
     }
 }
 public void Add(CoWorker coWorker)
 {
     db.CoWorkers.InsertOnSubmit(coWorker);
 }
Exemplo n.º 8
0
 public void addWorker(CoWorker c)
 {
     availableWorkers.Add(c);
 }