Example #1
0
        private void BtnSelectPerson_Click(object sender, RoutedEventArgs e)
        {
            var winPersonSearch = new WinPersonSearch();

            winPersonSearch.ShowDialog();
            if (winPersonSearch.PersonId == 0)
            {
                return;
            }

            if (PersonId.Contains(winPersonSearch.PersonId))
            {
                Utility.Message("خطا", "این شخص یک‌بار انتخاب شده است", "Stop.png");
                return;
            }
            PersonId.Add(winPersonSearch.PersonId);
            PersonName.Add(winPersonSearch.PersonName);
            PersonFamily.Add(winPersonSearch.PersonFamily);
            PersonFather.Add(winPersonSearch.PersonFather);
            PersonCode.Add(winPersonSearch.PersonCode);
            _createPersons = new List <CreatePerson>();
            for (var i = 0; i < PersonId.Count; i++)
            {
                _createPersons.Add(new CreatePerson(PersonId[i], PersonName[i], PersonFamily[i], PersonFather[i],
                                                    PersonCode[i]));
            }
            DgdPerson.ItemsSource = _createPersons;
        }