Ejemplo n.º 1
0
        public ActionResult List()
        {
            PersonListModel model = new PersonListModel();

            model.persons = _personsService.GetPersons();
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult PersonList()
        {
            DAL.DataAccess.CallingDAL.CommonDA CDA = new DAL.DataAccess.CallingDAL.CommonDA();
            DataTable DTPersons = new DataTable();
            var       plist     = new List <PersonListModel>();

            if (GlobalInfo.RoleID == 9)
            {
                DTPersons = CDA.GetPersonsList(0, GlobalInfo.OID);
                for (int i = 0; i < DTPersons.Rows.Count; i++)
                {
                    var p = new PersonListModel();
                    p.FirstName    = DTPersons.Rows[i]["FirstName"].ToString();
                    p.MiddleName   = DTPersons.Rows[i]["MiddleName"].ToString();
                    p.LastName     = DTPersons.Rows[i]["LastName"].ToString();
                    p.DateofBirth  = DTPersons.Rows[i]["DOB"].ToString();
                    p.PersonID     = Convert.ToInt32(DTPersons.Rows[i]["PersonID"]);
                    p.Telephone    = DTPersons.Rows[i]["PhonePersonal"].ToString();
                    p.Mobile       = DTPersons.Rows[i]["MobilePersonal"].ToString();
                    p.EmailAddress = DTPersons.Rows[i]["EmailPersonal"].ToString();
                    p.IsMember     = Convert.ToBoolean(DTPersons.Rows[i]["IsMember"]);
                    plist.Add(p);
                }
            }

            ViewBag.PersonList = plist;
            return(View());
        }
Ejemplo n.º 3
0
        public string Get()
        {
            DAL.DataAccess.CallingDAL.CommonDA CDA = new DAL.DataAccess.CallingDAL.CommonDA();
            DataTable DTPersons = new DataTable();
            string    data      = "";

            DTPersons = CDA.GetPersonsList(0, GlobalInfo.OID);
            for (int i = 0; i < DTPersons.Rows.Count; i++)
            {
                var p = new PersonListModel();
                p.FirstName    = DTPersons.Rows[i]["FirstName"].ToString();
                p.MiddleName   = DTPersons.Rows[i]["MiddleName"].ToString();
                p.LastName     = DTPersons.Rows[i]["LastName"].ToString();
                p.DateofBirth  = DTPersons.Rows[i]["DOB"].ToString();
                p.PersonID     = Convert.ToInt32(DTPersons.Rows[i]["PersonID"]);
                p.Telephone    = DTPersons.Rows[i]["PhonePersonal"].ToString();
                p.Mobile       = DTPersons.Rows[i]["MobilePersonal"].ToString();
                p.EmailAddress = DTPersons.Rows[i]["EmailPersonal"].ToString();
                p.IsMember     = Convert.ToBoolean(DTPersons.Rows[i]["IsMember"]);


                data += p.FirstName + "," + p.LastName + "," + p.PersonID + "," + p.Telephone;
            }
            return(data);
        }
Ejemplo n.º 4
0
 public PersonEntity MapPersonListModelToPersonEntity(PersonListModel model)
 {
     return(new PersonEntity()
     {
         Id = model.Id,
         Firstname = model.Firstname,
         Surname = model.Surname
     });
 }
Ejemplo n.º 5
0
        private void SelectedPersonReceived(PersonListModel selectedPerson)
        {
            var person = People.FirstOrDefault(t => t.Id == selectedPerson.Id);

            PersonSelected(person);
            var value = (int)TabEnums.PeopleTab;

            Messenger.Default.Send(value);
        }
Ejemplo n.º 6
0
        void AddPersonInList()
        {
            var person = new PersonListModel();

            person.Firstname = Firstname;
            person.Surname   = Surname;
            personRepository.Insert(person);

            OnLoad();
            messenger.Send(new ThingsOrPeronsUpdatedMessage());
        }
Ejemplo n.º 7
0
        public IActionResult Index(int id)
        {
            Experience experience = db.Experiences.FirstOrDefault(e => e.Id == id);
            Location   location   = db.Locations.FirstOrDefault(l => l.Id == experience.LocationId);

            ICollection <Person> people = db.People.Where(e => e.ExperienceId == id).ToList();

            PersonListModel model = new PersonListModel(experience, location, people);

            return(View(model));
        }
Ejemplo n.º 8
0
        private void UpdatePeopleListViewWithNewItem(PersonDetailModel personDetailModel)
        {
            var movieListModel = new PersonListModel()
            {
                Id      = personDetailModel.Id,
                Name    = personDetailModel.Name,
                Surname = personDetailModel.Surname
            };

            People.Add(movieListModel);
        }
Ejemplo n.º 9
0
        public PersonListModel Insert(PersonListModel person)
        {
            using (var galleryDbContext = new GalleryDbContext())
            {
                var entity = mapper.MapPersonListModelToPersonEntity(person);
                entity.Id = Guid.NewGuid();

                galleryDbContext.Persons.Add(entity);
                galleryDbContext.SaveChanges();

                return(mapper.MapPersonEntityToPersonListModel(entity));
            }
        }
Ejemplo n.º 10
0
 void DeletePersonInList()
 {
     if (detail != null)
     {
         personRepository.Remove(detail.Id);
         messenger.Send(new DeletePersonInListMessage(detail.Id));
         detail = null;
         messenger.Send(new ThingsOrPeronsUpdatedMessage());
     }
     else
     {
         Console.WriteLine("No person is selected.");
     }
 }
Ejemplo n.º 11
0
        public void PersonInsert()
        {
            var person = new PersonListModel()
            {
                Firstname = "Market",
                Surname   = "Moravcova"
            };
            var inserted = personRepositorySUT.Insert(person);

            Assert.NotNull(inserted);
            using (var context = new GalleryDbContext())
            {
                Assert.Contains(context.Persons, x => x.Id == inserted.Id);
            }
        }
Ejemplo n.º 12
0
        public IActionResult GetPersons()
        {
            IEnumerable <PersonListModel> persons = _dataService.GetPersons().Select(x =>
            {
                var model = new PersonListModel {
                    Name = x.Name
                };
                model.Url = Url.Link(nameof(GetPerson), new { Id = x.Id });

                return(model);
            }
                                                                                     );

            return(Ok(persons));
        }
        public PersonListModel PreparePersonListModel(int pageNumber, string searchString)
        {
            var listModel = new PersonListModel();
            var persons   = _mapper.Map <IList <PersonModel> >(_unitOfWork.PersonRepository.FindAll(
                                                                   x =>
                                                                   (
                                                                       x.FirstName.Contains(searchString)) || (string.IsNullOrWhiteSpace(searchString) ||
                                                                                                               x.LastName.Contains(searchString)) || (string.IsNullOrWhiteSpace(searchString) ||
                                                                                                                                                      x.Tin.Contains(searchString)) || (string.IsNullOrWhiteSpace(searchString)
                                                                                                                                                                                        )
                                                                   ));

            listModel.Persons = PaginatedList <PersonModel> .CreateAsync(persons, pageNumber, 5).Result; //TODO Move PageSize To Config

            return(listModel);
        }
 public static void PersonCreated(
     [ActivityTrigger] PersonCreated @event,
     [CosmosDB("cqrs", "lists",
               ConnectionStringSetting = "CosmosDbConnectionString",
               PartitionKey = "partitionKey",
               CollectionThroughput = 400,
               CreateIfNotExists = true)] out dynamic model,
     ILogger log)
 {
     model = new PersonListModel
     {
         Id           = @event.AggregateId,
         FullName     = $"{@event.Surname}, {@event.GivenName}",
         Version      = @event.Version,
         PartitionKey = PartitionKeyValue
     };
 }
Ejemplo n.º 15
0
        public ActionResult Index(PersonFilter filter, FetchOptoins fetchOptoins, int page = 0)
        {
            int pageSize = 5;

            if (page < 0)
            {
                page = 0;
            }

            fetchOptoins.First = page * pageSize;

            fetchOptoins.Count = pageSize;

            var model = new PersonListModel
            {
                Items       = personRepository.Find(filter, fetchOptoins),
                CurrentPage = page,
            };

            return(View(model));
        }
Ejemplo n.º 16
0
        public void PersonRemove()
        {
            var person = new PersonListModel()
            {
                Firstname = "Michaela",
                Surname   = "Nova"
            };
            var inserted = personRepositorySUT.Insert(person);

            Assert.NotNull(inserted);
            using (var context = new GalleryDbContext())
            {
                Assert.Contains(context.Persons, x => x.Id == inserted.Id);
            }

            personRepositorySUT.Remove(inserted.Id);

            using (var context = new GalleryDbContext())
            {
                Assert.DoesNotContain(context.Persons, x => x.Id == inserted.Id);
            }
        }
Ejemplo n.º 17
0
        private void PersonSelected(PersonListModel personListModel)
        {
            var personDetailViewModel = _personRepository.GetById(personListModel.Id);

            Messenger.Default.Send(WrapperMappers.PersonDetailToPersonSelectedWrapper(personDetailViewModel));
        }
Ejemplo n.º 18
0
 private void DeleteActorSelected(PersonListModel actor) => DeleteSelectActor(actor.Id);
Ejemplo n.º 19
0
 private void ShowPersonDetail(PersonListModel selectedPerson)
 {
     Messenger.Default.Send(selectedPerson);
 }
Ejemplo n.º 20
0
 private void AddDirectorSelected(PersonListModel director) => AddSelectDirector(director.Id);
Ejemplo n.º 21
0
 private void PersonSelected(PersonListModel person) =>
 _mediator.Send(new SelectedMessage <PersonWrapper> {
     Id = person.Id
 });
Ejemplo n.º 22
0
 private void DeleteDirectorSelected(PersonListModel director) => DeleteSelectDirector(director.Id);
Ejemplo n.º 23
0
        public async Task GetSignedUpActivityViewTestAsync()
        {
            // arrange
            List <PersonModel>  participantList;
            PersonModel         person1;
            PersonModel         person2;
            List <CommentModel> commentList;
            ActivityModel       activity;

            ActivitySignedUpViewModel retrieved;

            using (var contextScope = ContextFactory.Create())
            {
                activity = await GetTestActivityAsync();

                person1 = await GetTestPersonAsync(
                    first : "First1",
                    last : "Last1",
                    email : "*****@*****.**",
                    activityId : activity.ActivityId
                    );

                person2 = await GetTestPersonAsync(
                    first : "First2",
                    last : "Last2",
                    email : "*****@*****.**",
                    activityId : activity.ActivityId
                    );

                participantList = new List <PersonModel>()
                {
                    person1,
                    person2
                };

                commentList = new List <CommentModel>()
                {
                    await GetTestCommentAsync(
                        personId : person1.PersonId,
                        activityId : activity.ActivityId,
                        content : "I might be a bit late...I hope not, but it's a long drive and a long day at work."
                        ),
                    await GetTestCommentAsync(
                        personId : person2.PersonId,
                        activityId : activity.ActivityId,
                        content : "I can't wait to try kayaking again, it's been so long."
                        )
                };

                // act
                retrieved = await _repository.GetSignedUpActivityViewAsync(activity.ActivityId);
            }

            // assert
            Assert.IsTrue(participantList.Count == retrieved.ParticipantList.Count, "The participant list counts are not equal");
            Assert.IsTrue(commentList.Count == retrieved.CommentList.Count, "The comment list counts are not equal");
            foreach (var person in participantList)
            {
                var listPerson = new PersonListModel()
                {
                    PersonName = person.PersonFirstName + " " + person.PersonLastName
                };
                Assert.IsTrue(retrieved.ParticipantList.Exists(x => x.PersonName == listPerson.PersonName), "The person's name was not found in the list");
            }

            foreach (var comment in commentList)
            {
                var person = participantList.First <PersonModel>(x => x.PersonId == comment.CommentPersonId);

                var listComment = new CommentListModel()
                {
                    CommentContent = comment.CommentContent,
                    CommentDetail  = person.PersonFirstName + " " + person.PersonLastName + " on " + comment.CommentDateTime.ToString("yyyy-mm-dd") + " at " + comment.CommentDateTime.ToString("HH:mm")
                };
                Assert.IsTrue(retrieved.CommentList.Exists(x => x.CommentContent == listComment.CommentContent && x.CommentDetail == listComment.CommentDetail), "The comment was not found in the list");
            }
        }
Ejemplo n.º 24
0
 private void AddActorSelected(PersonListModel actor) => AddSelectActor(actor.Id);