private async void registerButton_ClickAsync(object sender, EventArgs e)
        {
            // Check each field
            // Check passwords
            // Check database for Network ID
            // Check name is not already associated with a NetworkID


            // All of the stuff below should be done in the handlers else where.

            // Check Nothing is null

            // Check that the passwords match

            // Check Network ID is valid 8/9 digit ID number

            ApplicationEngine.UserTypes.Librarian daa = new ApplicationEngine.UserTypes.Librarian
            {
                FirstName = this.textBox1.Text,
                LastName  = this.textBox2.Text,
                ID        = Convert.ToUInt32(this.textBox3.Text),
                Password  = this.textBox4.Text
            };
            daa.Level = Convert.ToInt32(this.comboBox1.Text.ToString());


            SetResponse response = await client.SetTaskAsync(daa.ID.ToString(), daa);

            ApplicationEngine.UserTypes.Librarian results = response.ResultAs <ApplicationEngine.UserTypes.Librarian>();
        }
示例#2
0
        private async void loginButton_ClickAsync(object sender, EventArgs e)
        {
            string           search   = this.userNameInput.Text.ToString();
            FirebaseResponse response = await client.GetTaskAsync(search);

            object x = response.GetType();

            if (response.GetType() is ApplicationEngine.UserTypes.Librarian)
            {
                MessageBox.Show("woot");
            }
            ApplicationEngine.UserTypes.Librarian lib = response.ResultAs <ApplicationEngine.UserTypes.Librarian>();



            if (((ApplicationEngine.UserTypes.User)lib).Password != this.passwordInput.Text.ToString())
            {
                MessageBox.Show("incorrect password");
            }
            else
            {
                //if admin
                if (lib.Level > 0)
                {
                    Admin.AdminUI.AdminMainScreenUI admin = new Admin.AdminUI.AdminMainScreenUI();
                    admin.ShowDialog();

                    MessageBox.Show("Admin");
                }
                else if (lib.Level == 0)
                {
                    Librarian.LibrarianMain library = new Librarian.LibrarianMain();
                    library.ShowDialog();
                }
                else
                {
                    MessageBox.Show("else");
                }
            }



            if (shouldMoveOnPass && shouldMoveOnUser)
            {
                // We need to check database then the boolean shouldMoveOnUser should be switched to true if the credentials are found in db.

                // If db fails then we need to allow the user to reenter the information.
            }


            // Check that the network id box contains a vlaue
            // Password textbox is contains value

            // Query the database to see if the id exits,
            // If it does exist, check the corresponding password in the database is correct.

            // If true, proceed to the next screen
            // else, display appropriate message in teh response box.
        }
        public async void AddAsync(string key, ApplicationEngine.UserTypes.Librarian adder)
        {
            SetResponse response = await client.SetTaskAsync(key, adder);

            ApplicationEngine.UserTypes.Librarian results = response.ResultAs <ApplicationEngine.UserTypes.Librarian>();
        }