コード例 #1
0
        private void btnLoginAsUser_Click(object sender, RoutedEventArgs e)
        {
            var userInput = new Dictionary <string, string>
            {
                { txtUsername.Text, txtPassword.Password }
            };

            var view = new AppCalls().ValidateInput(ref userInput);

            switch (view)
            {
            case 0:
                // Switch to error screen, this could be showing error message that user and/or password does not exist.
                MessageBox.Show("User and/or password was not in the database!");
                break;

            case 1:
                // Switch to Main Menu.
                Hide();
                new MainMenu().Show();
                break;

            default:
                // Do something default.
                break;
            }
        }
コード例 #2
0
        private void btnReadPerson_Click(object sender, EventArgs e)
        {
            var readAllPersons = new AppCalls().ReadPerson();

            listBoxDatabaseList.MultiColumn         = true;
            listBoxDatabaseList.HorizontalScrollbar = true;
            listBoxDatabaseList.Items.Clear();

            listBoxDatabaseList.BeginUpdate();
            foreach (var item in readAllPersons)
            {
                listBoxDatabaseList.Items.Add(item.PersonID);
                listBoxDatabaseList.Items.Add(item.FirstName);
                listBoxDatabaseList.Items.Add(item.MiddleName);
                listBoxDatabaseList.Items.Add(item.LastName);
                listBoxDatabaseList.Items.Add(item.ContactType);
            }
            listBoxDatabaseList.EndUpdate();

            //MessageBox.Show("Reading all Persons in Database");
        }