コード例 #1
0
 public void NotifyPersonRemoval(Person removedPerson)
 {
     if (PeopleList.Contains(removedPerson, new PersonComparer()))
     {
         UpdateHelper.Instance.PeopleListRemovalHelper.Add(removedPerson);
     }
 }
コード例 #2
0
        /**
         * This one is different because it requires some conversion. In the XML data returned by ESD,
         * people are separated by site. That makes pagination hard, so we iterate over the sites and
         * put all their people inside a collection (AggregatedPeopleList).
         */
        public async Task <AggregatedPeopleList> GetOrganizationPeople(int orgId)
        {
            PeopleList people = await GetEntity <PeopleList>("ESD/" + orgId + "/People");

            var aggregatedPeople = new AggregatedPeopleList();

            aggregatedPeople.People = new Tuple <Person, Site> [0];
            if (people.Sites == null)
            {
                return(aggregatedPeople);
            }
            var allPeople = new List <Tuple <Person, Site> >();

            for (int i = 0; i < people.Sites.Length; i++)
            {
                if (people.Sites[i].People == null)
                {
                    continue;
                }
                for (int j = 0; j < people.Sites[i].People.Length; j++)
                {
                    allPeople.Add(new Tuple <Person, Site>(people.Sites[i].People[j], people.Sites[i]));
                }
            }
            aggregatedPeople.People = allPeople.ToArray();
            return(aggregatedPeople);
        }
コード例 #3
0
 public void NotifyPersonModification(Person modifiedPerson)
 {
     if (PeopleList.Contains(modifiedPerson, new PersonComparer()))
     {
         UpdateHelper.Instance.PeopleListModificationHelper.Add(modifiedPerson);
     }
 }
コード例 #4
0
 public void NotifyPersonDuplicate(Person addedPerson)
 {
     if (!PeopleList.Contains(addedPerson, new PersonComparer()))
     {
         UpdateHelper.Instance.PeopleListAdditionHelper.Add(addedPerson);
     }
 }
コード例 #5
0
ファイル: Class5Demo.cs プロジェクト: karinaZialcita/CSTP2104
        static void Main(string[] args)
        {
            //Put some people int he array
            Person[] peopleArr = new Person[3]
            {
                new Employee("Mathew", 15, EmployeeType.Administration, "543542354"),
                new Employee("Mark", 3, EmployeeType.Managment, "34234222"),
                new Employee("John", 5, EmployeeType.Operational, "543542354")
            };

            PeopleList employeeList = new PeopleList(peopleArr);

            foreach (Person p in peopleArr)
            {
                Console.WriteLine(p.Name + " " + p.GetType());
            }

            Console.WriteLine($"Mathew plus Mark equals {(Employee)peopleArr[0] + (Employee)peopleArr[1]}");

            if ((Employee)peopleArr[0] > (Employee)peopleArr[1])
            {
                Console.WriteLine("Mathew is the greater employee.");
            }

            if ((Employee)peopleArr[0] == (Employee)peopleArr[2])
            {
                Console.WriteLine("Houston, we have a problem.");
            }
        }
コード例 #6
0
        public void FindPerson_SubmitNonExistingId_ReturnsNullValue()
        {
            var peopleList = new PeopleList();

            var result = peopleList.FindPerson(3);

            Assert.Null(result);
        }
コード例 #7
0
        public void AllPeople_CallingAllPeople_Contains2People()
        {
            var peopleList = new PeopleList();

            var result = peopleList.AllPeople();

            Assert.Equal(2, result.Count());
        }
コード例 #8
0
        public void FindPerson_SubmitValidId_ReturnsCorrectPerson()
        {
            var peopleList = new PeopleList();

            var result = peopleList.FindPerson(1);

            Assert.Equal("Test Testsson", result.Name);
        }
コード例 #9
0
 // Start is called before the first frame update
 void Start()
 {
     pl         = GetComponent <PeopleList>();
     myTrans    = GetComponent <Transform>();
     sr         = GetComponent <SpriteRenderer>();
     bc2d       = GetComponent <BoxCollider2D>();
     killChance = thisPerson.killRate;
 }
コード例 #10
0
        public void DeletePerson_SubmitValidId_ReturnsTrueValue()
        {
            var peopleList = new PeopleList();

            var result = peopleList.RemovePerson(1);

            Assert.True(result);
        }
コード例 #11
0
        public void DeletePerson_SubmitNullId_ReturnsFalseValue()
        {
            var peopleList = new PeopleList();

            var result = peopleList.RemovePerson(null);

            Assert.False(result);
        }
コード例 #12
0
        public void FindPerson_SubmitInvalidId_ReturnsNullValue()
        {
            var peopleList = new PeopleList();

            var result = peopleList.FindPerson(0);

            Assert.Null(result);
        }
コード例 #13
0
 public void Edit_SendingInvalidId_WillReturnNull()
 {
     var peopleList = new PeopleList();
     var person     = new Person()
     {
         Id = 2, Name = "test testsson", City = "TestCity", PhoneNumber = "123123"
     };
 }
コード例 #14
0
 // Start is called before the first frame update
 void Start()
 {
     ts     = GameObject.Find("SetUpNextScene").GetComponent <TitleSettings>();
     bc2d   = GetComponent <BoxCollider2D>();
     sr     = GetComponent <SpriteRenderer>();
     gTrans = GetComponent <Transform>();
     SetUpSize();
     pl = GetComponent <PeopleList>();
     SetUpPopulation();
     Destroy(ts.gameObject);
 }
コード例 #15
0
        public void DeletePerson_SubmitValidId_Return1ValueInList()
        {
            var peopleList = new PeopleList();
            var pvm        = new PersonViewModel();

            var result = peopleList.RemovePerson(1);

            pvm.PersonList = peopleList.AllPeople();

            Assert.Single(pvm.PersonList);
        }
コード例 #16
0
 public MainWindowViewModel()
 {
     PeopleList.Add(new ListModel {
         Name = "小明", Age = 15
     });                                                  //添加行信息
     PeopleList.Add(new ListModel {
         Name = "小王", Age = 14
     });
     peopleList.Add(new ListModel {
         Name = "小李", Age = 13
     });
 }
コード例 #17
0
        public void Filter_SubmittingInvalidFilter_ReturnsNullValue()
        {
            var peopleList = new PeopleList();
            var pvm        = new PersonViewModel
            {
                Filter = null,
            };

            var result = peopleList.FilterList(pvm.Filter);

            Assert.Null(result);
        }
コード例 #18
0
        public void CreatePerson_SubmitId_ReturnsNullValue()
        {
            var peopleList = new PeopleList();
            var person     = new Person()
            {
                Id = 2, Name = "Micael Ståhl", City = "Vetlanda", PhoneNumber = "0725539574"
            };

            var result = peopleList.CreatePerson(person);

            Assert.Null(result);
        }
コード例 #19
0
        public void Filter_SubmittingValidFilter_ReturnsFilteredList()
        {
            var peopleList = new PeopleList();
            var pvm        = new PersonViewModel
            {
                Filter = "Testsson",
            };

            var result = peopleList.FilterList(pvm.Filter);

            Assert.Single(result);
        }
コード例 #20
0
        public void Edit_SendingNoName_WillReturnNull()
        {
            var peopleList = new PeopleList();
            var person     = new Person()
            {
                Id = 1, Name = null, City = "Viborg", PhoneNumber = "123123"
            };

            var result = peopleList.EditPerson(person);

            Assert.Null(result);
        }
コード例 #21
0
    // Use this for initialization
    void Start()
    {
        People people = new People();

        people.age  = 50;
        people.name = Marshal.StringToHGlobalAnsi("Bobo");

        int ret1 = NativeBridge.startLogService();

        Debug.LogFormat("startLogService ret1 = {0} ", ret1);

        int ret2 = NativeBridge.getSumValue(100, 200);

        Debug.LogFormat("startLogService ret2 = {0} ", ret2);

        int ret3 = NativeBridge.setPeople(people);

        Debug.LogFormat("setPeople ret3 = {0} ", ret3);

        int ret4 = NativeBridge.modifyPeople(ref people);

        Debug.LogFormat("modifyPeople ret4 = {0},  age = {1}  ,name = {2} ", ret4, people.age, Marshal.PtrToStringAnsi(people.name));

        People p1 = new People();

        p1.age  = 50;
        p1.name = Marshal.StringToHGlobalAnsi("bobo");

        People p2 = new People();

        p2.age  = 100;
        p2.name = Marshal.StringToHGlobalAnsi("bobo2");

        PeopleList peopleList = new PeopleList();

        peopleList.people1 = p1;
        peopleList.people2 = p2;

        int ret5 = NativeBridge.setPeopleList(peopleList);

        Debug.LogFormat("setPeopleList ret5 = {0} ", ret5);

        int ret6 = NativeBridge.modifyPeopleList(ref peopleList);

        Debug.LogFormat("setPeopleList ret6 = {0} ", ret6);

        NativeBridge.initCallback(On_C_Plus_Plue_Callback_1, On_C_Plus_Plue_Callback_2);

        NativeBridge.testCallback();
    }
コード例 #22
0
        //ДОбавление персонажа
        public void AddPerson(string name, string personClass, int body, int mind, int spirit, out string errorMessage)
        {
            errorMessage = "";
            //Првоерка, существует ли персонаж с таким именем
            Person exsistPerson = PeopleList.FirstOrDefault(p => p.Name == name);

            if (exsistPerson != null)
            {
                errorMessage = "Персонаж с таким именем уже существует";
                return;
            }

            //Прочие проверки
            if (string.IsNullOrEmpty(name))
            {
                errorMessage = "Имя не должно быть пустым";
                return;
            }
            if (string.IsNullOrEmpty(personClass))
            {
                errorMessage = "Класс не должен быть пустым";
                return;
            }
            if (body < 5)
            {
                errorMessage = "Параметр body не должен быть меньше 5";
                return;
            }
            if (mind < 5)
            {
                errorMessage = "Параметр mind не должен быть меньше пяти";
                return;
            }
            if (spirit < 5)
            {
                errorMessage = "Парметр spirit не должен быть меньше пять";
                return;
            }
            if (!(body + spirit + mind <= 20))
            {
                errorMessage = "Сумма параметров body, mind, spirit не может превышать 20";
                return;
            }

            //Создание персонажа, добавление в список, а также сохранение данного списка
            Person person = new Person(name, personClass, body, mind, spirit);

            PeopleList.Add(person);
            SaveLoadService.Save(PeopleList);
        }
コード例 #23
0
        public void CreatePerson_SubmitValidPerson_ReturnsCreatedPerson()
        {
            var peopleList = new PeopleList();
            var person     = new Person()
            {
                Name = "Micael Ståhl", City = "Vetlanda", PhoneNumber = "0725539574"
            };

            var result = peopleList.CreatePerson(person);

            Assert.Equal(2, result.Id);
            Assert.Equal(person.Name, result.Name);
            Assert.Equal(person.City, result.City);
            Assert.Equal(person.PhoneNumber, result.PhoneNumber);
        }
コード例 #24
0
        public void CreatePerson_SubmitValidPerson_Returns3PeopleInList()
        {
            var peopleList = new PeopleList();
            var person     = new Person()
            {
                Name = "Micael Ståhl", City = "Vetlanda", PhoneNumber = "0725539574"
            };
            var pvm = new PersonViewModel();

            var result = peopleList.CreatePerson(person);

            pvm.PersonList = peopleList.AllPeople();

            Assert.Equal(3, pvm.PersonList.Count);
        }
コード例 #25
0
        public void Edit_SendingCorrectValues_WillReturnUpdatedPerson()
        {
            var peopleList = new PeopleList();
            var person     = new Person()
            {
                Id = 1, Name = "test testing", City = "Stockholm", PhoneNumber = "123123123"
            };

            var result = peopleList.EditPerson(person);

            Assert.Equal(person.Id, result.Id);
            Assert.Equal(person.Name, result.Name);
            Assert.Equal(person.City, result.City);
            Assert.Equal(person.PhoneNumber, result.PhoneNumber);
        }
コード例 #26
0
        public void TestMethod2()

        {
            //arrange
            PeopleList s = new PeopleList(); //testing the contents of the staff list


            //act
            string actual = s.AddStaff("Ms", "Mary", "Doyle", "29/07/91", int.Parse("1323"), "*****@*****.**", "0892342454");

            //assert
            string added = "Staff Added";

            Assert.AreEqual(added, actual);
        }
コード例 #27
0
        public void TestMethod1()
        {
            //arrange
            PeopleList p = new PeopleList();  //testing the contents of the patient list



            // act
            string actual = p.AddPatient("Mr", "Joe", "Bloggs", "24/09/89", int.Parse("1213"), "*****@*****.**", "0857479345");



            //assert
            string added = "Patient Added";

            Assert.AreEqual(added, actual);
        }
コード例 #28
0
 public void UpdatePeopleList(string message)
 {
     if (PeopleList.InvokeRequired)
     {
         Invoke(new Action(() =>
         {
             UpdatePeopleList(message);
         }));
     }
     else
     {
         PeopleList.Text           = "";
         PeopleList.Text          += message + Environment.NewLine;
         PeopleList.SelectionStart = PeopleList.Text.Length;
         PeopleList.ScrollToCaret();
     }
 }
コード例 #29
0
        private static void MergeAndSavePeopleLists(Dictionary <string, ImportExportRecord> list)
        {
            foreach (var person in list)
            {
                if (!PeopleList.ContainsKey(person.Value.Upn))
                {
                    // add them
                    PeopleList[person.Value.Upn] = person.Value;
                }
                else
                {
                    // else update their photo location
                    PeopleList[person.Value.Upn].PhotoLocation = person.Value.PhotoLocation;
                }
            }

            SaveManifest(PeopleList);
        }
コード例 #30
0
        private void InitList()
        {
            var pavloNum  = new ContactNumber("Pavlo", "+380974668784");
            var romanNum  = new ContactNumber("Roman", "+3809674522896");
            var nastyaNum = new ContactNumber("Nastya", "+380978496753");
            var sergiiNum = new ContactNumber("Sergii", "+380936475951");

            var people = new List <Person>
            {
                new Person("Roman Moravskyi", 19,
                           new List <ContactNumber>
                {
                    pavloNum,
                    sergiiNum,
                    nastyaNum
                }),
                new Person("Anastasia Vasileva", 18,
                           new List <ContactNumber>
                {
                    romanNum,
                    sergiiNum
                }),
                new Person("Sergii Ivanenko", 19,
                           new List <ContactNumber>
                {
                    pavloNum,
                    romanNum
                }),
                new Person("Pavlo Pustelnyk", 19,
                           new List <ContactNumber>
                {
                    romanNum,
                    sergiiNum
                }),
                new Person("Mykola Morozov", 18,
                           new List <ContactNumber>
                {
                    romanNum,
                    nastyaNum
                }),
            };

            peopleList = new PeopleList(people);
        }
コード例 #31
0
ファイル: Readers.cs プロジェクト: sujalp/WPFALC
        protected override bool AddOnePhotoOverride(
            string DateStr,
            string JustTheName,
            string Title,
            string People,
            string AlbumT,
            string Place,
            bool NoShow,
            bool Favorite,
            string FlickrId,
            string FlickrSecret,
            string FlickrOriginalSecret,
            string FlickrFarm,
            string FlickrServer,
            string Rectangles
            )
        {
            bool fChanged = false;

            Photo p = new Photo(_context);

            p.DateStr = DateStr;
            p.JustTheName = JustTheName;
            _context.Photos.Insert(_context.Photos.Count, p);
            p.FileName = Path + JustTheName;
            p.Title = Title;
            PeopleList peoplelist = OneFolder.StringToList(People);
            p.AlbumT = AlbumT;
            p.Place = Place;
            p.NoShow = NoShow;
            p.Favorite = Favorite;
            p.FlickrId = FlickrId;
            p.FlickrSecret = FlickrSecret;
            p.FlickrOriginalSecret = FlickrOriginalSecret;
            p.FlickrFarm = FlickrFarm;
            p.FlickrServer = FlickrServer;

            RectList rects = OneFolder.StringToRectList(Rectangles);

            // First fill in the rects for each name.
            for (int i = 0; i < Math.Min(peoplelist.Count, rects.Count); i++)
            {
                peoplelist[i].Rect = rects[i];
            }

            // Next, if the ini file had data, it will override the rect data that we had in the .abm file.
            if (_context.FacesPerFile.ContainsKey(JustTheName))
            {
                PeopleList faces = new PeopleList();
                foreach (var face in _context.FacesPerFile[JustTheName])
                {
                    Contact c;
                    try
                    {
                        c = _context.Contacts[face.PId];
                    }
                    catch
                    {
                        continue;
                    }
                    if (!peoplelist.Contains(new Person(c.Alias)))
                    {
                        peoplelist.Add(new Person(c.Alias, face.Rect, face.PId));
                    }
                    else
                    {
                        foreach (var person in peoplelist)
                        {
                            if (person.Name == c.Alias && person.PId == 0)
                            {
                                person.PId = face.PId;

                                if (person.Rect != face.Rect)
                                {
                                    fChanged = true;
                                }
                                if ((person.Rect != 0) && (person.Rect != face.Rect)) MessageBox.Show("Rectangle mismatch");

                                person.Rect = face.Rect;
                                break;
                            }
                        }
                    }
                }
            }
            p.People = peoplelist;

            return fChanged;
        }