Пример #1
0
        public void setUser(User theUser)
        {
            currentUser = theUser;

            if ((currentUser.getBio().Equals("")) || (currentUser.getBio().Equals(null)))
            {
                lblBioText.Text = "Enter your bio here...";

            }
            else {
                lblBioText.Text = currentUser.getBio();
            }

            //Display full name
            lblFullName.Text = currentUser.getFirstName() + " " + currentUser.getLastName();

            //Display username
            lblUsername.Text = currentUser.getUsername();

            //Display email
            lblEmail.Text = currentUser.getEmail();

            //TODO - DISPLAY PROFILE PIC

            //Display info in text boxes
            txtEmail.Text = currentUser.getEmail();
            txtFirstName.Text = currentUser.getFirstName();
            txtLastName.Text = currentUser.getLastName();
        }
Пример #2
0
        public bool doRegister(User toRegister)
        {
            try
            {
                // Call to initialise cluster connection
                //init();

                // Get the relevant details
                String uname = toRegister.getUsername();
                String fname = toRegister.getFirstName();
                String sname = toRegister.getLastName();
                String password = toRegister.getPassword();
                String bio = toRegister.getBio();
                String email = toRegister.getEmail();

                //Encrypt the password
                password = Encryption.calcMD5(password);

                // Connect to cluster
                ISession session = cluster.Connect("maltmusic");

                // Prepare and bind statement passing in username
                PreparedStatement ps = session.Prepare("insert into userprofiles (user_id, password, first_name, last_name, email, bio) values (:un,:pw,:fn,:sn,:em, :bi) if not exists");

                // Bind
                BoundStatement bs = ps.Bind(uname, password, fname, sname, email, bio);

                //Execute Query
                session.Execute(bs);

                return true;

                // Catch exceptions
            }
            catch (Exception ex)
            {

                // Output the error
                Console.WriteLine("SOMETHING WENT WRONG DURING REG : " + ex.Message);
                return false;
            }
        }