protected override void LoadTestData()
        {
            var itinerary1 = new Itinerary
            {
                Id   = 1,
                Name = "Test Itinerary 1"
            };

            var task1 = new VolunteerTask
            {
                Id   = 1,
                Name = "Test Task"
            };

            var taskSignup1 = new VolunteerTaskSignup
            {
                Id            = 1,
                VolunteerTask = task1,
                Itinerary     = itinerary1,
                IsTeamLead    = true
            };

            Context.Add(itinerary1);
            Context.Add(task1);
            Context.Add(taskSignup1);

            Context.SaveChanges();
        }
Esempio n. 2
0
        public async Task UpdateVolunteerTasksAsync(VolunteerTask updatedVolunteerTask)
        {
            var volunteerTask = mapper.Map <Models.Db.VolunteerTask>(updatedVolunteerTask);

            db.VolunteerTasks.Update(volunteerTask);
            await db.SaveChangesAsync();
        }
Esempio n. 3
0
        public void VolunteerTaskThatHasInstanceOfEventAndEventHasInstanceOfCampaignAndCampaignHasInstanceOfOrganizerAndOrganizerIdEqualsUserIdIsEditable()
        {
            const string userId = "1";

            var claimsPrincipal = new ClaimsPrincipal();

            claimsPrincipal.AddIdentity(new ClaimsIdentity(new List <Claim>
            {
                new Claim(ClaimTypes.NameIdentifier, "1"),
                new Claim(AllReady.Security.ClaimTypes.UserType, nameof(UserType.BasicUser))
            }));

            var volunteerTask = new VolunteerTask {
                Event = new Event {
                    Campaign = new Campaign {
                        Organizer = new ApplicationUser {
                            Id = userId
                        }
                    }
                }
            };

            var sut    = new DetermineIfATaskIsEditable();
            var result = sut.For(claimsPrincipal, volunteerTask, UserManager);

            Assert.True(result);
        }
Esempio n. 4
0
        /// <summary>
        /// NAME: Ethan Holmes
        /// DATE: 2/6/2020
        ///
        /// this is the edit button which will bring up create task form
        /// with editable properties for selected task.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditVolunteerTask_Click(object sender, RoutedEventArgs e)
        {
            VolunteerTaskVM selectedTaskVM = (VolunteerTaskVM)dgVolTaskList.SelectedItem;
            VolunteerTask   selectedTask   = _volunteerTaskManager.GetVolunteerTaskByName(selectedTaskVM.TaskName.ToString());

            //frmCreateVolunteerTask editTask = new frmCreateVolunteerTask();

            txtTaskName.Text                 = selectedTask.TaskName.ToString();
            comboAssignmentGroup.Text        = selectedTask.AssignmentGroup.ToString();
            comboTaskType.Text               = selectedTask.TaskType.ToString();
            txtVolunteerTaskDate.Text        = selectedTask.DueDate.ToString();
            txtVolunteerTaskDescription.Text = selectedTask.TaskDescription.ToString();

            txtTaskName.IsReadOnly = true;

            canCreateTask.Visibility = Visibility.Visible;
            canViewTasks.Visibility  = Visibility.Hidden;

            //editTask.Show();



            btnSave.Visibility = Visibility.Visible;
            btnCreateVolunteerTask.Visibility = Visibility.Hidden;
        }
Esempio n. 5
0
        public async Task <VolunteerTask> CreateVolunteerTaskAsync(VolunteerTask newVolunteerTask)
        {
            var volunteerTask = mapper.Map <Models.Db.VolunteerTask>(newVolunteerTask);
            var newEntity     = await db.VolunteerTasks.AddAsync(volunteerTask);

            await db.SaveChangesAsync();

            return(mapper.Map <VolunteerTask>(newEntity.Entity));
        }
Esempio n. 6
0
        public ActionResult Create(int eventId)
        {
            var eventForTask = service.GetEvent(eventId);
            var taskStart = DateTime.Now;
            var taskEnd = DateTime.Now;

            if (eventForTask != null)
            {
                taskStart = eventForTask.StartTime;
                taskEnd = eventForTask.EndTime;
            }

            VolunteerTask task = new VolunteerTask { EventId = eventId, StartTime = taskStart, EndTime = taskEnd };
            return View(task);
        }
Esempio n. 7
0
 private static VolunteerTask CloneVolunteerTask(VolunteerTask volunteerTask)
 {
     return(new VolunteerTask
     {
         Name = volunteerTask.Name,
         Description = volunteerTask.Description,
         Organization = volunteerTask.Organization,
         NumberOfVolunteersRequired = volunteerTask.NumberOfVolunteersRequired,
         StartDateTime = volunteerTask.StartDateTime,
         EndDateTime = volunteerTask.EndDateTime,
         RequiredSkills = CloneVolunteerTaskRequiredSkills(volunteerTask).ToList(),
         IsLimitVolunteers = volunteerTask.IsLimitVolunteers,
         IsAllowWaitList = volunteerTask.IsAllowWaitList
     });
 }
        private static string GetVolunteerTaskSkillsInfo(VolunteerTask volunteerTask, ApplicationUser volunteer)
        {
            var result = new StringBuilder();

            if (volunteerTask.RequiredSkills.Count == 0)
            {
                return(result.ToString());
            }
            result.AppendLine("   Skills Required:");
            foreach (var skill in volunteerTask.RequiredSkills)
            {
                var userMatch = volunteer.AssociatedSkills.Any(vs => vs.SkillId == skill.SkillId);
                result.AppendLine($"      {skill.Skill.Name} {(userMatch ? "(match)" : string.Empty)}");
            }
            return(result.ToString());
        }
Esempio n. 9
0
 public ActionResult Create(VolunteerTask newTask)
 {
     try
     {
         service.AddTaskToEvent( new Task
                                     {
                                         StartTime = newTask.StartTime,
                                         EndTime = newTask.EndTime,
                                         Capacity = newTask.Capacity,
                                         EventID = newTask.EventId,
                                         Description = newTask.Description
                                     });
         return RedirectToAction("Index");
     }
     catch
     {
         return View(newTask);
     }
 }
Esempio n. 10
0
        public EditVolunteerTaskQueryHandlerShould()
        {
            task = new VolunteerTask
            {
                Id            = 1,
                Name          = "Taskname",
                Description   = "Description",
                StartDateTime = DateTimeOffset.Now,
                EndDateTime   = DateTimeOffset.Now,
                NumberOfVolunteersRequired = 5,
                RequiredSkills             = new List <VolunteerTaskSkill> {
                    new VolunteerTaskSkill {
                        SkillId = 2, Skill = new Skill(), VolunteerTaskId = 1
                    }
                },
                Event = new Event
                {
                    Id            = 3,
                    Name          = "EventName",
                    CampaignId    = 4,
                    StartDateTime = DateTimeOffset.UtcNow.AddDays(-2),
                    EndDateTime   = DateTimeOffset.Now.AddDays(-1),
                    Campaign      = new Campaign
                    {
                        StartDateTime          = DateTimeOffset.Now.AddDays(-5),
                        EndDateTime            = DateTimeOffset.Now.AddDays(-3),
                        Name                   = "CampaignName",
                        ManagingOrganizationId = 5,
                        TimeZoneId             = "Central Standard Time"
                    },
                    TimeZoneId = "Central Standard Time"
                }
            };

            Context.VolunteerTasks.Add(task);
            Context.SaveChanges();

            message = new EditVolunteerTaskQuery {
                VolunteerTaskId = task.Id
            };
            sut = new EditVolunteerTaskQueryHandler(Context);
        }
Esempio n. 11
0
        private VolunteerTask MapModel(Task model)
        {
            var vt = new VolunteerTask
            {
                Id = model.Id,
                StartTime = model.StartTime,
                EndTime = model.EndTime,
                Description = model.Description,
                Capacity = model.Capacity,
                Volunteers = new List<Volunteer>(model.Assignees.Count()),
            };

            if (model.Event != null)
            {
                vt.Event = new Models.Event {Name = model.Event.Name, ID = model.Event.ID};
            }

            if (model.Assignees != null)
            {
                model.Assignees
                     .ToList()
                     .ForEach(a => vt.Volunteers
                                     .Add(new Volunteer
                                              {
                                                  FirstName = a.FirstName,
                                                  LastName = a.LastName,
                                              }));
            }
            return vt;
        }
Esempio n. 12
0
 public ActionResult Edit(VolunteerTask volunteerTask)
 {
     try
     {
         var task = service.GetTaskById(volunteerTask.Id);
         task.Name = volunteerTask.Name;
         task.Description = volunteerTask.Description;
         task.Capacity = volunteerTask.Capacity;
         task.StartTime = volunteerTask.StartTime;
         task.EndTime = volunteerTask.EndTime;
         task.EndTime = volunteerTask.EndTime;
         task.EventID = volunteerTask.EventId;
         service.UpdateTask(task);
         return RedirectToAction("Index");
     }
     catch (Exception)
     {
         return View();
     }
 }