private async void classListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (classListBox.SelectedIndex >= 0) { Class clas = classListBox.SelectedItem as Class; UnitListJsonResult result = await MyMartService.GetUnitList(clas.ClassID); unitListBox.ItemsSource = result.Units; } }
public async void testAuthenticateSucess() { //Arrange string username = "******"; string password = "******"; string expectUserID = "bc9ce5ff-1731-457f-bee3-336a99165c22"; //Act AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(username, password); //Assert Assert.IsTrue(result.UserID == expectUserID); }
public async void testAuthenticateNullValue() { //Arrange string username = ""; string password = ""; bool expectAuthenticated = false; //Act AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(username, password); //Assert Assert.IsTrue(result.Authenticated == expectAuthenticated); }
public async void testAuthenticateFail() { //Arrange string username = "******"; string password = "******"; bool expectAuthenticated = false; //Act AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(username, password); //Assert Assert.IsTrue(result.Authenticated == expectAuthenticated); }
private async void loginButton_Click(object sender, RoutedEventArgs e) { AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(userNameTextBox.Text, passwordBox.Password); if (result.Authenticated) { LocalSetting.UserID = result.UserID; LoggedIn(sender, e); } else { MessageDialog messageDialog = new MessageDialog(result.ExceptionMessage, "Authentication Fail"); await messageDialog.ShowAsync(); } }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override async void OnNavigatedTo(NavigationEventArgs e) { ClassListJsonResult result = await MyMartService.GetClassList(); classListBox.ItemsSource = result.Classes; }
private async void buttonNum_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button.Content.ToString().CompareTo("<") == 0) { if (pin.Length >= 1) { pin = pin.Substring(0, pin.Length - 1); SetPasswordBox(pin); } } else if (button.Content.ToString().CompareTo("Forgot My Pin") == 0) { } else { pin += button.Content.ToString(); SetPasswordBox(pin); if (pin.Length >= 4) { if (!LocalSetting.IsRegisterDevice) { if (isConfirmPin) { isConfirmPin = false; firstpin = pin; descriptionTextBlock.Text = "Please confirm your Quick-Pin"; pin = ""; SetPasswordBox(pin); } else { if (pin == firstpin) { RegisterDeviceQuickPinJsonResult result = await MyMartService.RegisterDeviceQuickPin(pin, true); if (result.RegisterSuccess) { LocalSetting.IsRegisterDevice = true; LoggedIn(sender, e); } else { MessageDialog messageDialog = new MessageDialog(result.ExceptionMessage); await messageDialog.ShowAsync(); } } } } else { AuthenticateJsonResult result = await MyMartService.AuthenWithQuickPin(pin); if (result.Authenticated) { LocalSetting.UserID = result.UserID; LoggedIn(sender, e); } else { MessageDialog messageDialog = new MessageDialog(result.ExceptionMessage); await messageDialog.ShowAsync(); } } } } }