Exemplo n.º 1
0
        private async void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            string idNo = txtIdNumber.Text;
            string name, surname, idNumber, contacts, address, email, password, province;

            name     = txtName.Text;
            surname  = txtSurname.Text;
            idNumber = txtIdNumber.Text;
            contacts = txtContacts.Text;
            address  = txtAddress.Text;
            province = txtProvince.Text;
            email    = txtEmail.Text;
            password = txtPassword.Text;



            if (name == "" && surname == "" && idNumber == "" && contacts == "" && address == "" && province == "" && email == "" && password == "")
            {
                messageBox("make sure all field are filled with correct values");
            }
            else
            {
                Enroll newUser = new Enroll()
                {
                    name     = txtName.Text,
                    surname  = txtSurname.Text,
                    idNumber = txtIdNumber.Text,
                    contacts = txtContacts.Text,
                    address  = txtAddress.Text,
                    province = txtProvince.Text,
                    email    = txtEmail.Text,
                    password = txtPassword.Text
                };
                SQLiteAsyncConnection conn = new SQLiteAsyncConnection("Registers.db");
                await conn.InsertAsync(newUser);

                if (model.getUser(idNo) == null)
                {
                    messageBox("You are not registered");
                }
                else
                {
                    messageBox("You are successfully registered");
                }
            }
        }
Exemplo n.º 2
0
        private void btnPassword_Click(object sender, RoutedEventArgs e)
        {
            string id = txtIDnumber.Text;
            string password, username;
            var    obj = new InstitutionViewModel();

            var user = obj.getUser(id);

            if (user != null)
            {
                username = user.email;
                password = user.password;

                messageBox("password is " + password + "username is " + username);
            }
            else
            {
                messageBox("The user does not exist please make sure you enter a valid ID");
            }
        }