private void Page_Loaded(object sender, RoutedEventArgs e) { var orgs = DataManagement.RetrieveOrganizationChart(); OrgCom.Items.Clear(); if (orgs.Count > 0) { foreach (var item in orgs) { OrgCom.Items.Add(item.Title); } } var positions = DataManagement.RetrievePositions(); foreach (var item in positions) { var temp = new ComboBoxItem(); temp.Content = item.PositionTitle; temp.Tag = item.PositionId; PositionTxt.Items.Add(temp); } FNameTxt.Text = ""; LNameTxt.Text = ""; PositionTxt.Text = ""; OrgCom.SelectedIndex = -1; PositionTxt.SelectedIndex = -1; FNameTxt.Focus(); Grid.ItemsSource = null; }
private void RefreshBtn_Click(object sender, RoutedEventArgs e) { FNameTxt.Text = ""; LNameTxt.Text = ""; PositionTxt.Text = ""; PositionTxt.SelectedIndex = -1; OrgCom.SelectedIndex = -1; FNameTxt.Focus(); }
private async void Register() { if (string.IsNullOrEmpty(this.EmailTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an email", "Accept"); return; } if (string.IsNullOrEmpty(this.PasswordTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter a Password", "Accept"); return; } if (string.IsNullOrEmpty(this.UsernameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Username", "Accept"); return; } if (AgeTxt.ToString() == null) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Age", "Accept"); return; } if (string.IsNullOrEmpty(this.LNameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Last Name", "Accept"); return; } if (string.IsNullOrEmpty(this.FNameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an First Name", "Accept"); return; } var user = new User { Email = EmailTxt.ToLower(), Password = PasswordTxt.ToLower(), FirstName = FNameTxt.ToLower(), LastName = LNameTxt.ToLower(), Age = AgeTxt.ToString(), Creation_Date = DateTime.UtcNow.Date }; await App.Database.SaveUserAsync(user);//Anade al nuevo usuario creado en el registro }