Exemple #1
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");
            SQLiteConnection db_attributes     = new SQLiteConnection(dbPath_attributes);

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

            View      view       = inflater.Inflate(Resource.Layout.PastQs, 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();
            };

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

            PopulateList();

            return(view);
        }
Exemple #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContainer = container;
            View view = inflater.Inflate(Resource.Layout.StudentQsPresent, container, false);

            progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
            mListView   = view.FindViewById <ListView>(Resource.Id.myQsListView);
            ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton);

            swipeContainer    = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeLayout);
            backButton.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.qs_root_frame, new Fragments.CurrentPastQs());
                trans.Commit();
            };

            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);

            PopulateList();

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

            return(view);
        }
Exemple #3
0
        private void Confirmq_Click(object sender, EventArgs e)
        {
            MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1);
            Companies    thisCompany  = db_myCF.Get <Companies>(companyInt);

            string           fileName_Q = "qs_" + myAttributes.cfid.ToString() + "_" + thisCompany.name + ".db3";
            string           dbPath_Q   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_Q);
            SQLiteConnection db_Q       = new SQLiteConnection(dbPath_Q);

            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>();

            try
            {
                var queryResults = db_Q.Query <SQLite_Tables.Queue>("SELECT * FROM Queue WHERE studentid = ?", myAttributes.typeid);
                if (queryResults.Count != 0)
                {
                    Toast.MakeText(this.Activity, "You are already onQ with this company", ToastLength.Short).Show();
                }
                else
                {
                    int numQs = db_Q.Table <SQLite_Tables.Queue>().Count();

                    SQLite_Tables.Queue newQ = new SQLite_Tables.Queue();
                    newQ.id        = numQs + 1;
                    newQ.studentid = myAttributes.typeid;

                    db_Q.Insert(newQ);

                    SQLite_Tables.MyQueue myQ = new SQLite_Tables.MyQueue();
                    int numMyQs = db_myQs.Table <SQLite_Tables.MyQueue>().Count();
                    myQ.id       = numMyQs + 1;
                    myQ.company  = thisCompany.name;
                    myQ.position = newQ.id;

                    db_myQs.Insert(myQ);

                    Toast.MakeText(this.Activity, "You are onQ in Position " + (numQs + 1).ToString() + "!", ToastLength.Short).Show();

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

                    Android.Support.V4.App.FragmentTransaction trans2 = FragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.qs_root_frame, new QsFragment());
                    trans2.Commit();

                    viewPager.SetCurrentItem(1, true);
                }
            }
            catch
            {
                Toast.MakeText(this.Activity, "No Recruiters have checked in with this company yet...", ToastLength.Short).Show();
                //this.Activity.DeleteDatabase(dbPath_Q);
            }
        }
Exemple #4
0
        private void LogOutButton_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);

            myAttributes.rememberme = false;

            db_attributes.Update(myAttributes);

            Intent logOutIntent = new Intent(Activity, typeof(LoginSignup));

            StartActivity(logOutIntent);
            Activity.Finish();
        }
Exemple #5
0
        private void BuildMyAttributes()
        {
            MyAttributes = (from a in AttributesToSplat()
                            select new KeyValuePair <string, object>(a.Key, a.Value))
                           .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            if (HasTitle)
            {
                MyAttributes.Add("aria-labelledby", titleId);
            }

            if (HasBody)
            {
                MyAttributes.Add("aria-describedby", bodyId);
            }
        }
Exemple #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 = 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")
                {
                    GetRecruiterView();
                    // in the meantime
                    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")
                {
                    GetStudentView();
                    // in the meantime
                    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();
                }
            }
        }
Exemple #7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            view = inflater.Inflate(Resource.Layout.SettingsTab, container, false);

            Button logOutButton = view.FindViewById <Button>(Resource.Id.logOutButton);
            Button devTools     = view.FindViewById <Button>(Resource.Id.devToolsButton);

            logOutButton.Click += LogOutButton_Click;

            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.email == "*****@*****.**")
            {
                devTools.Visibility = ViewStates.Visible;
            }

            devTools.Click += DevTools_Click;
            return(view);
        }
Exemple #8
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.ConfirmQ, container, false);

            viewPager = Activity.FindViewById <ViewPager>(Resource.Id.viewpager);
            string dbpath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");

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

            string myCFID = myAttributes.cfid.ToString();

            string dbpath_myCF = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myCFID + ".db3");

            db_myCF = new SQLiteConnection(dbpath_myCF);

            Companies thisCompany = db_myCF.Get <Companies>(companyInt);

            TextView companyName = view.FindViewById <TextView>(Resource.Id.companyName);

            companyName.Text = thisCompany.name + "?";

            ImageView companyLogo = view.FindViewById <ImageView>(Resource.Id.companyLogo);
            string    imageName   = thisCompany.name.ToLower().Replace(" ", "");
            int       resourceId  = (int)typeof(Resource.Drawable).GetField(imageName).GetValue(null);

            companyLogo.SetImageResource(resourceId);

            Button cancelq  = view.FindViewById <Button>(Resource.Id.cancelqbutton);
            Button confirmq = view.FindViewById <Button>(Resource.Id.confirmqbutton);

            cancelq.Click += Cancelq_Click;

            confirmq.Click += Confirmq_Click;
            return(view);
        }
Exemple #9
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.ConfirmQ, container, false);

            progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
            viewPager   = Activity.FindViewById <ViewPager>(Resource.Id.viewpager);
            companyName = view.FindViewById <TextView>(Resource.Id.companyName);
            companyLogo = view.FindViewById <ImageView>(Resource.Id.companyLogo);
            Button cancelq  = view.FindViewById <Button>(Resource.Id.cancelqbutton);
            Button confirmq = view.FindViewById <Button>(Resource.Id.confirmqbutton);

            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);

            LoadCompanyInfo();

            cancelq.Click += Cancelq_Click;

            confirmq.Click += Confirmq_Click;

            return(view);
        }
Exemple #10
0
 public override void recalcAllStats(int level)
 {
     MyAttributes.calculate(level, roll);
 }
Exemple #11
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            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 = ?", studentid).First();

            StudentTable thisStudent = db_login.Get <StudentTable>(studentid);

            view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false);

            TextView     candidateName  = view.FindViewById <TextView>(Resource.Id.candidateName);
            TextView     candidateEmail = view.FindViewById <TextView>(Resource.Id.candidateEmail);
            TextView     school         = view.FindViewById <TextView>(Resource.Id.schoolText);
            TextView     major          = view.FindViewById <TextView>(Resource.Id.majorText);
            TextView     gradterm       = view.FindViewById <TextView>(Resource.Id.gradtermText);
            TextView     gpa            = view.FindViewById <TextView>(Resource.Id.gpaText);
            EditText     notes          = view.FindViewById <EditText>(Resource.Id.notes);
            ImageView    star           = view.FindViewById <ImageView>(Resource.Id.star);
            ImageView    heart          = view.FindViewById <ImageView>(Resource.Id.heart);
            Button       nextButton     = view.FindViewById <Button>(Resource.Id.nextButton);
            ImageView    backButton     = view.FindViewById <ImageView>(Resource.Id.backButton);
            Button       hideKeyboard   = view.FindViewById <Button>(Resource.Id.hideKeyboard);
            LinearLayout rootLayout     = view.FindViewById <LinearLayout>(Resource.Id.rootLayout);

            hideKeyboard.Visibility = ViewStates.Invisible;
            hideKeyboard.Click     += (sender, e) =>
            {
                InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(notes.WindowToken, 0);
                rootLayout.RequestFocus();
                hideKeyboard.Visibility = ViewStates.Invisible;
            };
            notes.FocusChange += (sender, e) =>
            {
                hideKeyboard.Visibility = ViewStates.Visible;
            };

            candidateName.Text  = thisStudent.name;
            candidateEmail.Text = thisStudent.email;
            school.Text         = thisStudent.school;
            major.Text          = thisStudent.major;
            gradterm.Text       = thisStudent.gradterm;
            gpa.Text            = thisStudent.gpa;
            notes.Text          = thisQueue.notes;

            int newRating = thisQueue.rating;

            if (thisQueue.rating == 1)
            {
                star.SetImageResource(Resource.Drawable.starfilled);
            }
            else if (thisQueue.rating == 2)
            {
                heart.SetImageResource(Resource.Drawable.heartfilled);
            }

            nextButton.Visibility = ViewStates.Gone;

            heart.Click += (sender, e) =>
            {
                if (newRating == 2)
                {
                    heart.SetImageResource(Resource.Drawable.heartunfilled);
                    newRating = 0;
                }
                else
                {
                    heart.SetImageResource(Resource.Drawable.heartfilled);
                    star.SetImageResource(Resource.Drawable.starunfilled);
                    newRating = 2;
                }
            };
            star.Click += (sender, e) =>
            {
                if (newRating == 1)
                {
                    star.SetImageResource(Resource.Drawable.starunfilled);
                    newRating = 0;
                }
                else
                {
                    star.SetImageResource(Resource.Drawable.starfilled);
                    heart.SetImageResource(Resource.Drawable.heartunfilled);
                    newRating = 1;
                }
            };

            backButton.Click += (sender, e) =>
            {
                SQLite_Tables.PastQueue newQueue = new SQLite_Tables.PastQueue();
                newQueue.id        = thisQueue.id;
                newQueue.studentid = thisQueue.studentid;
                newQueue.rating    = newRating;
                newQueue.notes     = notes.Text;

                db_pastQs.InsertOrReplace(newQueue);

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                if (source == "Profile")
                {
                    trans.Replace(Resource.Id.profile_root_frame, new ProfileFragment());
                }
                else if (source == "PastQs")
                {
                    trans.Replace(Resource.Id.qs_root_frame, new PastQs());
                }
                //trans.Replace(Resource.Id.qs_root_frame, new PastQs());
                trans.Commit();
            };
            return(view);
        }
Exemple #12
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);

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

            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")
                {
                    string     myCompanyPastQsFilename = "pastqs_" + myAttributes.attribute1 + ".db3";
                    string     dbPath_pastqs           = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myCompanyPastQsFilename);
                    var        db_pastqs  = new SQLiteConnection(dbPath_pastqs);
                    List <int> studentIDs = new List <int>();
                    int        numpastqs  = db_pastqs.Table <SQLite_Tables.PastQueue>().Count();

                    //Toast.MakeText(this.Activity, numpastqs.ToString(), ToastLength.Short).Show();
                    //view = inflater.Inflate(Resource.Layout.MyQsTab, container, false);
                    //return view;

                    if (numpastqs == 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.PastQs, 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();
                        };

                        ListView lv_pastqs = view.FindViewById <ListView>(Resource.Id.pastqslv);
                        for (int i = 1; i <= numpastqs; i++)
                        {
                            int newStudentID = db_pastqs.Get <SQLite_Tables.PastQueue>(i).studentid;
                            studentIDs.Add(newStudentID);
                        }

                        PastQueuesListViewAdapter adapter = new PastQueuesListViewAdapter(container.Context, studentIDs, "PastQs");
                        lv_pastqs.Adapter = adapter;

                        return(view);
                    }
                }
                else if (myAttributes.type == "Student")
                {
                    string           myPastQsFileName = "pastqs_" + myAttributes.loginid.ToString() + ".db3";
                    string           dbPath_myPastQs  = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), myPastQsFileName);
                    SQLiteConnection db_myPastQs      = new SQLiteConnection(dbPath_myPastQs);
                    db_myPastQs.CreateTable <SQLite_Tables.MyPastQueue>();

                    List <string> companies = new List <string>();
                    int           numpastqs = db_myPastQs.Table <SQLite_Tables.MyPastQueue>().Count();

                    if (numpastqs == 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.PastQs, 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();
                        };

                        ListView lv_pastqs = view.FindViewById <ListView>(Resource.Id.pastqslv);
                        for (int i = 1; i <= numpastqs; i++)
                        {
                            string newCompany = db_myPastQs.Get <SQLite_Tables.MyPastQueue>(i).company;
                            companies.Add(newCompany);
                        }
                        QsListViewAdapter adapter = new QsListViewAdapter(container.Context, companies, "PastQs");
                        lv_pastqs.Adapter = adapter;

                        return(view);
                    }
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }
        private async void NextButton_Click(object sender, EventArgs e)
        {
            progressBar.Visibility = ViewStates.Visible;
            stopwatch.Stop();

            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);

            var firebase = new FirebaseClient(FirebaseURL);

            // move q to student's past qs, and move student to company pastqs
            string fileName_companyPastQs = "pastqs_" + myAttributes.attribute1;
            string fileName_studentPastQs = "pastqs_" + student_id.ToString();
            string fileName_careerFair    = myAttributes.cfid.ToString();

            StudentQ pastStudentQ = new StudentQ();

            pastStudentQ.company = myAttributes.attribute1;

            PastQ pastCompanyQ = new PastQ();

            pastCompanyQ.name      = candidateName.Text;
            pastCompanyQ.studentid = student_id.ToString();
            pastCompanyQ.notes     = notes.Text;
            pastCompanyQ.rating    = rating.ToString();
            pastCompanyQ.time      = stopwatch.ElapsedTicks.ToString();

            // check to see if student is already in past q's
            var companyPastQs = await firebase.Child("pastqs").Child(fileName_companyPastQs).OnceAsync <PastQ>();

            bool studentExists = false;

            List <string> times = new List <string>();

            foreach (var pastq in companyPastQs)
            {
                if (pastq.Object.studentid == student_id.ToString())
                {
                    studentExists = true;
                    break;
                }
                times.Add(pastq.Object.time);
            }

            times.Add(stopwatch.ElapsedTicks.ToString());

            if (studentExists == false)
            {
                await firebase.Child("pastqs").Child(fileName_companyPastQs).PostAsync(pastCompanyQ);

                await firebase.Child("pastqs").Child(fileName_studentPastQs).PostAsync(pastStudentQ);
            }

            // remove student from q, and remove q from student's current qs
            string fileName_companyQ = "qs_" + myAttributes.cfid.ToString() + "_" + myAttributes.attribute1;
            string fileName_studentQ = "myqs_" + myAttributes.cfid.ToString() + "_" + student_id;

            var companyQ = await firebase.Child("qs").Child(fileName_companyQ).OnceAsync <Queue>();

            var studentQ = await firebase.Child("qs").Child(fileName_studentQ).OnceAsync <StudentQ>();

            int numStudentsInQ = companyQ.Count;

            string key1 = "";

            foreach (var q in companyQ)
            {
                if (q.Object.position != "1")
                {
                    Queue newQ       = new Queue();
                    int   currentPos = Convert.ToInt32(q.Object.position);
                    int   newPos     = currentPos - 1;
                    newQ.position    = newPos.ToString();
                    newQ.studentid   = q.Object.studentid;
                    newQ.studentname = q.Object.studentname;
                    string thisKey = q.Key;

                    await firebase.Child("qs").Child(fileName_companyQ).Child(thisKey).PutAsync(newQ);

                    string fileName_thisStudentQ = "myqs_" + myAttributes.cfid.ToString() + "_" + q.Object.studentid;

                    var thisStudentQ = await firebase.Child("qs").Child(fileName_thisStudentQ).OnceAsync <StudentQ>();

                    foreach (var p in thisStudentQ)
                    {
                        if (p.Object.company == myAttributes.attribute1)
                        {
                            string   companyKey  = p.Key;
                            StudentQ newStudentQ = new StudentQ();
                            newStudentQ.position = newPos.ToString();
                            newStudentQ.company  = myAttributes.attribute1;
                            await firebase.Child("qs").Child(fileName_thisStudentQ).Child(companyKey).PutAsync(newStudentQ);
                        }
                    }
                }
                else
                {
                    key1 = q.Key;
                    await firebase.Child("qs").Child(fileName_companyQ).Child(key1).DeleteAsync();
                }
            }

            foreach (var q in studentQ)
            {
                if (q.Object.company == myAttributes.attribute1)
                {
                    string thisKey = q.Key;
                    await firebase.Child("qs").Child(fileName_studentQ).Child(thisKey).DeleteAsync();
                }
            }

            // Calculate average time, and update value in database
            long fiveMinsInTicks = 3000000000;
            long numTimes        = times.Count;
            long fiveMinsWeight  = 10;
            long otherWeight     = 100 - fiveMinsWeight;
            long indWeight       = otherWeight / numTimes;

            long sum = (fiveMinsInTicks * fiveMinsWeight) / 100;

            foreach (var time in times)
            {
                long timeContribution = (indWeight * Convert.ToInt64(time)) / 100;
                sum = sum + timeContribution;
            }

            var thisCareerFair = await firebase.Child("careerfairs").Child(fileName_careerFair).OnceAsync <Company>();

            Company newCompanyInfo = new Company();
            string  thisCompanyKey = "";

            foreach (var company in thisCareerFair)
            {
                if (company.Object.name == myAttributes.attribute1)
                {
                    thisCompanyKey             = company.Key;
                    newCompanyInfo.companyid   = company.Object.companyid;
                    newCompanyInfo.name        = company.Object.name;
                    newCompanyInfo.description = company.Object.description;
                    newCompanyInfo.website     = company.Object.website;
                    newCompanyInfo.rak         = company.Object.rak;
                    newCompanyInfo.checkedIn   = company.Object.checkedIn;
                    newCompanyInfo.waittime    = sum.ToString();
                    newCompanyInfo.numstudents = (numStudentsInQ - 1).ToString();
                }
            }

            await firebase.Child("careerfairs").Child(fileName_careerFair).Child(thisCompanyKey).PutAsync(newCompanyInfo);

            progressBar.Visibility = ViewStates.Invisible;
            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
            trans.Replace(Resource.Id.qs_root_frame, new QsFragment());
            trans.Commit();
        }
Exemple #14
0
 public override void CreateAttributes()
 {
     m_attributes = new MyAttributes(this);
 }
Exemple #15
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);

            view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false);

            candidateName  = view.FindViewById <TextView>(Resource.Id.candidateName);
            candidateEmail = view.FindViewById <TextView>(Resource.Id.candidateEmail);
            school         = view.FindViewById <TextView>(Resource.Id.schoolText);
            major          = view.FindViewById <TextView>(Resource.Id.majorText);
            gradterm       = view.FindViewById <TextView>(Resource.Id.gradtermText);
            gpa            = view.FindViewById <TextView>(Resource.Id.gpaText);
            notes          = view.FindViewById <EditText>(Resource.Id.notes);
            star           = view.FindViewById <ImageView>(Resource.Id.star);
            heart          = view.FindViewById <ImageView>(Resource.Id.heart);
            Button       nextButton   = view.FindViewById <Button>(Resource.Id.nextButton);
            ImageView    backButton   = view.FindViewById <ImageView>(Resource.Id.backButton);
            Button       hideKeyboard = view.FindViewById <Button>(Resource.Id.hideKeyboard);
            LinearLayout rootLayout   = view.FindViewById <LinearLayout>(Resource.Id.rootLayout);

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

            LoadStudentData();

            hideKeyboard.Visibility = ViewStates.Invisible;
            hideKeyboard.Click     += (sender, e) =>
            {
                InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(notes.WindowToken, 0);
                rootLayout.RequestFocus();
                hideKeyboard.Visibility = ViewStates.Invisible;
            };
            notes.FocusChange += (sender, e) =>
            {
                hideKeyboard.Visibility = ViewStates.Visible;
            };

            nextButton.Text   = "Save Changes";
            nextButton.Click += NextButton_Click;

            heart.Click += (sender, e) =>
            {
                if (newRating == 2)
                {
                    heart.SetImageResource(Resource.Drawable.heartunfilled);
                    newRating = 0;
                }
                else
                {
                    heart.SetImageResource(Resource.Drawable.heartfilled);
                    star.SetImageResource(Resource.Drawable.starunfilled);
                    newRating = 2;
                }
            };
            star.Click += (sender, e) =>
            {
                if (newRating == 1)
                {
                    star.SetImageResource(Resource.Drawable.starunfilled);
                    newRating = 0;
                }
                else
                {
                    star.SetImageResource(Resource.Drawable.starfilled);
                    heart.SetImageResource(Resource.Drawable.heartunfilled);
                    newRating = 1;
                }
            };

            backButton.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                if (source == "Profile")
                {
                    trans.Replace(Resource.Id.profile_root_frame, new ProfileFragment());
                }
                else if (source == "PastQs")
                {
                    trans.Replace(Resource.Id.qs_root_frame, new PastQs());
                }
                trans.Commit();
            };
            return(view);
        }
Exemple #16
0
 public override void recalcAllStats(int level)
 {
     MyAttributes.calculate(stats, level, roll);
     MySkills.calculate(stats);
 }
        private void NextButton_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.ToString() + ".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();

            // Check to see if this student is already in past Q's

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

            string fileName_studentpastQs = "pastqs_" + thisStudentLogin.id.ToString() + ".db3";
            string dbPath_studentpastQs   = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_studentpastQs);
            var    db_studentpastQs       = new SQLiteConnection(dbPath_studentpastQs);

            var queryResults = db_pastQs.Query <SQLite_Tables.PastQueue>("SELECT * FROM PastQueue WHERE studentid = ?", studentid);

            if (queryResults.Count == 0)
            {
                SQLite_Tables.PastQueue pastQ = new SQLite_Tables.PastQueue();
                pastQ.studentid = studentid;
                pastQ.notes     = notes.Text;
                pastQ.rating    = rating;

                db_pastQs.Insert(pastQ);

                SQLite_Tables.MyPastQueue studentpastQ = new SQLite_Tables.MyPastQueue();
                studentpastQ.company = myAttributes.attribute1;

                db_studentpastQs.Insert(studentpastQ);
            }

            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();
        }
Exemple #18
0
        static void Main(string[] args)
        {
            // 解决控制台中文乱码
            //Console.OutputEncoding = Encoding.GetEncoding(936);

            // 常量
            //const double PI = 3.14159;
            const string Const_Str = "Welcome to the C# Wrold.";

            Console.WriteLine(Const_Str);
            //Console.WriteLine(PI);

            // Array.cs
            //MyArray ar = new MyArray();
            var ar = new MyArray();

            ar.Run();

            //ReferenceTypes Rer = new ReferenceTypes();
            //Rer.DynamicType();

            // Enum.cs
            MyEnum e = new MyEnum();

            e.Run();

            // Interface.cs
            MyInterface Inter = new MyInterface();

            Inter.Run();

            // Method.cs
            MyMethod Met = new MyMethod();

            Met.Run();

            // Operators.cs
            MyOperators OP = new MyOperators();

            OP.Run();

            // RegularExpression.cs 正则表达式
            MyRegularExpression RE = new MyRegularExpression();

            RE.Run();

            // StringTest.cs
            MyString str = new MyString();

            str.Run();

            // StrucTest.cs
            MyStruc st = new MyStruc();

            st.Run();

            // VariAblesConst.cs
            InputCustomers i = new InputCustomers();

            i.InputCustomer("Please input Int:");

            // NameSpace.cs
            MyNameSpace NS = new MyNameSpace();

            NS.Run();

            // DataTypes.cs
            MyDataType DT = new MyDataType();

            DT.Run();

            // MultipleInherit.cs
            InheritClass02 Inh02 = new InheritClass02();

            Inh02.Run();

            // RectangleText RT = new RectangleText(10, 20);

            // Polymorphism.cs
            MyPolymorphism PP = new MyPolymorphism();

            PP.Run();

            // FilesTest.cs
            MyFiles file = new MyFiles();

            file.Run();

            // DirectoryTest.cs
            MyDirectory Dir = new MyDirectory();

            Dir.Run();

            // AttributeTest.cs
            MyAttributes AB = new MyAttributes();

            AB.Run();

            // PropertyTest.cs
            MyProperty pp = new MyProperty();

            pp.Run();

            // IndexerTest.cs
            var id = new MyIndexer(5);

            id.Run();

            // DelegateTest.cs
            var DL = new MyDelegate();

            DL.Run();

            //
            MyEvent ee = new MyEvent();

            ee.Run();

            // CollectionTest.cs
            MyCollection cc = new MyCollection();

            cc.Run();

            #region 预处理指令
            // #define 定义一个符号,这个符号会作为一个表达式传递给 #if 指令,这个判断会得到 ture 的 结果。
            //#if (PI)
            //            Console.WriteLine("PI is defined");
            //#else
            //            Console.WriteLine("PI is not defined");
            //#endif

            //#if (DEBUG && !VC_V10)
            //            Console.WriteLine("DEBUG is defined");
            //#elif (!DEBUG && VC_V10)
            //            Console.WriteLine("VC_V10 is defined");
            //#elif (DEBUG && VC_V10)
            //            Console.WriteLine("DEBUG and VC_V10 are defined");
            //#else
            //           Console.WriteLine("DEBUG and VC_V10 are not defined");
            //#endif
            #endregion

            // RandomNumber.cs
            MyRandom rd = new MyRandom();
            rd.Run();

            //
            MyTest tt = new MyTest();
            tt.Test();

            Console.ReadKey();
        }
 public static List <TAttribute> GetAttributeList <TAttribute>(this MemberExpression mExp)
     where TAttribute : Attribute
 {
     return(MyAttributes.GetAttributeOfTypeList <TAttribute>(mExp));
 }