private void GetDropDownData() { var siteName = assetSite_.Items[assetSite_.SelectedIndex]; _Site = SitesClass.DbToSite(Database.Sites.GetTableData(_connection), _connection).First(cm => cm.SiteName == siteName).SiteIdInternal; var LocationName = assetLocation_.Items[assetLocation_.SelectedIndex]; var __ = LocationClass.DbToLocation(Database.Locations.GetTableDataFromSites(_connection, _Site), _connection); _Location = __.First(cm => (cm.LocationName == LocationName && cm.SiteIdInternal == _Site)).LocationIdInternal; if (assetSubLocation_.SelectedIndex > 0) { _Sublocation = assetSubLocation_.Items[assetSubLocation_.SelectedIndex]; } if (_Assign) { if (person_.SelectedIndex >= 0) { var personName = person_.Items[person_.SelectedIndex]; _People = PeopleClass.DbToPeople(Database.People.GetTableData(_connection), _connection).First(cm => cm.PeopleName == personName).PeopleIDInternal; } } }
private void LoadPerson() { var PersonList = PeopleClass.DbToPeople(Database.People.GetTableData(_connection), _connection); foreach (PeopleClass person in PersonList) { PropertyPassPerson.Items.Add(person.PeopleName); } }
private async void AddPropertyPass(object sender, EventArgs e) { string siteName, personName; SitesClass siteInfo = new SitesClass(); PeopleClass personInfo = new PeopleClass(); var field = CheckValues(); if (field == "") { //gets site if (PropertyPassSite.SelectedIndex >= 0) { siteName = PropertyPassSite.Items[PropertyPassSite.SelectedIndex]; siteInfo = SitesClass.DbToSite(Database.Sites.GetTableData(_connection), _connection).Single(cm => cm.SiteName == siteName); } //gets people if (PropertyPassPerson.SelectedIndex >= 0) { personName = PropertyPassPerson.Items[PropertyPassPerson.SelectedIndex]; personInfo = PeopleClass.DbToPeople(Database.People.GetTableData(_connection), _connection).Single(cm => cm.PeopleName == personName); } var PPdata = new PropertyPassDbTable() { AssignedToEmail = PropertyPassEmail.Text, CreationDate = DateTime.Now.ToString("s"), AssignedToPhone = PropertyPassPhone.Text, ModifiedOn = DateTime.Now.ToString("s"), Comments = PropertyPassComments.Text, DueDate = PropertyPassDueDate.Date.ToString("s"), PeopleID_Internal = personInfo.PeopleIDInternal, SiteIDInternal = siteInfo.SiteIdInternal, PropertyPassID_Internal = GUID.Generate(), Assigned_By = Application.Current.Properties["user"].ToString(), Synced = true }; Database.PropertyPassTable.Insert(_connection, PPdata); await DisplayAlert("Complete", "The property pass table has been added.", "OK"); await Navigation.PopAsync(); } else { await DisplayAlert("Error", "The " + field + " field is required", "OK"); } }
private void LoadPerson() { var PersonList = PeopleClass.DbToPeople(Database.People.GetTableData(_connection), _connection); foreach (PeopleClass person in PersonList) { person_.Items.Add(person.PeopleName); } try { person_.SelectedIndex = 0; } catch (Exception exc) { DependencyService.Get <IError>().SendRaygunError(exc, Application.Current.Properties["user"].ToString() ?? "unsynced", Application.Current.Properties["url"].ToString() ?? "unsynced", null); DisplayAlert("Error", "You need people records to use this function", "OK"); Navigation.PopAsync(); } }