/// <summary>
        /// Handles the Click event of the SaveButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UserServiceSoapClient client = new UserServiceSoapClient();

                string token = client.GetTokenByUsernameAndPassword(usernameTextBox.Text, passwordTextBox.Password);

                if (!string.IsNullOrEmpty(token))
                {
                    Client.Default.username = usernameTextBox.Text;
                    Client.Default.pasword  = passwordTextBox.Password;

                    Client.Default.token = token;
                    Client.Default.Save();
                    Close();
                }

                messageLabel.Content = "Your username or password did not match our records.";
            }
            catch (Exception ex)
            {
                //TODO:Logging add logging paradigmn

                messageLabel.Content = ex.Message;
            }
        }
        /// <summary>
        /// Handles the Click event of the SaveButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UserServiceSoapClient client = new UserServiceSoapClient();

                string token = client.GetTokenByUsernameAndPassword(usernameTextBox.Text, passwordTextBox.Password);

                if (!string.IsNullOrEmpty(token))
                {
                    Client.Default.username = usernameTextBox.Text;
                    Client.Default.pasword = passwordTextBox.Password;

                    Client.Default.token = token;
                    Client.Default.Save();
                    Close();
                }

                messageLabel.Content = "Your username or password did not match our records.";

            }
            catch(Exception ex)
            {
                //TODO:Logging add logging paradigmn

                messageLabel.Content = ex.Message;
            }
        }
예제 #3
0
        public void SetDataTable(highScore highScore)
        {
            DataTable             dt     = new DataTable("ThanhVien");
            UserServiceSoapClient reader = new UserServiceSoapClient();
            DataTable             bxh    = reader.SetDataTable(dt);

            highScore.dataGrid.ItemsSource = bxh.DefaultView;
        }
 static void Main(string[] args)
 {
     var client = new UserServiceSoapClient();
     client.ClientCredentials.UserName.UserName = "******";
     client.ClientCredentials.UserName.Password = "******";
     var user = client.getUserByScreenName(1, "joebloggs");
     Console.WriteLine(user.greeting);
     Console.ReadLine();
 }
 public void saveScore(MainWindow mainWindow)
 {
     if (mainWindow.id == -1)
     {
         return;
     }
     else
     {
         UserServiceSoapClient reader = new UserServiceSoapClient();
         int userScore    = reader.getScore(mainWindow.id);
         int currentScore = getValueScore();
         if (currentScore > userScore)
         {
             reader.updateScore(mainWindow.id, currentScore);
         }
     }
 }
        public void HandleSignIn(signIn signIn)
        {
            UserServiceSoapClient reader = new UserServiceSoapClient();

            if (!reader.login(signIn.txtUsername.Text, signIn.txtPassword.Password.ToString()))
            {
                signIn.fullname = reader.getfullname(signIn.txtUsername.Text, signIn.txtPassword.Password.ToString());
                signIn.id       = reader.getid(signIn.txtUsername.Text, signIn.txtPassword.Password.ToString());
                MessageBox.Show("Đăng nhập thành công !");
                Window1 mainmenu = new Window1(signIn.id, signIn.fullname);
                signIn.Close();
                mainmenu.Show();
            }
            else
            {
                MessageBox.Show("Đăng nhập thất bại");
            }
        }
예제 #7
0
        public void HandleSignUp(signUp signUp)
        {
            if (checkInput(signUp))
            {
                UserServiceSoapClient reader = new UserServiceSoapClient();
                User newuser = reader.setSignUp(signUp.txtUsername.Text, signUp.txtPassword.Password.ToString(), signUp.txtFullname.Text, 0);

                if (reader.checkTV(signUp.txtUsername.Text))
                {
                    if (reader.insertTV(newuser))
                    {
                        MessageBox.Show("Thêm thành công !");
                    }
                    else
                    {
                        MessageBox.Show("Thất bại");
                    }
                }
                else
                {
                    MessageBox.Show("Username bị trùng !");
                }
            }
        }