Пример #1
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();
            }
        }
Пример #2
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);
        }