Exemple #1
0
        public ActionResult Create(PersonDetailViewModel person, FormCollection data)
        {
            //#region disability multiselect post
            //var intakeClientViewModel = new IntakeClientViewModel();

            //var value = data["SelectedDisabilities"];
            //var personDisabilityDetails = new PersonDisabilityModel();

            //string[] selectedDisabilityArray = data["SelectedDisabilities"].ToString().Split(',');
            //personDisabilityDetails.Delete(Convert.ToInt32(person.));

            //foreach (string i in selectedDisabilityArray)
            //{
            //    personDisabilityDetails.Create(Convert.ToInt32(i), personId);
            //}

            //if (intakeClientViewModel.PostedPresentationCondition != null)
            //{
            //    foreach (var item in intakeClientViewModel.PostedPresentationCondition.PresentationConditionIDs)
            //    {
            //        personDisabilityDetails.Create(Convert.ToInt32(item), personItem.Person_Id);
            //    }
            //}

            //#endregion
            return(View());
        }
Exemple #2
0
        /// <summary>
        /// Contreuctor.
        /// </summary>
        /// <param name="viewModel">ViewModel for the page.</param>
        /// <param name="peopleViewModel">PeopleViewModel for deleting the person.</param>
        public PersonDetailPage(PersonDetailViewModel viewModel, PeopleViewModel peopleViewModel)
        {
            InitializeComponent();

            BindingContext  = this.viewModel = viewModel;
            PeopleViewModel = peopleViewModel;
        }
Exemple #3
0
        public ActionResult EditContactDetails(string personId)
        {
            var personDetail = new PersonDetailViewModel()
            {
                Person          = new Person(),
                PhysicalAddress = new Address(),
                PostalAddress   = new Address()
            };

            var personModel  = new PersonModel();
            var personToEdit = personModel.GetSpecificPerson(int.Parse(personId));

            var physicalAddress = personToEdit.Addresses.Any(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PhysicalAddress)) ? personToEdit.Addresses.First(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PhysicalAddress)) : new Address();
            var postalAddress   = personToEdit.Addresses.Any(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PostalAddress)) ? personToEdit.Addresses.First(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PostalAddress)) : new Address();

            if (physicalAddress.Town != null)
            {
                physicalAddress.Selected_Local_Municipality_Id = physicalAddress.Town.Local_Municipality_Id;
                physicalAddress.Selected_Municipality_Id       = physicalAddress.Town.Local_Municipality.District_Municipality_Id;
                physicalAddress.Selected_Province_Id           = physicalAddress.Town.Local_Municipality.District.Province_Id;
            }

            if (postalAddress.Town != null)
            {
                postalAddress.Selected_Local_Municipality_Id = postalAddress.Town.Local_Municipality_Id;
                postalAddress.Selected_Municipality_Id       = postalAddress.Town.Local_Municipality.District_Municipality_Id;
                postalAddress.Selected_Province_Id           = postalAddress.Town.Local_Municipality.District.Province_Id;
            }

            personDetail.Person          = personToEdit;
            personDetail.PhysicalAddress = physicalAddress;
            personDetail.PostalAddress   = postalAddress;

            return(PartialView("_ContactDetailsEdit", personDetail));
        }
        public PersonDetailPage()
        {
            int id = 1319465;

            InitializeComponent();
            BindingContext = viewModel = new PersonDetailViewModel(id);
        }
 public DetailPersonCommand(PersonRepository personRepository, PersonDetailViewModel viewModel,
                            IMessenger messenger)
 {
     _messenger            = messenger;
     this.personRepository = personRepository;
     _viewModel            = viewModel;
 }
Exemple #6
0
        // GET: Person/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            PersonDetailViewModel personDetailViewModel = new PersonDetailViewModel();

            personDetailViewModel.person    = db.People.Find(id);
            personDetailViewModel.address   = db.Addresses.Where(a => a.PersonId == id).ToList();
            personDetailViewModel.countries = db.Countries.ToList();
            personDetailViewModel.cities    = new List <City>();

            if (personDetailViewModel == null)
            {
                return(HttpNotFound());
            }

            return(View(personDetailViewModel));

            //Person person = db.People.Find(id);
            //if (person == null)
            //{
            //    return HttpNotFound();
            //}
            //return View(person);
        }
Exemple #7
0
        public ActionResult Create(string personId)
        {
            var person = new PersonDetailViewModel()
            {
                Person          = new Person(),
                PhysicalAddress = new Address(),
                PostalAddress   = new Address()
            };

            return(PartialView("_PersonDetails", person));
        }
Exemple #8
0
        public ActionResult Details(int id)
        {
            var viewModel = new PersonDetailViewModel()
            {
                Person            = _unitOfWork.Persons.GetPerson(id),
                Appointments      = _unitOfWork.Appointments.GetAppointmentWithPatient(id),
                CountAppointments = _unitOfWork.Appointments.CountAppointments(id),
                CountAttendance   = _unitOfWork.Attandences.CountAttendances(id)
            };

            return(View("Details", viewModel));
        }
Exemple #9
0
        public ActionResult PersonDetails(int id)
        {
            var person = personService.GetPersonById(id);

            if (person != null)
            {
                var validation = catalogsValidator.ValidatePersonBeforeDelet(person);
                var model      = new PersonDetailViewModel(person);

                model.CanDeletePerson = validation.IsValid;
                model.DeleteMessage   = validation.ValidationMessage;
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
Exemple #10
0
        public IActionResult Delete(int id)
        {
            var person = peopleService.GetPersonWithChilds(id);

            if (person != null)
            {
                PersonDetailViewModel model = new PersonDetailViewModel()
                {
                    PersonId  = person.Id,
                    FirstName = person.FirstName,
                    LastName  = person.LastName,
                    Email     = person.Email,
                    Address   = person.Address,
                    Image     = person.Image
                };
                return(View(model));
            }
            return(NotFound());
        }
Exemple #11
0
        public ActionResult SavePersonDetails(PersonDetailViewModel personDetail)
        {
            var status  = "Error";
            var message = "A technical error has occurred! Please try again later";

            var personModel = new PersonModel();

            if (personDetail.Person.Person_Id == -1)
            {
                var          dateCreated = DateTime.Now;
                const string createdBy   = "jhendrikse";
                const bool   isActive    = true;
                const bool   isDeleted   = false;

                var newPerson = personModel.CreatePerson(personDetail.Person.First_Name, personDetail.Person.Last_Name, personDetail.Person.Known_As, personDetail.Person.Identification_Type_Id, personDetail.Person.Identification_Number, false, null, personDetail.Person.Date_Of_Birth, personDetail.Person.Age, personDetail.Person.Is_Estimated_Age, personDetail.Person.Sexual_Orientation_Id, personDetail.Person.Language_Id, personDetail.Person.Gender_Id, personDetail.Person.Marital_Status_Id, personDetail.Person.Religion_Id, personDetail.Person.Preferred_Contact_Type_Id, personDetail.Person.Phone_Number, personDetail.Person.Mobile_Phone_Number, personDetail.Person.Email_Address, personDetail.Person.Population_Group_Id, personDetail.Person.Nationality_Id, personDetail.Person.Disability_Type_Id, personDetail.Person.Citizenship_Id, dateCreated, createdBy, isActive, isDeleted);

                if (newPerson == null)
                {
                    status  = "OK";
                    message = "The person details have been successfully created.";
                }
            }
            else
            {
                var          dateLastModified = DateTime.Now;
                const string modifiedBy       = "jhendrikse";
                const bool   isActive         = true;
                const bool   isDeleted        = false;

                var updatedPerson = personModel.EditPerson(personDetail.Person.Person_Id, personDetail.Person.First_Name, personDetail.Person.Last_Name, personDetail.Person.Known_As, personDetail.Person.Identification_Type_Id, personDetail.Person.Identification_Number, personDetail.Person.Date_Of_Birth, personDetail.Person.Age, personDetail.Person.Is_Estimated_Age, personDetail.Person.Sexual_Orientation_Id, personDetail.Person.Language_Id, personDetail.Person.Gender_Id, personDetail.Person.Marital_Status_Id, personDetail.Person.Religion_Id, personDetail.Person.Preferred_Contact_Type_Id, personDetail.Person.Phone_Number, personDetail.Person.Mobile_Phone_Number, personDetail.Person.Email_Address, personDetail.Person.Population_Group_Id, personDetail.Person.Nationality_Id, personDetail.Person.Disability_Type_Id, personDetail.Person.Citizenship_Id, dateLastModified, modifiedBy, isActive, isDeleted);

                if (updatedPerson == null)
                {
                    status  = "OK";
                    message = "The person details have been successfully edited.";
                }
            }

            return(new JsonResult {
                Data = new { status, message }
            });
        }
Exemple #12
0
        public IActionResult Detail(int id)
        {
            var person = peopleService.GetPersonWithChilds(id);

            if (person != null)
            {
                PersonDetailViewModel model = new PersonDetailViewModel()
                {
                    PersonId  = person.Id,
                    FirstName = person.FirstName,
                    LastName  = person.LastName,
                    Email     = person.Email,
                    Phones    = person.Phones,
                    Address   = person.Address,
                    Image     = person.Image,
                };
                model.Tags = tagService.GetTagsByPersonId(id);
                return(View(model));
            }

            return(View());
        }
 public PersonDetailPage(Person person)
 {
     InitializeComponent();
     BindingContext = new PersonDetailViewModel(person);
 }
Exemple #14
0
        public ActionResult EditPersonalDetails(string personId, FormCollection data)
        {
            var personDetail = new PersonDetailViewModel()
            {
                Person          = new Person(),
                PhysicalAddress = new Address(),
                PostalAddress   = new Address()
            };

            var personModel  = new PersonModel();
            var personToEdit = personModel.GetSpecificPerson(int.Parse(personId));

            var physicalAddress = personToEdit.Addresses.Any(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PhysicalAddress)) ? personToEdit.Addresses.First(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PhysicalAddress)) : new Address();
            var postalAddress   = personToEdit.Addresses.Any(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PostalAddress)) ? personToEdit.Addresses.First(a => a.Address_Type_Id.Equals((int)AddressTypeEnum.PostalAddress)) : new Address();

            if (physicalAddress.Town != null)
            {
                physicalAddress.Selected_Local_Municipality_Id = physicalAddress.Town.Local_Municipality_Id;
                physicalAddress.Selected_Municipality_Id       = physicalAddress.Town.Local_Municipality.District_Municipality_Id;
                physicalAddress.Selected_Province_Id           = physicalAddress.Town.Local_Municipality.District.Province_Id;
            }

            if (postalAddress.Town != null)
            {
                postalAddress.Selected_Local_Municipality_Id = postalAddress.Town.Local_Municipality_Id;
                postalAddress.Selected_Municipality_Id       = postalAddress.Town.Local_Municipality.District_Municipality_Id;
                postalAddress.Selected_Province_Id           = postalAddress.Town.Local_Municipality.District.Province_Id;
            }

            personDetail.Person          = personToEdit;
            personDetail.PhysicalAddress = physicalAddress;
            personDetail.PostalAddress   = postalAddress;

            #region disability multiselct Get
            var disabilityType = new DisabilityModel();
            personDetail.PostedDisabilityType = new Posted_DisabilityType();


            if (personDetail.Person != null)
            {
                personDetail.SelectedDisabilityType = disabilityType.GetSelectedListOfDisabilities(personDetail.Person.Person_Id);
                int index = 0;
                personDetail.PostedDisabilityType = new Posted_DisabilityType();
                personDetail.PostedDisabilityType.DisabilityTypeIDs = new int[personDetail.SelectedDisabilityType.Count()];

                foreach (var item in personDetail.SelectedDisabilityType)
                {
                    personDetail.PostedDisabilityType.DisabilityTypeIDs[index] = item.Disability_Id;
                    index++;
                }
            }
            else
            {
                personDetail.SelectedDisabilityType = disabilityType.GetSelectedListOfDisabilities(-1);
            }

            //var disabilityType = new DisabilityModel();
            List <SelectListItem> AvailableDisabilityType = new List <SelectListItem>();


            foreach (var item in disabilityType.GetListOfDisabilities())
            {
                var  SelectItem   = new SelectListItem();
                bool itemSelected = false;

                if (personDetail.PostedDisabilityType.DisabilityTypeIDs != null)
                {
                    if (personDetail.PostedDisabilityType.DisabilityTypeIDs.Contains(item.Disability_Id))
                    {
                        itemSelected = true;
                    }
                }

                AvailableDisabilityType.Add(new SelectListItem
                {
                    Text     = item.Description,
                    Value    = item.Disability_Id.ToString(),
                    Selected = itemSelected
                });
            }

            ViewBag.AvailableDisabilityType = AvailableDisabilityType;

            personDetail.PostedDisabilityType.ListOfDisabilityTypeIDs = new SelectList(AvailableDisabilityType, "Value", "Text");
            #endregion

            return(PartialView("_PersonalDetailsEdit", personDetail));
        }
Exemple #15
0
 public PersonDetailPage()
 {
     this.InitializeComponent();
     _viewModel = (PersonDetailViewModel)DataContext;
 }
 public PersonDetailPage()
 {
     InitializeComponent();
     BindingContext = _viewModel = App.Current.Services.GetService <PersonDetailViewModel>();
 }
Exemple #17
0
 public PersonDetailPage(int id = 0)
 {
     InitializeComponent();
     BindingContext = new PersonDetailViewModel(Navigation, id);
 }
Exemple #18
0
        // GET: People/Details/5
        public async Task <IActionResult> Details(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var person = await _context.Persons
                         .FirstOrDefaultAsync(m => m.Id == id);

            if (person == null)
            {
                return(NotFound());
            }

            var viewModel = new PersonDetailViewModel
            {
                PersonId      = person.Id,
                Name          = person.Name,
                Biography     = person.Biography,
                Birthday      = person.Birthday,
                Gender        = person.Gender.ToString(),
                PlaceOfBirth  = person.PlaceOfBirth,
                PosterContent = person.PosterContent,
                Deathday      = person.Deathday,
                Cast          = new List <PersonDetailCastViewModel>(),
                Departments   = new List <PersonDetailDepartmentCrewViewModel>()
            };

            string userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            var favourite = await _context
                            .FavoritesPersons
                            .Where(x => x.UserId == userId && x.PersonId == person.Id)
                            .FirstOrDefaultAsync();

            viewModel.IsFavourite = favourite != null;

            var cast = await _context.Characters
                       .Include(x => x.SeriesCharacters)
                       .ThenInclude(x => x.Series)
                       .Where(x => x.PersonId == id)
                       .ToListAsync();

            foreach (var character in cast)
            {
                var seriesViewModel = new PersonDetailCastViewModel();

                var seriesCharacters = character.SeriesCharacters.FirstOrDefault(x => x.CharacterId == character.Id);

                if (seriesCharacters != null)
                {
                    seriesViewModel.SeriesName    = seriesCharacters.Series.Name;
                    seriesViewModel.SeriesId      = seriesCharacters.Series.Id;
                    seriesViewModel.CharacterName = character.Name;
                    seriesViewModel.SeriesRating  = seriesCharacters.Series.UserRating;

                    if (seriesCharacters.Series.AiredFrom != null)
                    {
                        seriesViewModel.Year = seriesCharacters.Series.AiredFrom.Value.Year;
                    }

                    viewModel.Cast.Add(seriesViewModel);
                }
            }

            viewModel.Cast = viewModel
                             .Cast
                             .OrderByDescending(x => x.Year)
                             .ToList();

            var crew = await _context.Crews
                       .Where(x => x.PersonId == id)
                       .Include(x => x.Series)
                       .ToListAsync();

            var departments = crew.Select(x => x.Department).Distinct();

            foreach (var department in departments)
            {
                var crewInDepartment = crew.Where(x => x.Department == department).ToList();

                var departmentViewModel = new PersonDetailDepartmentCrewViewModel
                {
                    DepartmentName = department
                };


                var crews = new List <PersonDetailCrewViewModel>();

                foreach (var crewMember in crewInDepartment)
                {
                    var seriesViewModel = new PersonDetailCrewViewModel
                    {
                        SeriesName   = crewMember.Series.Name,
                        SeriesId     = crewMember.Series.Id,
                        Job          = crewMember.Job,
                        SeriesRating = crewMember.Series.UserRating
                    };

                    if (crewMember.Series.AiredFrom != null)
                    {
                        seriesViewModel.Year = crewMember.Series.AiredFrom.Value.Year;
                    }

                    crews.Add(seriesViewModel);
                }

                crews = crews.OrderByDescending(x => x.Year).ToList();

                departmentViewModel.Crew = crews;

                viewModel.Departments.Add(departmentViewModel);
            }

            return(View(viewModel));
        }
Exemple #19
0
 public PersonDetailPage(PersonDetailViewModel personDetailViewModel)
 {
     InitializeComponent();
     BindingContext = personDetailViewModel;
 }