public Boolean checkFields()
        {
            Realtor logIn = new Realtor(txt_username.Text, txt_psswrd.Text);

            lblUsernameAstri.Visible = false;
            lblPasswordAstri.Visible = false;

            if ((logIn.Realtor_Username).Trim().Equals("") && (logIn.Realtor_Password).Trim().Equals(""))
            {
                lblUsernameAstri.Visible = true;
                lblPasswordAstri.Visible = true;
                return(false);
            }
            else if ((logIn.Realtor_Username).Trim().Equals(""))
            {
                lblUsernameAstri.Visible = true;
                return(false);
            }
            else if ((logIn.Realtor_Password).Trim().Equals(""))
            {
                lblPasswordAstri.Visible = true;
                return(false);
            }

            else
            {
                return(true);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int    id       = 0;
            string fname    = regTxtFirst.Text;
            string lname    = RegTxtLastName.Text;
            string username = RegTxtUser.Text;
            string password = RegTxtPswrd.Text;

            Realtor realtor = new Realtor(id, fname, lname, username, password);

            if (checkFields())
            {
                try
                {
                    if (realtor.insertUser(realtor))
                    {
                        MessageBox.Show("New user has been registered");
                    }
                    else
                    {
                        MessageBox.Show("New User Not Added", "Add User", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch
                {
                    MessageBox.Show("The username you have filled has already been taken", "Add User", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please Enter Username and Password", "Add User", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            LoginForm log = new LoginForm();

            log.Show();
            this.Hide();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Realtor  logIn        = new Realtor(txt_username.Text, txt_psswrd.Text);
            Database databasefunc = new Database();

            if (checkFields())
            {
                MySqlCommand command = new MySqlCommand("SELECT * FROM realtor where realtor_username='******' AND realtor_psswrd='" + logIn.Realtor_Password + "'");


                DataTable usertable = databasefunc.getData(command);

                if (usertable.Rows.Count > 0)
                {
                    MainMenuForm main = new MainMenuForm();
                    main.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Username or Password ", "Information");
                }
            }
        }