Пример #1
0
        private void ButtonSubmit_Click(object sender, RoutedEventArgs e)
        {
            ClientCallback         callback = new ClientCallback();
            FourInRowServiceClient client   = new FourInRowServiceClient(new InstanceContext(callback));

            if (client.AddCustomer(tbFirstName.Text, tbLastName.Text, tbCity.Text, tbUsername.Text, tbPassword.Password))
            {
                MessageBox.Show("You have been added to the database,Try logging in.");
                this.Close();
            }
            else
            {
                MessageBox.Show("UserName already exist, please enter another username.");
            }
        }
Пример #2
0
        private void ButtonConnect_Click(object sender, RoutedEventArgs e)
        {
            ClientCallback         callback = new ClientCallback();
            FourInRowServiceClient client   = new FourInRowServiceClient(new InstanceContext(callback));

            if (client.LogIn(tbUsername.Text, tbPassword.Password))
            {
                Online online = new Online();
                online.usrLbl.Content = "ID:" + tbUsername.Text.ToUpper();
                online.Username       = tbUsername.Text.ToString();
                online.Client         = client;
                online.Callback       = callback;
                this.Close();
                online.Show();
            }
            else
            {
                MessageBox.Show("Failed to connect. please check the username and password.");
            }
        }