Ejemplo n.º 1
0
        private void AdvanceButton_Click(object sender, EventArgs e)
        {
            // Connect to database, get user attributes
            string  dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var     db_attributes     = new SQLiteConnection(dbPath_attributes);
            var     myAttributes      = db_attributes.Get <MyAttributes>(1);
            Spinner schoolSpinner     = FindViewById <Spinner>(Resource.Id.schoolSpinner);

            string school = string.Format("{0}", schoolSpinner.SelectedItem);

            MyAttributes tbl = new MyAttributes();

            tbl.id = 1;
            string name = myAttributes.name;

            tbl.name = name;
            string email = myAttributes.email;

            tbl.email = email;
            string password = myAttributes.password; // May not be necessary to store again, but good to keep all the info together

            tbl.password = password;
            string type = myAttributes.type;

            tbl.type = type;

            tbl.attribute1 = school;

            db_attributes.InsertOrReplace(tbl);

            var advanceIntent = new Intent(this, typeof(studentBuildProfile));

            StartActivity(advanceIntent);
            Finish();
        }
Ejemplo n.º 2
0
        private async void GetCompanyInfo()
        {
            string       dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var          db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes myAttributes      = db_attributes.Get <MyAttributes>(1);

            var firebase     = new FirebaseClient(FirebaseURL);
            var allCompanies = await firebase.Child("careerfairs").Child(myAttributes.cfid.ToString()).OnceAsync <Company>();

            foreach (var company in allCompanies)
            {
                if (company.Object.companyid == companyInt.ToString())
                {
                    thisCompanyInfo.name        = company.Object.name;
                    thisCompanyInfo.description = company.Object.description;
                    thisCompanyInfo.website     = company.Object.website;
                }
            }

            companyName.Text = thisCompanyInfo.name;

            string imageName  = thisCompanyInfo.name.ToLower().Replace(" ", "");
            int    resourceId = (int)typeof(Resource.Drawable).GetField(imageName).GetValue(null);

            companyLogo.SetImageResource(resourceId);

            description.Text = thisCompanyInfo.description;

            website.Text   = thisCompanyInfo.website;
            website.Click += Website_Click;
        }
Ejemplo n.º 3
0
        private void Drop_Click(object sender, EventArgs e)
        {
            string           dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes     myAttributes      = db_attributes.Get <MyAttributes>(1);

            string           dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
            SQLiteConnection db_login     = new SQLiteConnection(dbPath_login);

            string myCompanyQFilename = "qs_" + myAttributes.cfid.ToString() + "_" + myAttributes.attribute1 + ".db3";
            string dbPath_myCompanyQ  = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myCompanyQFilename);
            var    db_myCompanyQ      = new SQLiteConnection(dbPath_myCompanyQ);

            int          studentid             = db_myCompanyQ.Get <SQLite_Tables.Queue>(1).studentid;
            StudentTable thisStudentAttributes = db_login.Get <StudentTable>(studentid);
            LoginTable   thisStudentLogin      = db_login.Query <LoginTable>("SELECT * FROM LoginTable WHERE email = ?", thisStudentAttributes.email).First();

            string fileName_studentQ = "myqs_" + thisStudentLogin.cfid + "_" + thisStudentLogin.id + ".db3";
            string dbPath_studentQ   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_studentQ);
            var    db_studentQ       = new SQLiteConnection(dbPath_studentQ);

            SQLite_Tables.MyQueue thisQ = db_studentQ.Query <SQLite_Tables.MyQueue>("SELECT * FROM MyQueue WHERE company = ?", myAttributes.attribute1).First();
            int thisQid      = thisQ.id;
            int numStudentQs = db_studentQ.Table <SQLite_Tables.MyQueue>().Count();

            db_studentQ.Delete <SQLite_Tables.MyQueue>(thisQ.id);
            for (int i = thisQid; i <= numStudentQs - 1; i++)
            {
                SQLite_Tables.MyQueue currentEntry = db_studentQ.Get <SQLite_Tables.MyQueue>(i + 1);
                SQLite_Tables.MyQueue newEntry     = new SQLite_Tables.MyQueue();
                newEntry.id       = i;
                newEntry.company  = currentEntry.company;
                newEntry.position = currentEntry.position;

                db_studentQ.InsertOrReplace(newEntry);
            }
            db_studentQ.Delete <SQLite_Tables.MyQueue>(numStudentQs);

            int numStudents = db_myCompanyQ.Table <SQLite_Tables.Queue>().Count();

            db_myCompanyQ.Delete <SQLite_Tables.Queue>(1);
            for (int i = 1; i <= numStudents - 1; i++)
            {
                SQLite_Tables.Queue newStudent = new SQLite_Tables.Queue();
                newStudent.id        = i;
                newStudent.studentid = db_myCompanyQ.Get <SQLite_Tables.Queue>(i + 1).studentid;

                db_myCompanyQ.InsertOrReplace(newStudent);
            }
            db_myCompanyQ.Delete <SQLite_Tables.Queue>(numStudents);

            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
            trans.Replace(Resource.Id.qs_root_frame, new QsFragment());
            trans.Commit();
        }
Ejemplo n.º 4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            string           dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);

            if (myAttributes.cfid == 0)
            {
                view = inflater.Inflate(Resource.Layout.MyQsTab, container, false);
                ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton);
                backButton.Click += (sender, e) =>
                {
                    Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                    trans.Commit();
                };
                return(view);
            }
            else
            {
                if (myAttributes.type == "Recruiter")
                {
                    // get the view
                    GetRecruiterView();
                    // in the meantime, display loading
                    view = inflater.Inflate(Resource.Layout.HomeTab, container, false);
                    ProgressBar progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                    progressBar.Visibility = ViewStates.Visible;
                    return(view);
                }
                else if (myAttributes.type == "Student")
                {
                    // get the view
                    GetStudentView();
                    // in the meantime, display loading
                    view = inflater.Inflate(Resource.Layout.HomeTab, container, false);
                    ProgressBar progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                    progressBar.Visibility = ViewStates.Visible;

                    return(view);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }
Ejemplo n.º 5
0
        private void AdvanceButton_Click(object sender, EventArgs e)
        {
            // connect to attributes database, get first row
            string       dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var          db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes userAttributes    = db_attributes.Get <MyAttributes>(1);


            // Update User Attributes
            userAttributes.cfid       = 0;        // no career fair id
            userAttributes.rememberme = false;    // force log in on next use

            db_attributes.Update(userAttributes); // update attributes row

            CreateUser();
        }
Ejemplo n.º 6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            string           dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes     myAttributes      = db_attributes.Get <MyAttributes>(1);

            if (myAttributes.cfid == 0)
            {
                View      view       = inflater.Inflate(Resource.Layout.MyQsTab, container, false);
                ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton);
                backButton.Click += (sender, e) =>
                {
                    Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                    trans.Commit();
                };
                return(view);
            }
            else
            {
                if (myAttributes.type == "Recruiter")
                {
                    string myCompanyQFilename = "qs_" + myAttributes.cfid.ToString() + "_" + myAttributes.attribute1 + ".db3";
                    string dbPath_myCompanyQ  = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myCompanyQFilename);
                    var    db_myCompanyQ      = new SQLiteConnection(dbPath_myCompanyQ);

                    string           dbPath_user = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
                    SQLiteConnection db_user     = new SQLiteConnection(dbPath_user);

                    int numStudents = db_myCompanyQ.Table <SQLite_Tables.Queue>().Count();
                    //Toast.MakeText(this.Activity, numStudents.ToString(), ToastLength.Short).Show();
                    View view;
                    //view = inflater.Inflate(Resource.Layout.MyQsTab, container, false);
                    //return view;

                    //}
                    if (numStudents == 0)
                    {
                        view = inflater.Inflate(Resource.Layout.MyQsTab, container, false);
                        ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton);
                        backButton.Click += (sender, e) =>
                        {
                            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                            trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                            trans.Commit();
                        };
                        return(view);
                    }

                    else if (numStudents == 1)
                    {
                        view = inflater.Inflate(Resource.Layout.RecruiterQsPresent, container, false);
                        TextView  candidateName = view.FindViewById <TextView>(Resource.Id.candidateName1);
                        Button    drop          = view.FindViewById <Button>(Resource.Id.dropbutton);
                        Button    pull          = view.FindViewById <Button>(Resource.Id.pullbutton);
                        ImageView backButton    = view.FindViewById <ImageView>(Resource.Id.backButton);
                        backButton.Click += (sender, e) =>
                        {
                            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                            trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                            trans.Commit();
                        };

                        drop.Click += Drop_Click;
                        pull.Click += Pull_Click;

                        student_id1        = db_myCompanyQ.Get <SQLite_Tables.Queue>(1).studentid;
                        candidateName.Text = db_user.Get <StudentTable>(student_id1).name;
                    }

                    else if (numStudents >= 2)
                    {
                        view = inflater.Inflate(Resource.Layout.RecruiterQsPresent, container, false);
                        ListView queue = view.FindViewById <ListView>(Resource.Id.queuelist);
                        //queue.Enabled = false;
                        TextView  candidateName = view.FindViewById <TextView>(Resource.Id.candidateName1);
                        Button    drop          = view.FindViewById <Button>(Resource.Id.dropbutton);
                        Button    pull          = view.FindViewById <Button>(Resource.Id.pullbutton);
                        ImageView backButton    = view.FindViewById <ImageView>(Resource.Id.backButton);
                        backButton.Click += (sender, e) =>
                        {
                            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                            trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                            trans.Commit();
                        };

                        drop.Click += Drop_Click;
                        pull.Click += Pull_Click;

                        student_id1        = db_myCompanyQ.Get <SQLite_Tables.Queue>(1).studentid;
                        candidateName.Text = db_user.Get <StudentTable>(student_id1).name;

                        List <string> mItems = new List <string>();
                        for (int i = 2; i <= numStudents; i++)
                        {
                            int          student_id  = db_myCompanyQ.Get <SQLite_Tables.Queue>(i).studentid;
                            StudentTable studentInfo = db_user.Get <StudentTable>(student_id);
                            string       newItem     = studentInfo.name;
                            //Toast.MakeText(this.Activity, newItem, ToastLength.Short).Show();
                            mItems.Add(newItem);
                        }

                        QueueListViewAdapter adapter = new QueueListViewAdapter(container.Context, mItems);
                        queue.Adapter = adapter;
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                    return(view);
                }
                else if (myAttributes.type == "Student")
                {
                    string           fileName_myQs = "myqs_" + myAttributes.cfid.ToString() + "_" + myAttributes.loginid + ".db3";
                    string           dbPath_myQs   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_myQs);
                    SQLiteConnection db_myQs       = new SQLiteConnection(dbPath_myQs);
                    db_myQs.CreateTable <SQLite_Tables.MyQueue>();

                    string           fileName_myPastQs = "pastqs_" + myAttributes.loginid.ToString() + ".db3";
                    string           dbPath_myPastQs   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_myPastQs);
                    SQLiteConnection db_myPastQs       = new SQLiteConnection(dbPath_myPastQs);
                    db_myPastQs.CreateTable <SQLite_Tables.MyPastQueue>();

                    int  numMyQs = db_myQs.Table <SQLite_Tables.MyQueue>().Count();
                    View view;
                    if (numMyQs == 0)
                    {
                        view = inflater.Inflate(Resource.Layout.MyQsTab, container, false);
                        ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton);
                        backButton.Click += (sender, e) =>
                        {
                            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                            trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                            trans.Commit();
                        };
                        return(view);
                    }
                    else
                    {
                        view = inflater.Inflate(Resource.Layout.StudentQsPresent, container, false);
                        List <string> mItems     = new List <string>();
                        ListView      mListView  = view.FindViewById <ListView>(Resource.Id.myQsListView);
                        ImageView     backButton = view.FindViewById <ImageView>(Resource.Id.backButton);
                        backButton.Click += (sender, e) =>
                        {
                            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                            trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                            trans.Commit();
                        };

                        for (int i = 1; i <= numMyQs; i++)
                        {
                            SQLite_Tables.MyQueue newRow = db_myQs.Get <SQLite_Tables.MyQueue>(i);
                            string newItem = newRow.company;
                            mItems.Add(newItem);
                        }

                        QsListViewAdapter adapter = new QsListViewAdapter(container.Context, mItems, "CurrentQs");
                        mListView.Adapter = adapter;

                        return(view);
                    }
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }
Ejemplo n.º 7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContainer = container;
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);

            string type = myAttributes.type;

            if (type == "Student")
            {
                View     view        = inflater.Inflate(Resource.Layout.StudentProfileTab, container, false);
                TextView name        = view.FindViewById <TextView>(Resource.Id.myName);
                TextView email       = view.FindViewById <TextView>(Resource.Id.myEmail);
                TextView school      = view.FindViewById <TextView>(Resource.Id.myUniversity);
                TextView major       = view.FindViewById <TextView>(Resource.Id.myMajor);
                TextView gpa         = view.FindViewById <TextView>(Resource.Id.myGPA);
                TextView gradterm    = view.FindViewById <TextView>(Resource.Id.myGradterm);
                TextView editProfile = view.FindViewById <TextView>(Resource.Id.editProfile);
                favListView = view.FindViewById <ListView>(Resource.Id.favoritesList);
                progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                name.Text     = myAttributes.name;
                email.Text    = myAttributes.email;
                school.Text   = myAttributes.attribute1;
                gradterm.Text = myAttributes.attribute2;
                major.Text    = myAttributes.attribute3;
                gpa.Text      = myAttributes.attribute4;

                editProfile.Click += EditProfile_Click;

                int myCFID = myAttributes.cfid;
                if (myCFID != 0)
                {
                    PopulateList();
                }

                return(view);
            }

            else if (type == "Recruiter")
            {
                View     view        = inflater.Inflate(Resource.Layout.RecruiterProfileTab, container, false);
                TextView name        = view.FindViewById <TextView>(Resource.Id.myName);
                TextView email       = view.FindViewById <TextView>(Resource.Id.myEmail);
                TextView company     = view.FindViewById <TextView>(Resource.Id.myCompany);
                TextView editProfile = view.FindViewById <TextView>(Resource.Id.editProfile);

                name.Text    = myAttributes.name;
                email.Text   = myAttributes.email;
                company.Text = myAttributes.attribute1;

                editProfile.Click += EditProfile_Click;

                int myCFID = myAttributes.cfid;

                if (myCFID != 0)
                {
                    string           fileName_pastqs = "pastqs_" + myAttributes.attribute1 + ".db3";
                    string           dbPath_pastqs   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_pastqs);
                    SQLiteConnection db_pastqs       = new SQLiteConnection(dbPath_pastqs);
                    int numpastqs = db_pastqs.Table <SQLite_Tables.PastQueue>().Count();

                    string           dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
                    SQLiteConnection db_login     = new SQLiteConnection(dbPath_login);

                    ListView   lv_favorites = view.FindViewById <ListView>(Resource.Id.favoritesList);
                    List <int> students     = new List <int>();

                    for (int i = 1; i <= numpastqs; i++)
                    {
                        SQLite_Tables.PastQueue thisPastQueue = db_pastqs.Get <SQLite_Tables.PastQueue>(i);
                        if (thisPastQueue.rating != 0)
                        {
                            int newStudentid = thisPastQueue.studentid;
                            students.Add(newStudentid);
                        }

                        PastQueuesListViewAdapter adapter = new PastQueuesListViewAdapter(container.Context, students, "Profile");
                        lv_favorites.Adapter = adapter;
                    }
                }
                return(view);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 8
0
        private async void ConfirmBtn_Click(object sender, EventArgs e)
        {
            progressBar.Visibility = ViewStates.Visible;
            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);

            myAttributes.cfid = Convert.ToInt32(myCFID);
            db_attributes.Update(myAttributes);

            var firebase  = new FirebaseClient(FirebaseURL);
            var allLogins = await firebase.Child("users").OnceAsync <User>();

            string key = "";

            foreach (var login in allLogins)
            {
                if (login.Object.email == myAttributes.email)
                {
                    key = login.Key;
                }
            }

            User updateUser = new User();

            updateUser.uid      = myAttributes.loginid.ToString();
            updateUser.name     = myAttributes.name;
            updateUser.email    = myAttributes.email;
            updateUser.password = myAttributes.password;
            updateUser.type     = myAttributes.type;
            updateUser.cfid     = myAttributes.cfid.ToString();
            await firebase.Child("users").Child(key).PutAsync(updateUser);

            if (myAttributes.type == "Student")
            {
                string favorites_fileName = "fav_" + myCFID + "_" + myAttributes.loginid.ToString();

                var allCompanies = await firebase.Child(myAttributes.cfid.ToString()).OnceAsync <Company>();

                int numCompanies = allCompanies.Count();
                foreach (var company in allCompanies)
                {
                    Favorite item = new Favorite();
                    item.companyid  = company.Object.companyid;
                    item.name       = company.Object.name;
                    item.isFavorite = false;
                    await firebase.Child(favorites_fileName).PostAsync(item);
                }

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.register_root_frame, new RegisterFragment());
                trans.Commit();

                viewPager.SetCurrentItem(0, true);
            }

            else if (myAttributes.type == "Recruiter")
            {
                string mPreferences_fileName = "mp_" + myCFID + "_" + myAttributes.attribute1;

                /*string dbPath_mPreferences = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), mPreferences_fileName);
                 * var db_mPreferences = new SQLiteConnection(dbPath_mPreferences);
                 * db_mPreferences.CreateTable<OnQAndroid.SQLite_Tables.MajorPreferences>();
                 * db_mPreferences.CreateTable<OnQAndroid.SQLite_Tables.GradTermPreferences>();
                 * db_mPreferences.CreateTable<OnQAndroid.SQLite_Tables.GPAPreferences>();*/

                string myCompanyQFilename = "qs_" + myCFID + "_" + myAttributes.attribute1;

                /*string dbPath_myCompanyQ = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myCompanyQFilename);
                 * var db_myCompanyQ = new SQLiteConnection(dbPath_myCompanyQ);
                 * db_myCompanyQ.CreateTable<OnQAndroid.SQLite_Tables.Queue>();*/

                string myCompanyPastQsFilename = "pastqs_" + myAttributes.attribute1;

                /*string dbPath_pastqs = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myCompanyPastQsFilename);
                 * var db_pastqs = new SQLiteConnection(dbPath_pastqs);
                 * db_pastqs.CreateTable<OnQAndroid.SQLite_Tables.PastQueue>();*/

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.register_root_frame, new RegisterFragment());
                trans.Commit();

                viewPager.SetCurrentItem(0, true);
            }
            progressBar.Visibility = ViewStates.Invisible;
        }
Ejemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            // Get Advance Button controls from Main
            Button advanceButton = FindViewById <Button>(Resource.Id.advance);

            // Disable advance button until progress bar is full
            advanceButton.Enabled = false;
            // Set Background Color of disabled advance button
            advanceButton.SetBackgroundColor(Android.Graphics.Color.Rgb(239, 239, 239));
            // Advance button event
            advanceButton.Click += (object sender, EventArgs e) => // on advance button click
            {
                string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
                //DeleteDatabase(dbPath_attributes); // simulate first use
                SQLiteConnection db_attributes = new SQLiteConnection(dbPath_attributes);
                db_attributes.CreateTable <MyAttributes>();

                try // required because on first use, myattributes will contain zero objects
                {
                    MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);

                    if (myAttributes.rememberme == true)
                    {
                        var advanceIntent = new Intent(this, typeof(homeScreen2)).PutExtra("UserId", myAttributes.loginid.ToString()); // remember me temporarily broken
                        StartActivity(advanceIntent);
                        Finish();
                    }

                    else if (myAttributes.rememberme == false)
                    {
                        var advanceIntent = new Intent(this, typeof(LoginSignup)); // create intent to go to login/signup screen
                        StartActivity(advanceIntent);                              // start the next activity
                        Finish();                                                  // finish this activity so that you can't go back to loading screen
                    }
                }
                catch
                {
                    MyAttributes nullAttributes = new MyAttributes();
                    nullAttributes.id         = 1;
                    nullAttributes.rememberme = false;
                    db_attributes.InsertOrReplace(nullAttributes);

                    var advanceIntent = new Intent(this, typeof(LoginSignup)); // create intent to go to login/signup screen
                    StartActivity(advanceIntent);                              // start the next activity
                    Finish();                                                  // finish this activity so that you can't go back to loading screen
                }
            };


            // Progress Bar
            progressBar          = FindViewById <ProgressBar>(Resource.Id.progressBar1); // get progress bar from view
            progressBar.Max      = 100;                                                  // maximum progress
            progressBar.Progress = 0;                                                    // initial progress

            _timer          = new Timer();                                               // make a new timer
            _timer.Enabled  = true;                                                      // enable the timer
            _timer.Interval = 20;                                                        // interval of timer is 20 ms
            _timer.Elapsed += OnTimeEvent;                                               // whenever time elapses, execute event
        }
Ejemplo n.º 10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContainer = container;
            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);
            int myCFID = myAttributes.cfid;

            if (myCFID == 0) // If not registered for a career fair
            {
                View view = inflater.Inflate(Resource.Layout.GoToRegister, container, false);
                return(view);
            }

            else
            {
                if (myAttributes.type == "Student")
                {
                    // Inflate View
                    View view = inflater.Inflate(Resource.Layout.HomeTab, container, false);

                    // Call UI Elements
                    mListView   = view.FindViewById <ListView>(Resource.Id.listView1);
                    cfName      = view.FindViewById <TextView>(Resource.Id.cfName);
                    progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                    mItems = new List <string>();

                    LoadCF();

                    return(view);
                }
                else if (myAttributes.type == "Recruiter")
                {
                    View view = inflater.Inflate(Resource.Layout.RecruiterHomeTab, container, false);

                    HMAllRadio    = view.FindViewById <Button>(Resource.Id.HMAllRadio);
                    HGTAllRadio   = view.FindViewById <Button>(Resource.Id.HGTAllRadio);
                    HGPANoneRadio = view.FindViewById <Button>(Resource.Id.HGPANoneRadio);
                    plus_major    = view.FindViewById <Button>(Resource.Id.plus_majors);
                    hmspinner1    = view.FindViewById <Spinner>(Resource.Id.hmspinner1);
                    hmspinner2    = view.FindViewById <Spinner>(Resource.Id.hmspinner2);
                    hmspinner3    = view.FindViewById <Spinner>(Resource.Id.hmspinner3);
                    hmspinner4    = view.FindViewById <Spinner>(Resource.Id.hmspinner4);
                    hmspinner5    = view.FindViewById <Spinner>(Resource.Id.hmspinner5);
                    minus_major   = view.FindViewById <Button>(Resource.Id.minus_majors);

                    hgtspinner1 = view.FindViewById <Spinner>(Resource.Id.hgtspinner1);
                    hgtspinner2 = view.FindViewById <Spinner>(Resource.Id.hgtspinner2);
                    hgtspinner3 = view.FindViewById <Spinner>(Resource.Id.hgtspinner3);
                    plus_gt     = view.FindViewById <Button>(Resource.Id.plus_gt);
                    minus_gt    = view.FindViewById <Button>(Resource.Id.minus_gradterms);

                    minGPAspinner = view.FindViewById <Spinner>(Resource.Id.minGPAspinner);

                    Button   saveChanges    = view.FindViewById <Button>(Resource.Id.saveChangesButton);
                    TextView cfName         = view.FindViewById <TextView>(Resource.Id.cfName);
                    TextView HMAllText      = view.FindViewById <TextView>(Resource.Id.HMAllText);
                    TextView HGTAllText     = view.FindViewById <TextView>(Resource.Id.HGTAllText);
                    TextView MinGPANoneText = view.FindViewById <TextView>(Resource.Id.MinGPANoneText);
                    Space    plus1extender  = view.FindViewById <Space>(Resource.Id.plusspace1);
                    Space    plus2extender  = view.FindViewById <Space>(Resource.Id.plusspace2);

                    // Change name to my CF name
                    string dbPath_cfids = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "CFIDs.db3");
                    var    db_cfids     = new SQLiteConnection(dbPath_cfids);
                    db_cfids.CreateTable <Cfids>();

                    var   cfid_queryResults = db_cfids.Query <Cfids>("SELECT * FROM Cfids WHERE cfid = ?", myCFID.ToString());
                    Cfids cfid = cfid_queryResults.First();
                    cfName.Text = cfid.name;

                    // Item Selected Methods

                    /*hmspinner1.ItemSelected += Hmspinner1_ItemSelected;
                    *  hmspinner2.ItemSelected += Hmspinner2_ItemSelected;
                    *  hmspinner3.ItemSelected += Hmspinner3_ItemSelected;
                    *  hmspinner4.ItemSelected += Hmspinner4_ItemSelected;
                    *  hmspinner5.ItemSelected += Hmspinner5_ItemSelected;*/

                    // Populate list items in major spinner
                    var majoradapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.major_array, Android.Resource.Layout.SimpleSpinnerItem);
                    majoradapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                    hmspinner1.Adapter = majoradapter;
                    hmspinner2.Adapter = majoradapter;
                    hmspinner3.Adapter = majoradapter;
                    hmspinner4.Adapter = majoradapter;
                    hmspinner5.Adapter = majoradapter;

                    // Populate list items in grad term spinner
                    var gradtermadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.year_array, Android.Resource.Layout.SimpleSpinnerItem);
                    gradtermadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                    hgtspinner1.Adapter = gradtermadapter;
                    hgtspinner2.Adapter = gradtermadapter;
                    hgtspinner3.Adapter = gradtermadapter;

                    // Populate list items in gpa spinner
                    var gpaadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.gpa_array, Android.Resource.Layout.SimpleSpinnerItem);
                    gpaadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                    minGPAspinner.Adapter = gpaadapter;

                    // Click methods
                    HMAllRadio.Click     += HMAllRadio_Click;
                    HMAllText.Click      += HMAllRadio_Click;
                    HGTAllRadio.Click    += HGTAllRadio_Click;
                    HGTAllText.Click     += HGTAllRadio_Click;
                    HGPANoneRadio.Click  += HGPANoneRadio_Click;
                    MinGPANoneText.Click += HGPANoneRadio_Click;
                    saveChanges.Click    += SaveChanges_Click;

                    // Connect to preferences database
                    string myCompany             = myAttributes.attribute1;
                    string mPreferences_fileName = "mp_" + myCFID + "_" + myCompany + ".db3";
                    string dbPath_mPreferences   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), mPreferences_fileName);
                    var    db_mPreferences       = new SQLiteConnection(dbPath_mPreferences);

                    // Get number of major and grad term preferences
                    numMPs  = db_mPreferences.Table <SQLite_Tables.MajorPreferences>().Count();
                    numGTPs = db_mPreferences.Table <SQLite_Tables.GradTermPreferences>().Count();
                    numGPAs = db_mPreferences.Table <SQLite_Tables.GPAPreferences>().Count();

                    // Populate gpa spinner with current preference
                    if (numGPAs == 0)
                    {
                        isMinGPANone = true;

                        minGPAspinner.Enabled    = false;
                        minGPAspinner.Visibility = ViewStates.Invisible;
                    }
                    if (numGPAs >= 1)
                    {
                        isMinGPANone = false;
                        HGPANoneRadio.SetBackgroundResource(Resource.Drawable.radio_unchecked);
                        string defaultGPA = db_mPreferences.Get <SQLite_Tables.GPAPreferences>(1).gpa;
                        if (!defaultGPA.Equals(null))
                        {
                            int spinnerPosition = gpaadapter.GetPosition(defaultGPA);
                            minGPAspinner.SetSelection(spinnerPosition);
                        }
                    }
                    // Populate grad term spinners with current preferences
                    if (numGTPs == 0)
                    {
                        isHGTAll = true;

                        hgtspinner1.Enabled    = false;
                        hgtspinner1.Visibility = ViewStates.Invisible;
                        plus_gt.Enabled        = false;
                        plus_gt.Visibility     = ViewStates.Invisible;
                    }
                    if (numGTPs >= 1)
                    {
                        isHGTAll = false;
                        HGTAllRadio.SetBackgroundResource(Resource.Drawable.radio_unchecked);
                        string defaultGTP = db_mPreferences.Get <SQLite_Tables.GradTermPreferences>(1).gradterm;
                        if (!defaultGTP.Equals(null))
                        {
                            int spinnerPosition = gradtermadapter.GetPosition(defaultGTP);
                            hgtspinner1.SetSelection(spinnerPosition);
                        }
                    }
                    if (numGTPs >= 2)
                    {
                        hgtspinner2.Visibility = ViewStates.Visible;
                        minus_gt.Visibility    = ViewStates.Visible;
                        string defaultGTP = db_mPreferences.Get <SQLite_Tables.GradTermPreferences>(2).gradterm;
                        if (!defaultGTP.Equals(null))
                        {
                            int spinnerPosition = gradtermadapter.GetPosition(defaultGTP);
                            hgtspinner2.SetSelection(spinnerPosition);
                        }
                    }
                    if (numGTPs >= 3)
                    {
                        hgtspinner3.Visibility = ViewStates.Visible;
                        string defaultGTP = db_mPreferences.Get <SQLite_Tables.GradTermPreferences>(3).gradterm;
                        if (!defaultGTP.Equals(null))
                        {
                            int spinnerPosition = gradtermadapter.GetPosition(defaultGTP);
                            hgtspinner3.SetSelection(spinnerPosition);
                        }
                    }

                    // Populate major spinners with current preferences
                    if (numMPs == 0)
                    {
                        isHMAll = true;

                        hmspinner1.Enabled    = false;
                        hmspinner1.Visibility = ViewStates.Invisible;
                        plus_major.Enabled    = false;
                        plus_major.Visibility = ViewStates.Invisible;
                    }
                    if (numMPs >= 1)
                    {
                        isHMAll = false;
                        HMAllRadio.SetBackgroundResource(Resource.Drawable.radio_unchecked);
                        string defaultMP = db_mPreferences.Get <SQLite_Tables.MajorPreferences>(1).major;
                        if (!defaultMP.Equals(null))
                        {
                            int spinnerPosition = majoradapter.GetPosition(defaultMP);
                            hmspinner1.SetSelection(spinnerPosition);
                        }
                    }
                    if (numMPs >= 2)
                    {
                        hmspinner2.Visibility  = ViewStates.Visible;
                        minus_major.Visibility = ViewStates.Visible;
                        string defaultMP = db_mPreferences.Get <SQLite_Tables.MajorPreferences>(2).major;
                        if (!defaultMP.Equals(null))
                        {
                            int spinnerPosition = majoradapter.GetPosition(defaultMP);
                            hmspinner2.SetSelection(spinnerPosition);
                        }
                    }
                    if (numMPs >= 3)
                    {
                        hmspinner3.Visibility = ViewStates.Visible;
                        string defaultMP = db_mPreferences.Get <SQLite_Tables.MajorPreferences>(3).major;
                        if (!defaultMP.Equals(null))
                        {
                            int spinnerPosition = majoradapter.GetPosition(defaultMP);
                            hmspinner3.SetSelection(spinnerPosition);
                        }
                    }
                    if (numMPs >= 4)
                    {
                        hmspinner4.Visibility = ViewStates.Visible;
                        string defaultMP = db_mPreferences.Get <SQLite_Tables.MajorPreferences>(4).major;
                        if (!defaultMP.Equals(null))
                        {
                            int spinnerPosition = majoradapter.GetPosition(defaultMP);
                            hmspinner4.SetSelection(spinnerPosition);
                        }
                    }
                    if (numMPs >= 5)
                    {
                        hmspinner5.Visibility = ViewStates.Visible;
                        string defaultMP = db_mPreferences.Get <SQLite_Tables.MajorPreferences>(5).major;
                        if (!defaultMP.Equals(null))
                        {
                            int spinnerPosition = majoradapter.GetPosition(defaultMP);
                            hmspinner5.SetSelection(spinnerPosition);
                        }
                    }

                    // On plus major click
                    plus_major.Click    += Plus_major_Click;
                    plus1extender.Click += Plus_major_Click;

                    // On plus gt click
                    plus_gt.Click       += Plus_gt_Click;
                    plus2extender.Click += Plus_gt_Click;

                    // on minus major click
                    minus_major.Click += (sender, e) =>
                    {
                        numMPs = numMPs - 1;
                        if (numMPs == 1)
                        {
                            hmspinner2.Visibility  = ViewStates.Gone;
                            minus_major.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 2)
                        {
                            hmspinner3.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 3)
                        {
                            hmspinner4.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 4)
                        {
                            hmspinner5.Visibility = ViewStates.Gone;
                        }
                    };
                    // on minus grad term click
                    minus_gt.Click += (sender, e) =>
                    {
                        numGTPs = numGTPs - 1;
                        if (numGTPs == 1)
                        {
                            hgtspinner2.Visibility = ViewStates.Gone;
                            minus_gt.Visibility    = ViewStates.Gone;
                        }
                        else if (numGTPs == 2)
                        {
                            hgtspinner3.Visibility = ViewStates.Gone;
                        }
                    };

                    return(view);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }
Ejemplo n.º 11
0
        private async void UpdateRecruiter(bool isCompanyChanged)
        {
            try
            {
                string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
                var    db_attributes     = new SQLiteConnection(dbPath_attributes);

                MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);

                int id_login     = myAttributes.loginid;
                int id_recruiter = myAttributes.typeid;

                string username  = updateEmail.Text.Split('@')[0];
                string domain    = updateEmail.Text.Split('@')[1];
                string provider  = domain.Split('.')[0];
                string extension = domain.Split('.')[1];

                // Update Login
                User updateLogin = new User();
                updateLogin.uid      = id_login.ToString();
                updateLogin.name     = updateName.Text;
                updateLogin.email    = updateEmail.Text;
                updateLogin.password = myAttributes.password;
                if (isCompanyChanged == true)
                {
                    updateLogin.cfid = "0";
                }
                else if (isCompanyChanged == false)
                {
                    updateLogin.cfid = myAttributes.cfid.ToString();
                }
                updateLogin.type = "Recruiter";
                var firebase = new FirebaseClient(FirebaseURL);
                await firebase.Child("users").Child(key).PutAsync(updateLogin);

                // Update Recruiter
                Recruiter updateRecruiter = new Recruiter();
                updateRecruiter.recruiterid = id_recruiter.ToString();
                updateRecruiter.name        = updateName.Text;
                updateRecruiter.email       = updateEmail.Text;
                updateRecruiter.password    = myAttributes.password;
                updateRecruiter.company     = string.Format("{0}", company.SelectedItem);

                var allRecruiters = await firebase.Child("recruiters").OnceAsync <Recruiter>();

                string recruiterKey = "";

                foreach (var recruiter in allRecruiters)
                {
                    if (recruiter.Object.email == myAttributes.email)
                    {
                        recruiterKey = recruiter.Key;
                    }
                }
                await firebase.Child("recruiters").Child(recruiterKey).PutAsync(updateRecruiter);

                // Update MyAttributes
                MyAttributes updateMyAttributes = new MyAttributes();
                updateMyAttributes.id         = 1;
                updateMyAttributes.name       = updateRecruiter.name;
                updateMyAttributes.email      = updateRecruiter.email;
                updateMyAttributes.password   = myAttributes.password;
                updateMyAttributes.type       = "Recruiter";
                updateMyAttributes.attribute1 = updateRecruiter.company;
                updateMyAttributes.attribute2 = "";
                updateMyAttributes.attribute3 = "";
                updateMyAttributes.attribute4 = "";

                if (isCompanyChanged == true)
                {
                    updateMyAttributes.cfid = 0;
                }
                else if (isCompanyChanged == false)
                {
                    updateMyAttributes.cfid = myAttributes.cfid;
                }
                updateMyAttributes.loginid    = id_login;
                updateMyAttributes.typeid     = id_recruiter;
                updateMyAttributes.rememberme = myAttributes.rememberme;

                db_attributes.InsertOrReplace(updateMyAttributes);

                progressBar.Visibility = ViewStates.Invisible;

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.profile_root_frame, new ProfileFragment());
                trans.Commit();
            }
            catch
            {
                progressBar.Visibility = ViewStates.Invisible;
                Toast.MakeText(this.Activity, "Invalid Email Address", ToastLength.Short).Show();
            }
        }
Ejemplo n.º 12
0
        private async void NextButton_Click(object sender, EventArgs e)
        {
            // Call UI Controls
            EditText    editName     = FindViewById <EditText>(Resource.Id.nameField);
            EditText    editEmail    = FindViewById <EditText>(Resource.Id.emailField);
            Spinner     yearSpinner  = FindViewById <Spinner>(Resource.Id.yearspinner);
            Spinner     majorSpinner = FindViewById <Spinner>(Resource.Id.majorspinner);
            Spinner     gpaSpinner   = FindViewById <Spinner>(Resource.Id.gpaspinner);
            ProgressBar progressBar  = FindViewById <ProgressBar>(Resource.Id.circularProgress);

            progressBar.Visibility = ViewStates.Visible;

            // Get user data (attributes)
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);
            var    userAttributes    = db_attributes.Get <MyAttributes>(1);

            // Make a new table for students and populate it
            MyAttributes myStudentAttributes = db_attributes.Get <MyAttributes>(1);
            MyAttributes tbl = new MyAttributes();

            int numExistingLogins = 0;

            try
            {
                var firebase  = new FirebaseClient(FirebaseURL);
                var allLogins = await firebase.Child("users").OnceAsync <User>();

                foreach (var login in allLogins)
                {
                    string email = login.Object.email;
                    if (email == editEmail.Text)
                    {
                        numExistingLogins = numExistingLogins + 1;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
                progressBar.Visibility = ViewStates.Invisible;
            }

            if (numExistingLogins != 0)
            {
                Toast.MakeText(this, "Email Is Already In Use", ToastLength.Short).Show();
                progressBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                try // check to see if email is correctly formatted
                {
                    string user      = editEmail.Text.Split('@')[0];
                    string domain    = editEmail.Text.Split('@')[1];
                    string provider  = domain.Split('.')[0];
                    string extension = domain.Split('.')[1];

                    tbl.id = 1;
                    string name = editName.Text;
                    tbl.name = name;
                    string email = editEmail.Text;
                    tbl.email = email;
                    string password = userAttributes.password; // May not be necessary to store again, but good to keep all the info together
                    tbl.password = password;
                    tbl.type     = userAttributes.type;
                    string school = myStudentAttributes.attribute1;
                    tbl.attribute1 = school;
                    string grad_term = string.Format("{0}", yearSpinner.SelectedItem);
                    tbl.attribute2 = grad_term;
                    string major = string.Format("{0}", majorSpinner.SelectedItem);
                    tbl.attribute3 = major;
                    string GPA = string.Format("{0}", gpaSpinner.SelectedItem);
                    tbl.attribute4 = GPA;

                    // Put Student info into MyAttributes table in attributes database
                    db_attributes.InsertOrReplace(tbl);

                    // Next
                    progressBar.Visibility = ViewStates.Invisible;
                    var advanceIntent = new Intent(this, typeof(uploadResume));
                    StartActivity(advanceIntent); // go to upload resume
                    Finish();                     // finish activity
                }
                catch                             // if email address is improperly formatted
                {
                    Toast.MakeText(this, "Invalid Email Address", ToastLength.Short).Show();
                    progressBar.Visibility = ViewStates.Invisible;
                }
            }
        }
Ejemplo n.º 13
0
        private async void ConfirmChanges_Click(object sender, EventArgs e)
        {
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);

            int id_login = myAttributes.loginid;

            if (myAttributes.type == "Student")
            {
                // Get Student ID
                int id_student = myAttributes.typeid;

                loginExists = false;
                existingId  = "";

                progressBar.Visibility = ViewStates.Visible;
                var firebase  = new FirebaseClient(FirebaseURL);
                var allLogins = await firebase.Child("users").OnceAsync <User>();

                foreach (var login in allLogins)
                {
                    if (login.Object.email == updateEmail.Text)
                    {
                        loginExists = true;
                        break;
                    }
                }

                foreach (var login in allLogins)
                {
                    if (login.Object.email == myAttributes.email)
                    {
                        existingId = login.Object.uid;
                        key        = login.Key;
                        break;
                    }
                }

                if (loginExists == true && existingId != id_login.ToString())
                {
                    Toast.MakeText(this.Activity, "Email Is Already In Use", ToastLength.Short).Show();
                    progressBar.Visibility = ViewStates.Invisible;
                }
                else
                {
                    UpdateStudent();
                }
            }

            else if (myAttributes.type == "Recruiter")
            {
                loginExists = false;
                existingId  = "";
                string myId = "";

                progressBar.Visibility = ViewStates.Visible;
                var firebase  = new FirebaseClient(FirebaseURL);
                var allLogins = await firebase.Child("users").OnceAsync <User>();

                foreach (var login in allLogins)
                {
                    if (login.Object.email == updateEmail.Text)
                    {
                        loginExists = true;
                        existingId  = login.Object.uid;
                        break;
                    }
                }

                foreach (var login in allLogins)
                {
                    if (login.Object.email == myAttributes.email)
                    {
                        myId = login.Object.uid;
                        key  = login.Key;
                        break;
                    }
                }

                if (loginExists == true && existingId != id_login.ToString())
                {
                    progressBar.Visibility = ViewStates.Invisible;
                    Toast.MakeText(this.Activity, "Email Is Already In Use", ToastLength.Short).Show();
                }

                else if (company.SelectedItem.ToString() != myAttributes.attribute1)
                {
                    bool match        = false;
                    var  allCompanies = await firebase.Child("companies").OnceAsync <Company>();

                    foreach (var item in allCompanies)
                    {
                        if (item.Object.name == company.SelectedItem.ToString() && item.Object.rak == rakField.Text)
                        {
                            match = true;
                        }
                    }

                    if (match == true)
                    {
                        UpdateRecruiter(true);
                    }

                    else
                    {
                        progressBar.Visibility = ViewStates.Invisible;
                        Toast.MakeText(this.Activity, "Invalid Recruiter Access Key", ToastLength.Short).Show();
                    }
                }
                else
                {
                    UpdateRecruiter(false);
                }
            }
        }
Ejemplo n.º 14
0
        private async void NextButton_Click(object sender, EventArgs e)
        {
            // Call UI Controls
            ProgressBar progressBar    = FindViewById <ProgressBar>(Resource.Id.circularProgress);
            EditText    editName       = FindViewById <EditText>(Resource.Id.nameField);
            EditText    editEmail      = FindViewById <EditText>(Resource.Id.emailField);
            Spinner     companySpinner = FindViewById <Spinner>(Resource.Id.companyspinner);
            EditText    rakField       = FindViewById <EditText>(Resource.Id.rak); // rak = recruiter access key

            progressBar.Visibility = ViewStates.Visible;
            string company = string.Format("{0}", companySpinner.SelectedItem); // get value of company spinner

            var firebase     = new FirebaseClient(FirebaseURL);
            var companyItems = await firebase.Child("companies").OnceAsync <Company>();

            bool fieldsMatch = false;

            foreach (var item in companyItems)
            {
                string thiscompany = item.Object.name;
                string rak         = item.Object.rak;
                if (company == thiscompany && rakField.Text == rak)
                {
                    fieldsMatch = true;
                    break;
                }
            }

            if (fieldsMatch == true) // if query returned results
            {
                // Get user data (attributes)
                string       dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
                var          db_attributes     = new SQLiteConnection(dbPath_attributes);
                MyAttributes userAttributes    = db_attributes.Get <MyAttributes>(1);

                MyAttributes updateAttributes = new MyAttributes();

                updateAttributes.id = 1;
                string name = editName.Text;
                updateAttributes.name = name;
                string email = editEmail.Text;
                updateAttributes.email = email;
                string password = userAttributes.password;
                updateAttributes.password   = password;
                updateAttributes.attribute1 = company;
                updateAttributes.type       = userAttributes.type;

                // Put Recruiter info into attributes database
                db_attributes.InsertOrReplace(updateAttributes);

                progressBar.Visibility = ViewStates.Invisible;
                // Next
                var advanceIntent = new Intent(this, typeof(successScreen));
                StartActivity(advanceIntent); // go to successScreen
                Finish();                     // finish the activity
            }
            else // if query did not return results
            {
                progressBar.Visibility = ViewStates.Invisible;
                Toast.MakeText(this, "Invalid Recruiter Access Key", ToastLength.Short).Show();
            }
        }
Ejemplo n.º 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.IdentifyUserType); // set the view to IdentifyUserType.axml
            ActionBar.Hide();                                 // hide the action bar

            // Get UI Controls
            Button studentIdentifier   = FindViewById <Button>(Resource.Id.studentIdentify);
            Button recruiterIdentifier = FindViewById <Button>(Resource.Id.recruiterIdentify);
            Button csIdentifier        = FindViewById <Button>(Resource.Id.CSIdentify);

            // SQLite Connection to attributes database
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            var    myAttributes = db_attributes.Get <MyAttributes>(1);
            string myName       = myAttributes.name;
            string myEmail      = myAttributes.email;
            string myPassword   = myAttributes.password;

            // Add Code to buttons
            studentIdentifier.Click += (object sender, EventArgs e) => // anonymous function
            {
                var newStudent = new MyAttributes();
                newStudent.id       = 1;
                newStudent.name     = myName;
                newStudent.email    = myEmail;
                newStudent.password = myPassword;
                newStudent.type     = "Student"; // new data
                db_attributes.InsertOrReplace(newStudent);
                var advanceIntent = new Intent(this, typeof(selectSchool));
                StartActivity(advanceIntent); // go to select school if student selected
                Finish();                     // finish this activity
            };
            recruiterIdentifier.Click += (object sender, EventArgs e) =>
            {
                var newRecruiter = new MyAttributes();
                newRecruiter.id       = 1;
                newRecruiter.name     = myName;
                newRecruiter.email    = myEmail;
                newRecruiter.password = myPassword;
                newRecruiter.type     = "Recruiter"; // new data
                db_attributes.InsertOrReplace(newRecruiter);
                var advanceIntent = new Intent(this, typeof(recruiterBuildProfile));
                StartActivity(advanceIntent); // go to recruiterBuildProfile if recruiter selected
                Finish();                     // finish this activity
            };
            csIdentifier.Click += (object sender, EventArgs e) =>
            {
                var newCS = new MyAttributes();
                newCS.id       = 1;
                newCS.name     = myName;
                newCS.email    = myEmail;
                newCS.password = myPassword;
                newCS.type     = "Career Services"; // new data
                db_attributes.InsertOrReplace(newCS);
                var advanceIntent = new Intent(this, typeof(csBuildProfile));
                StartActivity(advanceIntent); // go to csBuildProfile
                Finish();                     // finish this activity
            };
        }
Ejemplo n.º 16
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.Qrow, null, false);
            }

            string           dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
            SQLiteConnection db_login     = new SQLiteConnection(dbPath_login);

            string           dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes     myAttributes      = db_attributes.Get <MyAttributes>(1);

            string           fileName_pastQs = "pastqs_" + myAttributes.attribute1 + ".db3";
            string           dbPath_pastQs   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_pastQs);
            SQLiteConnection db_pastQs       = new SQLiteConnection(dbPath_pastQs);

            SQLite_Tables.PastQueue thisQueue = db_pastQs.Query <SQLite_Tables.PastQueue>("SELECT * FROM PastQueue WHERE studentid = ?", mItems[position]).First();

            StudentTable thisStudent = db_login.Get <StudentTable>(mItems[position]);

            TextView     candidateName = row.FindViewById <TextView>(Resource.Id.candidateName);
            ImageView    favorite      = row.FindViewById <ImageView>(Resource.Id.favorite);
            LinearLayout candidateRow  = row.FindViewById <LinearLayout>(Resource.Id.candidateRow);

            candidateName.Text = thisStudent.name;

            if (thisQueue.rating == 1)
            {
                favorite.SetImageResource(Resource.Drawable.starfilled);
            }

            else if (thisQueue.rating == 2)
            {
                favorite.SetImageResource(Resource.Drawable.heartfilled);
            }

            candidateRow.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = ((FragmentActivity)mContext).SupportFragmentManager.BeginTransaction();
                Bundle arguments = new Bundle();
                arguments.PutInt("StudentId", mItems[position]);

                arguments.PutString("Sender", mSender);

                Fragments.PastQStudentProfileView fragment = new Fragments.PastQStudentProfileView();
                fragment.Arguments = arguments;

                if (mSender == "Profile")
                {
                    trans.Replace(Resource.Id.profile_root_frame, fragment);
                }
                else if (mSender == "PastQs")
                {
                    trans.Replace(Resource.Id.qs_root_frame, fragment);
                }
                trans.Commit();
            };
            return(row);
        }
Ejemplo n.º 17
0
        private async void ConfirmBtn_Click(object sender, EventArgs e)
        {
            progressBar.Visibility = ViewStates.Visible;
            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);

            myAttributes.cfid = Convert.ToInt32(myCFID);
            db_attributes.Update(myAttributes);

            var firebase  = new FirebaseClient(FirebaseURL);
            var allLogins = await firebase.Child("users").OnceAsync <User>();

            string key = "";

            foreach (var login in allLogins)
            {
                if (login.Object.email == myAttributes.email)
                {
                    key = login.Key;
                }
            }

            User updateUser = new User();

            updateUser.uid      = myAttributes.loginid.ToString();
            updateUser.name     = myAttributes.name;
            updateUser.email    = myAttributes.email;
            updateUser.password = myAttributes.password;
            updateUser.type     = myAttributes.type;
            updateUser.cfid     = myAttributes.cfid.ToString();
            await firebase.Child("users").Child(key).PutAsync(updateUser);

            if (myAttributes.type == "Student")
            {
                string favorites_fileName = "fav_" + myCFID + "_" + myAttributes.typeid.ToString();

                var allCompanies = await firebase.Child("careerfairs").Child(myAttributes.cfid.ToString()).OnceAsync <Company>();

                int numCompanies = allCompanies.Count();
                foreach (var company in allCompanies)
                {
                    Favorite item = new Favorite();
                    item.companyid  = company.Object.companyid;
                    item.name       = company.Object.name;
                    item.isFavorite = false;
                    await firebase.Child("favorites").Child(favorites_fileName).PostAsync(item);
                }

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.register_root_frame, new RegisterFragment());
                trans.Commit();

                viewPager.SetCurrentItem(0, true);
            }

            else if (myAttributes.type == "Recruiter")
            {
                var allCompanies = await firebase.Child("careerfairs").Child(myAttributes.cfid.ToString()).OnceAsync <Company>();

                Company newCompany = new Company();
                string  companyKey = "";

                foreach (var company in allCompanies)
                {
                    if (company.Object.name == myAttributes.attribute1)
                    {
                        companyKey             = company.Key;
                        newCompany.companyid   = company.Object.companyid;
                        newCompany.name        = company.Object.name;
                        newCompany.description = company.Object.description;
                        newCompany.website     = company.Object.website;
                        newCompany.rak         = company.Object.rak;
                        newCompany.checkedIn   = true;
                        newCompany.waittime    = company.Object.waittime;
                        newCompany.numstudents = company.Object.numstudents;
                    }
                }

                await firebase.Child("careerfairs").Child(myAttributes.cfid.ToString()).Child(companyKey).PutAsync(newCompany);

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.register_root_frame, new RegisterFragment());
                trans.Commit();

                viewPager.SetCurrentItem(0, true);
            }
            progressBar.Visibility = ViewStates.Invisible;
        }
Ejemplo n.º 18
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContainer = container;
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);

            string type = myAttributes.type;

            if (type == "Student")
            {
                View     view        = inflater.Inflate(Resource.Layout.StudentProfileTab, container, false);
                TextView name        = view.FindViewById <TextView>(Resource.Id.myName);
                TextView email       = view.FindViewById <TextView>(Resource.Id.myEmail);
                TextView school      = view.FindViewById <TextView>(Resource.Id.myUniversity);
                TextView major       = view.FindViewById <TextView>(Resource.Id.myMajor);
                TextView gpa         = view.FindViewById <TextView>(Resource.Id.myGPA);
                TextView gradterm    = view.FindViewById <TextView>(Resource.Id.myGradterm);
                TextView editProfile = view.FindViewById <TextView>(Resource.Id.editProfile);
                favListView = view.FindViewById <ListView>(Resource.Id.favoritesList);
                progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                name.Text     = myAttributes.name;
                email.Text    = myAttributes.email;
                school.Text   = myAttributes.attribute1;
                gradterm.Text = myAttributes.attribute2;
                major.Text    = myAttributes.attribute3;
                gpa.Text      = myAttributes.attribute4;

                editProfile.Click += EditProfile_Click;

                int myCFID = myAttributes.cfid;
                if (myCFID != 0)
                {
                    PopulateList();
                }

                return(view);
            }

            else if (type == "Recruiter")
            {
                View     view        = inflater.Inflate(Resource.Layout.RecruiterProfileTab, container, false);
                TextView name        = view.FindViewById <TextView>(Resource.Id.myName);
                TextView email       = view.FindViewById <TextView>(Resource.Id.myEmail);
                TextView company     = view.FindViewById <TextView>(Resource.Id.myCompany);
                TextView editProfile = view.FindViewById <TextView>(Resource.Id.editProfile);
                progressBar  = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                lv_favorites = view.FindViewById <ListView>(Resource.Id.favoritesList);

                name.Text    = myAttributes.name;
                email.Text   = myAttributes.email;
                company.Text = myAttributes.attribute1;

                editProfile.Click += EditProfile_Click;

                int myCFID = myAttributes.cfid;

                if (myCFID != 0)
                {
                    PopulateRecruiterList();
                }
                return(view);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 19
0
        private async void CreateUser()
        {
            ProgressBar progressBar = FindViewById <ProgressBar>(Resource.Id.circularProgress);

            progressBar.Visibility = ViewStates.Visible;
            try
            {
                string       dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
                var          db_attributes     = new SQLiteConnection(dbPath_attributes);
                MyAttributes userAttributes    = db_attributes.Get <MyAttributes>(1);

                // Create user object
                User newUser = new User();
                newUser.name     = userAttributes.name;
                newUser.email    = userAttributes.email;
                newUser.password = userAttributes.password;
                newUser.type     = userAttributes.type;
                newUser.cfid     = "0";

                // Query user database for number of users, assign user id
                var firebase = new FirebaseClient(FirebaseURL);
                var items    = await firebase.Child("users").OnceAsync <User>();

                int numUsers = items.Count();
                newUser.uid = (numUsers + 1).ToString();

                userAttributes.loginid = Convert.ToInt32(newUser.uid);
                db_attributes.Update(userAttributes);

                // insert object into user database
                var item = await firebase.Child("users").PostAsync(newUser);

                // create type object
                if (userAttributes.type == "Student")
                {
                    Student newStudent = new Student();
                    newStudent.name     = userAttributes.name;
                    newStudent.email    = userAttributes.email;
                    newStudent.password = userAttributes.password;
                    newStudent.school   = userAttributes.attribute1;
                    newStudent.gradterm = userAttributes.attribute2;
                    newStudent.major    = userAttributes.attribute3;
                    newStudent.gpa      = userAttributes.attribute4;

                    // Query student database for number of students, assign student id
                    var studentItems = await firebase.Child("students").OnceAsync <Student>();

                    int numStudents = studentItems.Count();
                    newStudent.studentid  = (numStudents + 1).ToString();
                    userAttributes.typeid = numStudents + 1;
                    db_attributes.Update(userAttributes);
                    // insert object into student database
                    var studentItem = await firebase.Child("students").PostAsync(newStudent);
                }
                else if (userAttributes.type == "Recruiter")
                {
                    Recruiter newRecruiter = new Recruiter();
                    newRecruiter.name     = userAttributes.name;
                    newRecruiter.email    = userAttributes.email;
                    newRecruiter.password = userAttributes.password;
                    newRecruiter.company  = userAttributes.attribute1;

                    // Query recruiter database for number of students, assign recruiter id
                    var recruiterItems = await firebase.Child("recruiters").OnceAsync <Recruiter>();

                    int numRecruiters = recruiterItems.Count();
                    newRecruiter.recruiterid = (numRecruiters + 1).ToString();
                    userAttributes.typeid    = numRecruiters + 1;
                    db_attributes.Update(userAttributes);
                    // insert object into recruiter database
                    var recruiterItem = await firebase.Child("recruiters").PostAsync(newRecruiter);
                }

                progressBar.Visibility = ViewStates.Invisible;
                var advanceIntent = new Intent(this, typeof(homeScreen2)).PutExtra("UserId", newUser.uid);
                StartActivity(advanceIntent);
                Finish();
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
                progressBar.Visibility = ViewStates.Invisible;
            }
        }
Ejemplo n.º 20
0
        private async void UpdateStudent()
        {
            try
            {
                string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
                var    db_attributes     = new SQLiteConnection(dbPath_attributes);

                MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);

                // Get Login ID
                int id_login = myAttributes.loginid;

                string username  = updateEmail.Text.Split('@')[0];
                string domain    = updateEmail.Text.Split('@')[1];
                string provider  = domain.Split('.')[0];
                string extension = domain.Split('.')[1];

                // Update Login
                User updateLogin = new User();
                updateLogin.uid      = id_login.ToString();
                updateLogin.name     = updateName.Text;
                updateLogin.email    = updateEmail.Text;
                updateLogin.password = myAttributes.password;
                updateLogin.cfid     = myAttributes.cfid.ToString();
                updateLogin.type     = "Student";

                var firebase = new FirebaseClient(FirebaseURL);
                await firebase.Child("users").Child(key).PutAsync(updateLogin);

                // Update Student
                Student updateStudent = new Student();
                updateStudent.studentid = myAttributes.typeid.ToString();
                updateStudent.name      = updateName.Text;
                updateStudent.email     = updateEmail.Text;
                updateStudent.password  = myAttributes.password;
                updateStudent.school    = string.Format("{0}", school.SelectedItem);
                updateStudent.gradterm  = string.Format("{0}", gradterm.SelectedItem);
                updateStudent.major     = string.Format("{0}", major.SelectedItem);
                updateStudent.gpa       = string.Format("{0}", gpa.SelectedItem);

                var allStudents = await firebase.Child("students").OnceAsync <Student>();

                string studentKey = "";

                foreach (var student in allStudents)
                {
                    if (student.Object.email == myAttributes.email)
                    {
                        studentKey = student.Key;
                    }
                }
                await firebase.Child("students").Child(studentKey).PutAsync(updateStudent);

                // Update MyAttributes
                MyAttributes updateMyAttributes = new MyAttributes();
                updateMyAttributes.id         = 1;
                updateMyAttributes.name       = updateStudent.name;
                updateMyAttributes.email      = updateStudent.email;
                updateMyAttributes.password   = updateStudent.password;
                updateMyAttributes.type       = "Student";
                updateMyAttributes.attribute1 = updateStudent.school;
                updateMyAttributes.attribute2 = updateStudent.gradterm;
                updateMyAttributes.attribute3 = updateStudent.major;
                updateMyAttributes.attribute4 = updateStudent.gpa;
                updateMyAttributes.cfid       = Convert.ToInt32(updateLogin.cfid);
                updateMyAttributes.loginid    = myAttributes.loginid;
                updateMyAttributes.typeid     = myAttributes.typeid;
                updateMyAttributes.rememberme = myAttributes.rememberme;

                db_attributes.InsertOrReplace(updateMyAttributes);

                progressBar.Visibility = ViewStates.Invisible;

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.profile_root_frame, new ProfileFragment());
                trans.Commit();
            }
            catch
            {
                progressBar.Visibility = ViewStates.Invisible;
                Toast.MakeText(this.Activity, "Invalid Email Address", ToastLength.Short).Show();
            }
        }
Ejemplo n.º 21
0
        private async void FinishButton_Click(object sender, EventArgs e)
        {
            ProgressBar progressBar = FindViewById <ProgressBar>(Resource.Id.circularProgress);

            progressBar.Visibility = ViewStates.Visible;

            int numExistingLogins = 0;

            try
            {
                var firebase  = new FirebaseClient(FirebaseURL);
                var allLogins = await firebase.Child("users").OnceAsync <User>();

                foreach (var login in allLogins)
                {
                    string email = login.Object.email;
                    if (email == newEmailAddress.Text)
                    {
                        numExistingLogins = numExistingLogins + 1;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
            }

            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            db_attributes.CreateTable <MyAttributes>();

            // Make sure passwords match
            if (newPassword.Text != confirmNewPassword.Text)
            {
                Toast.MakeText(this, "Passwords Do Not Match", ToastLength.Short).Show();
                progressBar.Visibility = ViewStates.Invisible;
            }

            // Make sure all fields are full
            else if (string.IsNullOrWhiteSpace(newName.Text) || string.IsNullOrWhiteSpace(newEmailAddress.Text) || string.IsNullOrWhiteSpace(newPassword.Text) || string.IsNullOrWhiteSpace(confirmNewPassword.Text))
            {
                Toast.MakeText(this, "Please Complete All Fields", ToastLength.Short).Show();
                progressBar.Visibility = ViewStates.Invisible;
            }
            // Make sure email address is not already in use
            else if (numExistingLogins != 0)
            {
                Toast.MakeText(this, "Email is Already in Use", ToastLength.Short).Show();
                progressBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                try // make sure email address is correctly formatted
                {
                    string username  = newEmailAddress.Text.Split('@')[0];
                    string domain    = newEmailAddress.Text.Split('@')[1];
                    string provider  = domain.Split('.')[0];
                    string extension = domain.Split('.')[1];
                    try
                    {
                        // make a myattributes object and populate it
                        MyAttributes tbl = new MyAttributes();
                        tbl.id       = 1;
                        tbl.name     = newName.Text;
                        tbl.email    = newEmailAddress.Text;
                        tbl.password = newPassword.Text;
                        db_attributes.InsertOrReplace(tbl);
                        Toast.MakeText(this, "Success!", ToastLength.Short).Show();
                        progressBar.Visibility = ViewStates.Invisible;
                        var finishIntent = new Intent(this, typeof(IdentifyUserType));
                        StartActivity(finishIntent); // go to identify user type
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show();
                        progressBar.Visibility = ViewStates.Invisible;
                    }
                }
                catch
                {
                    Toast.MakeText(this, "Invalid Email Address", ToastLength.Short).Show();
                    progressBar.Visibility = ViewStates.Invisible;
                }
            }
        }
Ejemplo n.º 22
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);

            string type = myAttributes.type;

            if (type == "Student")
            {
                View view = inflater.Inflate(Resource.Layout.StudentEditProfileTab, container, false);
                updateName  = view.FindViewById <EditText>(Resource.Id.updateName);
                updateEmail = view.FindViewById <EditText>(Resource.Id.updateEmail);

                progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                school      = view.FindViewById <Spinner>(Resource.Id.updateSchool);
                major       = view.FindViewById <Spinner>(Resource.Id.updateMajor);
                gpa         = view.FindViewById <Spinner>(Resource.Id.updateGPA);
                gradterm    = view.FindViewById <Spinner>(Resource.Id.updateGradTerm);
                Button confirmChanges = view.FindViewById <Button>(Resource.Id.saveChangesEditProfile);
                Button cancel         = view.FindViewById <Button>(Resource.Id.cancelEditProfile);

                updateName.Text  = myAttributes.name;
                updateEmail.Text = myAttributes.email;

                confirmChanges.Click += ConfirmChanges_Click;
                cancel.Click         += Cancel_Click;

                school.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(school_ItemSelected);
                var schooladapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.school_array, Android.Resource.Layout.SimpleSpinnerItem);
                schooladapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                school.Adapter = schooladapter;
                string defaultSchool = myAttributes.attribute1;

                if (!defaultSchool.Equals(null))
                {
                    int spinnerPosition = schooladapter.GetPosition(defaultSchool);
                    school.SetSelection(spinnerPosition);
                }

                major.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(major_ItemSelected);
                var majoradapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.major_array, Android.Resource.Layout.SimpleSpinnerItem);
                majoradapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                major.Adapter = majoradapter;
                string defaultMajor = myAttributes.attribute3;

                if (!defaultMajor.Equals(null))
                {
                    int spinnerPosition = majoradapter.GetPosition(defaultMajor);
                    major.SetSelection(spinnerPosition);
                }

                gpa.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(gpa_ItemSelected);
                var gpaadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.gpa_array, Android.Resource.Layout.SimpleSpinnerItem);
                gpaadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                gpa.Adapter = gpaadapter;
                string defaultGPA = myAttributes.attribute4;

                if (!defaultGPA.Equals(null))
                {
                    int spinnerPosition = gpaadapter.GetPosition(defaultGPA);
                    gpa.SetSelection(spinnerPosition);
                }

                gradterm.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(gradterm_ItemSelected);
                var gradtermadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.year_array, Android.Resource.Layout.SimpleSpinnerItem);
                gradtermadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                gradterm.Adapter = gradtermadapter;
                string defaultGradTerm = myAttributes.attribute2;

                if (!defaultGradTerm.Equals(null))
                {
                    int spinnerPosition = gradtermadapter.GetPosition(defaultGradTerm);
                    gradterm.SetSelection(spinnerPosition);
                }

                return(view);
            }

            else if (type == "Recruiter")
            {
                View view = inflater.Inflate(Resource.Layout.RecruiterEditProfileTab, container, false);
                updateName  = view.FindViewById <EditText>(Resource.Id.updateName);
                updateEmail = view.FindViewById <EditText>(Resource.Id.updateEmail);
                company     = view.FindViewById <Spinner>(Resource.Id.updateMyCompany);
                rakField    = view.FindViewById <EditText>(Resource.Id.rak);
                progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                Button confirmChanges = view.FindViewById <Button>(Resource.Id.saveChangesEditProfile);
                Button cancel         = view.FindViewById <Button>(Resource.Id.cancelEditProfile);

                updateName.Text  = myAttributes.name;
                updateEmail.Text = myAttributes.email;

                confirmChanges.Click += ConfirmChanges_Click;
                cancel.Click         += Cancel_Click;

                company.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(company_ItemSelected);
                var companyadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.company_array, Android.Resource.Layout.SimpleSpinnerItem);
                companyadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                company.Adapter = companyadapter;
                string defaultCompany = myAttributes.attribute1;

                if (!defaultCompany.Equals(null))
                {
                    int spinnerPosition = companyadapter.GetPosition(defaultCompany);
                    company.SetSelection(spinnerPosition);
                }

                return(view);
            }

            else
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 23
0
        private void SaveChanges_Click(object sender, EventArgs e)
        {
            string       dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var          db_attributes     = new SQLiteConnection(dbPath_attributes);
            MyAttributes myAttributes      = db_attributes.Get <MyAttributes>(1);
            int          myCFID            = myAttributes.cfid;

            string mPreferences_fileName = "mp_" + myCFID.ToString() + "_" + myAttributes.attribute1 + ".db3";
            string dbPath_mPreferences   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), mPreferences_fileName);
            var    db_mPreferences       = new SQLiteConnection(dbPath_mPreferences);

            if (isHMAll == true)
            {
                db_mPreferences.DeleteAll <SQLite_Tables.MajorPreferences>();
            }
            else
            {
                db_mPreferences.DeleteAll <SQLite_Tables.MajorPreferences>();
                if (numMPs >= 1)
                {
                    SQLite_Tables.MajorPreferences majorPrefs1 = new SQLite_Tables.MajorPreferences();
                    majorPrefs1.id    = 1;
                    majorPrefs1.major = hmspinner1.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(majorPrefs1);
                }
                if (numMPs >= 2)
                {
                    SQLite_Tables.MajorPreferences majorPrefs2 = new SQLite_Tables.MajorPreferences();
                    majorPrefs2.id    = 2;
                    majorPrefs2.major = hmspinner2.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(majorPrefs2);
                }
                if (numMPs >= 3)
                {
                    SQLite_Tables.MajorPreferences majorPrefs3 = new SQLite_Tables.MajorPreferences();
                    majorPrefs3.id    = 3;
                    majorPrefs3.major = hmspinner3.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(majorPrefs3);
                }
                if (numMPs >= 4)
                {
                    SQLite_Tables.MajorPreferences majorPrefs4 = new SQLite_Tables.MajorPreferences();
                    majorPrefs4.id    = 4;
                    majorPrefs4.major = hmspinner4.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(majorPrefs4);
                }
                if (numMPs >= 5)
                {
                    SQLite_Tables.MajorPreferences majorPrefs5 = new SQLite_Tables.MajorPreferences();
                    majorPrefs5.id    = 5;
                    majorPrefs5.major = hmspinner5.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(majorPrefs5);
                }
            }
            if (isHGTAll == true)
            {
                db_mPreferences.DeleteAll <SQLite_Tables.GradTermPreferences>();
            }
            else
            {
                db_mPreferences.DeleteAll <SQLite_Tables.GradTermPreferences>();
                if (numGTPs >= 1)
                {
                    SQLite_Tables.GradTermPreferences gradtermPrefs1 = new SQLite_Tables.GradTermPreferences();
                    gradtermPrefs1.id       = 1;
                    gradtermPrefs1.gradterm = hgtspinner1.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(gradtermPrefs1);
                }
                if (numGTPs >= 2)
                {
                    SQLite_Tables.GradTermPreferences gradtermPrefs2 = new SQLite_Tables.GradTermPreferences();
                    gradtermPrefs2.id       = 2;
                    gradtermPrefs2.gradterm = hgtspinner2.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(gradtermPrefs2);
                }
                if (numGTPs >= 3)
                {
                    SQLite_Tables.GradTermPreferences gradtermPrefs3 = new SQLite_Tables.GradTermPreferences();
                    gradtermPrefs3.id       = 3;
                    gradtermPrefs3.gradterm = hgtspinner3.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(gradtermPrefs3);
                }
            }
            if (isMinGPANone == true)
            {
                db_mPreferences.DeleteAll <SQLite_Tables.GPAPreferences>();
            }
            else
            {
                db_mPreferences.DeleteAll <SQLite_Tables.GPAPreferences>();
                if (numGPAs == 1)
                {
                    SQLite_Tables.GPAPreferences gpaPrefs = new SQLite_Tables.GPAPreferences();
                    gpaPrefs.id  = 1;
                    gpaPrefs.gpa = minGPAspinner.SelectedItem.ToString();

                    db_mPreferences.InsertOrReplace(gpaPrefs);
                }
            }
            Toast.MakeText(this.Activity, "Changes Saved", ToastLength.Short).Show();
        }
Ejemplo n.º 24
0
        private async void LoginButton_Click(object sender, EventArgs e) // login button click event
        {
            ProgressBar progressBar = FindViewById <ProgressBar>(Resource.Id.circularProgress);

            progressBar.Visibility = ViewStates.Visible;

            string           dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);

            var firebase  = new FirebaseClient(FirebaseURL);
            var allLogins = await firebase.Child("users").OnceAsync <User>();

            int numLogins = allLogins.Count();

            if (allLogins.Count() == 0)                                                         // if there are no rows in the data table
            {
                Toast.MakeText(this, "Username or Password Invalid", ToastLength.Short).Show(); // display invalid
                progressBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                try
                {
                    // query our data
                    bool   loginExists = false;
                    string uid         = "0";
                    string name        = "";
                    string email       = "";
                    string password    = "";
                    string type        = "";
                    string attribute1  = "";
                    string attribute2  = "";
                    string attribute3  = "";
                    string attribute4  = "";
                    int    cfid        = 0;
                    int    typeid      = 0;

                    foreach (var login in allLogins)
                    {
                        email    = login.Object.email;
                        password = login.Object.password;
                        if (tfEmail.Text == email && tfPassword.Text == password)
                        {
                            loginExists = true;
                            uid         = login.Object.uid;
                            name        = login.Object.name;
                            type        = login.Object.type;
                            cfid        = Convert.ToInt32(login.Object.cfid);
                            break;
                        }
                    }

                    if (loginExists == true)
                    {
                        if (type == "Student")
                        {
                            var allStudents = await firebase.Child("students").OnceAsync <Student>();

                            foreach (var student in allStudents)
                            {
                                if (student.Object.email == email)
                                {
                                    attribute1 = student.Object.school;
                                    attribute2 = student.Object.gradterm;
                                    attribute3 = student.Object.major;
                                    attribute4 = student.Object.gpa;
                                    typeid     = Convert.ToInt32(student.Object.studentid);
                                    break;
                                }
                            }
                        }
                        else if (type == "Recruiter")
                        {
                            var allRecruiters = await firebase.Child("recruiters").OnceAsync <Recruiter>();

                            foreach (var recruiter in allRecruiters)
                            {
                                if (recruiter.Object.email == email)
                                {
                                    attribute1 = recruiter.Object.company;
                                    attribute2 = "";
                                    attribute3 = "";
                                    attribute4 = "";
                                    typeid     = Convert.ToInt32(recruiter.Object.recruiterid);
                                }
                            }
                        }

                        MyAttributes newAttributes = new MyAttributes();
                        newAttributes.id         = 1;
                        newAttributes.name       = name;
                        newAttributes.email      = email;
                        newAttributes.password   = password;
                        newAttributes.type       = type;
                        newAttributes.attribute1 = attribute1;
                        newAttributes.attribute2 = attribute2;
                        newAttributes.attribute3 = attribute3;
                        newAttributes.attribute4 = attribute4;
                        newAttributes.cfid       = cfid;
                        newAttributes.loginid    = Convert.ToInt32(uid);
                        newAttributes.typeid     = Convert.ToInt32(typeid);
                        newAttributes.rememberme = shouldRemember;

                        db_attributes.InsertOrReplace(newAttributes);
                        //LoginTable myAttributes = queryResults.First();

                        Toast.MakeText(this, "Login Successful!", ToastLength.Short).Show();             // show login successful
                        progressBar.Visibility = ViewStates.Invisible;
                        var loginIntent = new Intent(this, typeof(homeScreen2)).PutExtra("UserId", uid); // advance to home screen, send my id
                        StartActivity(loginIntent);                                                      // start activity using intent
                        Finish();
                    }
                    else
                    {
                        Toast.MakeText(this, "Username or Password Invalid", ToastLength.Short).Show();
                        progressBar.Visibility = ViewStates.Invisible;
                    }
                }
                catch
                {
                    Toast.MakeText(this, "Username or Password Invalid", ToastLength.Short).Show(); // otherwise display text that says username or password invalid
                    progressBar.Visibility = ViewStates.Invisible;
                }
            }
        }
Ejemplo n.º 25
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContainer = container;
            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);
            int myCFID = myAttributes.cfid;

            if (myCFID == 0) // If not registered for a career fair
            {
                View view = inflater.Inflate(Resource.Layout.GoToRegister, container, false);
                return(view);
            }

            else
            {
                if (myAttributes.type == "Student")
                {
                    // Inflate View
                    View view = inflater.Inflate(Resource.Layout.HomeTab, container, false);

                    // Call UI Elements
                    mListView      = view.FindViewById <ListView>(Resource.Id.listView1);
                    cfName         = view.FindViewById <TextView>(Resource.Id.cfName);
                    progressBar    = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                    magGlass       = view.FindViewById <ImageView>(Resource.Id.magGlass);
                    mSearchField   = view.FindViewById <EditText>(Resource.Id.searchCompanies);
                    rootLayout     = view.FindViewById <LinearLayout>(Resource.Id.rootLayout);
                    swipeContainer = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeLayout);

                    magGlass.Enabled = false;

                    mItems = new List <string>();

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                    LoadCF(true);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                    bool searchFieldVisible = false;
                    magGlass.Click += (sender, e) =>
                    {
                        if (searchFieldVisible == false)
                        {
                            mSearchField.Visibility = ViewStates.Visible;
                            cfName.Visibility       = ViewStates.Invisible;
                            searchFieldVisible      = true;
                            rootLayout.ClearFocus();
                            mSearchField.RequestFocus();
                            InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                            imm.ShowSoftInput(mSearchField, 0);
                        }
                        else if (searchFieldVisible == true)
                        {
                            InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                            imm.HideSoftInputFromWindow(mSearchField.WindowToken, 0);
                            rootLayout.RequestFocus();
                            mSearchField.Visibility = ViewStates.Invisible;
                            mSearchField.RequestFocus();
                            cfName.Visibility  = ViewStates.Visible;
                            searchFieldVisible = false;
                            mAdapter           = new CompaniesListViewAdapter(mContainer.Context, mItems, mFavList, mWaitTimes, mNumStudents, mCompanyIds);
                            mListView.Adapter  = mAdapter;
                        }
                    };

                    mSearchField.TextChanged += MSearchField_TextChanged;
                    swipeContainer.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight,
                                                           Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
                    swipeContainer.Refresh += RefreshOnSwipe;

                    return(view);
                }
                else if (myAttributes.type == "Recruiter")
                {
                    View view = inflater.Inflate(Resource.Layout.RecruiterHomeTab, container, false);

                    progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                    HMAllRadio    = view.FindViewById <Button>(Resource.Id.HMAllRadio);
                    HGTAllRadio   = view.FindViewById <Button>(Resource.Id.HGTAllRadio);
                    HGPANoneRadio = view.FindViewById <Button>(Resource.Id.HGPANoneRadio);
                    plus_major    = view.FindViewById <Button>(Resource.Id.plus_majors);
                    hmspinner1    = view.FindViewById <Spinner>(Resource.Id.hmspinner1);
                    hmspinner2    = view.FindViewById <Spinner>(Resource.Id.hmspinner2);
                    hmspinner3    = view.FindViewById <Spinner>(Resource.Id.hmspinner3);
                    hmspinner4    = view.FindViewById <Spinner>(Resource.Id.hmspinner4);
                    hmspinner5    = view.FindViewById <Spinner>(Resource.Id.hmspinner5);
                    minus_major   = view.FindViewById <Button>(Resource.Id.minus_majors);

                    hgtspinner1 = view.FindViewById <Spinner>(Resource.Id.hgtspinner1);
                    hgtspinner2 = view.FindViewById <Spinner>(Resource.Id.hgtspinner2);
                    hgtspinner3 = view.FindViewById <Spinner>(Resource.Id.hgtspinner3);
                    plus_gt     = view.FindViewById <Button>(Resource.Id.plus_gt);
                    minus_gt    = view.FindViewById <Button>(Resource.Id.minus_gradterms);

                    minGPAspinner = view.FindViewById <Spinner>(Resource.Id.minGPAspinner);

                    Button saveChanges = view.FindViewById <Button>(Resource.Id.saveChangesButton);
                    cfName = view.FindViewById <TextView>(Resource.Id.cfName);
                    TextView             HMAllText      = view.FindViewById <TextView>(Resource.Id.HMAllText);
                    TextView             HGTAllText     = view.FindViewById <TextView>(Resource.Id.HGTAllText);
                    TextView             MinGPANoneText = view.FindViewById <TextView>(Resource.Id.MinGPANoneText);
                    Android.Widget.Space plus1extender  = view.FindViewById <Android.Widget.Space>(Resource.Id.plusspace1);
                    Android.Widget.Space plus2extender  = view.FindViewById <Android.Widget.Space>(Resource.Id.plusspace2);

                    // Change name to my CF name
                    PopulateName();

                    // Click methods
                    HMAllRadio.Click     += HMAllRadio_Click;
                    HMAllText.Click      += HMAllRadio_Click;
                    HGTAllRadio.Click    += HGTAllRadio_Click;
                    HGTAllText.Click     += HGTAllRadio_Click;
                    HGPANoneRadio.Click  += HGPANoneRadio_Click;
                    MinGPANoneText.Click += HGPANoneRadio_Click;
                    saveChanges.Click    += SaveChanges_Click;

                    // connect to firebase preferences database
                    PopulatePreferences();

                    // On plus major click
                    plus_major.Click    += Plus_major_Click;
                    plus1extender.Click += Plus_major_Click;

                    // On plus gt click
                    plus_gt.Click       += Plus_gt_Click;
                    plus2extender.Click += Plus_gt_Click;

                    // on minus major click
                    minus_major.Click += (sender, e) =>
                    {
                        numMPs = numMPs - 1;
                        if (numMPs == 1)
                        {
                            hmspinner2.Visibility  = ViewStates.Gone;
                            minus_major.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 2)
                        {
                            hmspinner3.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 3)
                        {
                            hmspinner4.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 4)
                        {
                            hmspinner5.Visibility = ViewStates.Gone;
                        }
                    };
                    // on minus grad term click
                    minus_gt.Click += (sender, e) =>
                    {
                        numGTPs = numGTPs - 1;
                        if (numGTPs == 1)
                        {
                            hgtspinner2.Visibility = ViewStates.Gone;
                            minus_gt.Visibility    = ViewStates.Gone;
                        }
                        else if (numGTPs == 2)
                        {
                            hgtspinner3.Visibility = ViewStates.Gone;
                        }
                    };

                    return(view);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }