Exemple #1
0
        protected async Task FillManager(SapPersonExcelRow contract, ExternalAccount externalAccount)
        {
            if (string.IsNullOrEmpty(contract.ManagerId))
            {
                _searchVm.Subordinate = contract;
                if (!string.IsNullOrEmpty(contract.AmRestManagerName))
                {
                    _searchVm.ManagerName = contract.AmRestManagerName;
                }

                var view = new SearchPeople()
                {
                    DataContext = _searchVm
                };
                var result = (bool)await DialogHost.Show(view, "ControlDialog");

                if (!result)
                {
                    throw new ArgumentNullException(nameof(contract.ManagerId), string.Format(Resources.PeopleUploadManagerNotSetMessage, contract.Name, contract.Surname));
                }
                externalAccount.ManagerId = _searchVm.SelectedUser.User.Id;
            }
            else
            {
                var manager = await _client.FindUserByIdentityNumber(contract.ManagerId);

                externalAccount.ManagerId = manager == null ? throw new ArgumentException(string.Format(Resources.PeopleUploadManagerNotFoundMessage, contract.Name, contract.Surname)) : manager.Id;
            }
        }
        public string[] peopleDisplay(string searchkey, int flag)
        {
            SearchPeople sp   = new SearchPeople(name, uname);
            int          rows = 0;

            rows = searchResult(searchkey);

            if (rows != 0)
            {
                if (flag == 1)
                {
                    return(name = sp.showingData(searchkey, flag));
                }

                else
                {
                    return(uname = sp.showingData(searchkey, flag));
                }
            }

            else
            {
                MessageBox.Show("No Person Found!!!");
                return(null);
            }
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SearchPeople  repo          = new SearchPeople();
            List <Person> searchresults = repo.filterPeople(txtSearchField.Text, "", "", persontype.ALL);

            dataGrid.ItemsSource = searchresults;
        }
Exemple #4
0
 public ProfileViewModel(SearchViewModel SelectedItem, bool updatefromsource)
 {
     if (SelectedItem != null)
     {
         SearchPeople repo = new SearchPeople();
         sp                      = repo.filterStudentPersonById(SelectedItem.PersonID, updatefromsource);
         this.PersonId           = sp.PersonID;
         this.Surname            = sp.Surname;
         this.Firstname          = sp.Firstname;
         this.Middlename         = sp.Middlename;
         this.Deptment           = sp.Department.Code;
         this.College            = sp.Department.CollegeCode;
         this.Email              = sp.Email;
         this.SponsorName        = sp.SponsorName;
         this.SponsorPhone       = sp.SponsorPhone;
         this.SponsorAddress     = sp.SponsorAddress;
         this.Level              = sp.Level;
         this.Programme          = sp.Programme;
         this.HealthId           = sp.HCN;
         this.BloodGrp           = sp.BG;
         this.Phone              = sp.Phone;
         this.Address            = sp.Address;
         this.Gender             = sp.Sex;
         this.Next_of_KinName    = sp.NextOfKin.Surname + " " + sp.NextOfKin.Firstname;
         this.Next_of_KinPhone   = sp.NextOfKin.Phone;
         this.Next_of_KinAddress = sp.NextOfKin.Address;
         this.Photo              = sp.Photo;
         this.categoryid         = sp.CategoryId;
         this.Fmds               = sp.Fmds;
         // this.currentsnapshotid = null;
     }
 }
        public int searchResult(string searchkey)
        {
            SearchPeople sp   = new SearchPeople(name, uname);
            int          rows = 0;

            rows = sp.nameCheck(searchkey);
            return(rows);
        }
        //public object MessageBoxButtons { get; private set; }

        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            //string idtty=null;

            SearchPeople repo = new SearchPeople();
            //PersonRepository repo1 = new PersonRepository();
            //bool found = false;
            string message = null;
            string caption = "Important Message!";;

            if (String.IsNullOrEmpty(txtIdNumber.Text.Trim()) && (String.IsNullOrEmpty(txtSurname.Text.Trim())) && (String.IsNullOrEmpty(txtFirstName.Text.Trim())))
            {
                message = "Search Fields Cannot be Empty. Kindly Provide ANY Valid Search Value!";
                MessageBox.Show(message, caption);
            }
            else
            {
                // check with at least one searchVariables

                /* if ((txtIdNumber.Text.Length > 0) || !String.IsNullOrEmpty(txtIdNumber.Text.Trim()))
                 * {
                 *
                 *   idtty = txtIdNumber.Text;
                 * }
                 * else if ((txtSurname.Text.Length > 0) || !String.IsNullOrEmpty(txtSurname.Text.Trim()))
                 * {
                 *
                 *   idtty = txtSurname.Text;
                 * }
                 * else {
                 *   idtty = txtFirstName.Text;
                 * }
                 */
                List <Person> searchresults = repo.filterPeople(txtIdNumber.Text.ToString(), txtSurname.Text.ToString(), txtFirstName.Text.ToString());
                if (searchresults.Count() == 0 && chkSearchSource.IsChecked == true)
                {
                    searchresults.Add(repo.filterStudentPersonById(txtIdNumber.Text, chkSearchSource.IsChecked == true));
                    repo = new SearchPeople();
                }
                //List<IPerson> searchresults = repo.getPersons(idtty);

                //IEnumerable<StaffPerson> searchresult1 = (IEnumerable <StaffPerson>) repo1.getStaffPersonByID(txtIdNumber.Text);
                //IEnumerable<StaffPerson> searchresultList = (IEnumerable<StaffPerson>)searchresult1;

                IEnumerable <SearchViewModel> searchviewresults = from a in searchresults select new SearchViewModel {
                    PersonID = a.PersonID, Name = a.Surname + " " + a.Firstname, Phone = a.Phone, Sex = a.Sex.ToString(), NextOfKinName = a.NextOfKin == null?"":a.NextOfKin.Surname + "" + a.NextOfKin.Firstname
                };
                dataGrid.ItemsSource = searchviewresults;

                IEnumerable <ProfileViewModel> profileresults = from pvi in searchresults select new ProfileViewModel {
                    PersonId = pvi.PersonID, Surname = pvi.Surname, Middlename = pvi.Middlename, Gender = pvi.Sex, Phone = pvi.Phone, Address = pvi.Address, HealthId = pvi.HCN, BloodGrp = pvi.BG, Deptment = "", Next_of_KinName = pvi.NextOfKin == null ? "" : pvi.NextOfKin.Surname + "" + pvi.NextOfKin.Firstname, Next_of_KinPhone = pvi.NextOfKin.Phone, Next_of_KinAddress = pvi.NextOfKin.Address
                };
                //IEnumerable<ProfileViewModel> profileresults = from pvi in searchresultList select new ProfileViewModel { PersonId = pvi.PersonID, Surname = pvi.Surname, Middlename = pvi.Middlename, Gender = pvi.Sex, Phone = pvi.Phone, Address = pvi.Address, HealthId = pvi.HCN, BloodGrp = pvi.BG, Deptment = "", Next_of_KinName = pvi.NextOfKin == null ? "" : pvi.NextOfKin.Surname + "" + pvi.NextOfKin.Firstname, Next_of_KinPhone = pvi.NextOfKin.Phone, Next_of_KinAddress = pvi.NextOfKin.Address };
            }
        }
        public ActionResult Create([Bind(Include = "ID,FirstName,LastName,Occupation,City,State,Country,Age,Gender,Interest")] SearchPeople searchPeople)
        {
            if (ModelState.IsValid)
            {
                db.SearchPeoples.Add(searchPeople);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(searchPeople));
        }