Beispiel #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            pictureBox2.Visible = true;
            await Task.Delay(2000);

            bool res = GlobalItems.Login(textBox1.Text, textBox2.Text);

            if (res)
            {
                this.Hide();
                textBox1.Text = "";
                textBox2.Text = "";

                if (GlobalItems.CheckUserLevel() == 1)
                {
                    ManagerWin wnd = new ManagerWin();
                    wnd.Show();
                }
                else if (GlobalItems.CheckUserLevel() == 2)
                {
                    MazkiraWin wnd = new MazkiraWin();
                    wnd.Show();
                }
                else if (GlobalItems.CheckUserLevel() == 3)
                {
                    TeacherWin wnd = new TeacherWin();
                    wnd.Show();
                }
                else if (GlobalItems.CheckUserLevel() == 4)
                {
                    TeacherWin wnd = new TeacherWin();
                    wnd.Show();
                }

                else if (GlobalItems.CheckUserLevel() == 5)
                {
                    StudentWin wnd = new StudentWin();
                    wnd.Show();
                }

                else
                {
                    MessageBox.Show("Your account is not approved by secretary");
                }
            }
            else
            {
                MessageBox.Show("This user is not exist", "Login Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            pictureBox2.Visible = false;
        }
Beispiel #2
0
        private void Form6_Load(object sender, EventArgs e)
        {
            userInfoLoad();
            CourseLoad();
            CourseByUserLoad(GlobalItems.currentUser.id);
            studentScheduleOptions(GlobalItems.currentUser.id);
            ScheduleLoad(GlobalItems.currentUser.id);



            if (GlobalItems.CheckUserLevel() == 6)
            {
                button3.Enabled = false;
                button2.Enabled = false;
                MessageBox.Show("Option courses and My Info no active for now. Secretary will update your data and you will have acsses to this option");
            }
        }
Beispiel #3
0
        private void GraphApiExample()
        {
            // note: avoid using synchronous methods if possible as it will block the thread until the result is received

            try
            {
                var fb = new FacebookClient(_accessToken);

                // instead of casting to IDictionary<string,object> or IList<object>
                // you can also make use of the dynamic keyword.
                dynamic result = fb.Get("me?fields=first_name,last_name,id,name");

                // You can either access it this way, using the .
                dynamic id   = result.id;
                dynamic name = result.name;

                dynamic first_name = result.first_name;
                dynamic last_name  = result.last_name;

                // if dynamic you don't need to cast explicitly.
                lblUserId.Text = "User Id: " + id;
                lnkName.Text   = "Hi " + name;

                lblFirstName.Text = "First Name " + first_name;
                lblLastName.Text  = "Last Name " + last_name;


                string iden = GlobalItems.getIdNumber("users", "fname", first_name);
                if (iden != id)
                {
                    Unproved obj = new Unproved();
                    obj.addUser(first_name, last_name, "", "", id, 6);
                }
                else
                {
                    this.Close();


                    GlobalItems.Login(id, "");
                    switch (GlobalItems.CheckUserLevel())
                    {
                    case 3:
                    case 4:
                        TeacherWin wnd = new TeacherWin(_accessToken);
                        wnd.Show(startFrom.Instance);
                        wnd.Select();
                        wnd.Focus();
                        break;

                    case 5:
                    case 6:
                        StudentWin wnd2 = new StudentWin(_accessToken);
                        wnd2.Show(startFrom.Instance);
                        wnd2.Select();
                        wnd2.Focus();
                        break;
                    }
                }
            }
            catch (FacebookApiException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }