Пример #1
0
        public ActionResult AddContact(ListByDisasterViewModel model)
        {
            try
            {
                var person = _volunteerSvc.FindByUserId(_webSecurity.CurrentUserId);
                if (!person.OrganizationId.HasValue)
                {
                    throw new ArgumentException("Signed in User is not part of an Organization");
                }

                _adminSvc.AddContactForOrganization(person.OrganizationId.Value, model.AddContactId);
            }
            catch (ArgumentException ex)
            {
                ModelState.AddModelError("", ex.Message);
            }

            var viewModel = new ListByDisasterViewModel
            {
                Disasters = _disasterSvc.GetActiveList(),
                SelectedDisaster = model.SelectedDisaster,
                CommitmentDate = model.CommitmentDate
            };
            return View("ListByDisaster", viewModel);
        }
 public PartialViewResult Filter(ListByDisasterViewModel model)
 {
     if (model.SelectedDisaster != 0)
     {
         var results = _adminSvc.GetVolunteersForDisaster(model.SelectedDisaster, model.CommitmentDate);
         return PartialView("_FilterResults", results);
     }
     return PartialView("_FilterResults");
 }
        public PartialViewResult Filter(ListByDisasterViewModel model)
        {
            if (model.SelectedDisaster != 0)
            {

                var disaster = _disasterSvc.Get(model.SelectedDisaster);
                var results = model.CommitmentDate.HasValue ?
                    _adminSvc.GetVolunteersForDate(disaster, model.CommitmentDate.Value) :
                    _adminSvc.GetVolunteers(disaster);
                return PartialView("_FilterResults", results);
            }
            return PartialView("_FilterResults");
        }
Пример #4
0
 public PartialViewResult Filter(ListByDisasterViewModel model)
 {
     if (model.SelectedDisaster != 0)
     {
         var results = _adminSvc.GetVolunteersForDisaster(model.SelectedDisaster, model.CommitmentDate);
         var modifiedResults = (from person in results
                               select new Person
                               {
                                   Commitments = person.Commitments.Where(x => x.DisasterId == model.SelectedDisaster 
                                       && model.CommitmentDate >= x.StartDate 
                                       && model.CommitmentDate <= x.EndDate).ToList(),
                                   Email = person.Email,
                                   FirstName = person.FirstName,
                                   Id = person.Id,
                                   LastName = person.LastName,
                                   PhoneNumber = person.PhoneNumber,
                                   UserId = person.UserId
                               }).ToList();
         return PartialView("_FilterResults", modifiedResults);
     }
     return PartialView("_FilterResults");
 }
 public ActionResult ListByDisaster()
 {
     var model = new ListByDisasterViewModel { Disasters = _disasterSvc.GetActiveList() };
     return View(model);
 }
Пример #6
0
 public ActionResult ListResourceCheckinsByDisaster()
 {
     var model = new ListByDisasterViewModel { Disasters = _disasterSvc.GetActiveList(), CommitmentDate = null };
     return View(model);
 }
Пример #7
0
        public PartialViewResult FilterResourceCheckins(ListByDisasterViewModel model)
        {
            var result = new CheckinListsResultsViewModel();

            if (model.SelectedDisaster != 0)
            {
                result.ResourceCheckins = _adminSvc.GetResourceCheckinsForDisaster(model.SelectedDisaster, model.CommitmentDate).ToList();
            }

            return PartialView("_FilterResourceCheckinResults", result);
        }
Пример #8
0
        public PartialViewResult Filter(ListByDisasterViewModel model)
        {
            var result = new CheckinListsResultsViewModel();

            if (model.SelectedDisaster != 0)
            {
                result.OrganizationContacts = _adminSvc.GetContactsForDisaster(model.SelectedDisaster).ToList();

                var volunteers = _adminSvc.GetVolunteersForDisaster(model.SelectedDisaster, model.CommitmentDate);

                if (model.CommitmentDate == null)
                {
                    result.VolunteerCheckins = (from person in volunteers
                                                select new Person
                                                {
                                                    Commitments = person.Commitments.Where(x => x.DisasterId == model.SelectedDisaster).ToList(),
                                                    Email = person.Email,
                                                    FirstName = person.FirstName,
                                                    Organization = person.Organization,
                                                    OrganizationId = person.OrganizationId,
                                                    Id = person.Id,
                                                    LastName = person.LastName,
                                                    PhoneNumber = person.PhoneNumber,
                                                    UserId = person.UserId
                                                }).ToList();

                }
                else
                {
                    result.VolunteerCheckins = (from person in volunteers
                                                select new Person
                                                {
                                                    Commitments = person.Commitments.Where(x => x.DisasterId == model.SelectedDisaster
                                                        && model.CommitmentDate >= x.StartDate
                                                        && model.CommitmentDate <= x.EndDate).ToList(),
                                                    Email = person.Email,
                                                    FirstName = person.FirstName,
                                                    Id = person.Id,
                                                    LastName = person.LastName,
                                                    PhoneNumber = person.PhoneNumber,
                                                    UserId = person.UserId
                                                }).ToList();

                }
            }

            return PartialView("_FilterResults", result);
        }