Exemplo n.º 1
0
        public void LoadSchedule()
        {
            int        key = GlobalItems.getKey("users", "fname", "Dunkan");
            StudentWin obj = new StudentWin();

            obj.ScheduleLoad(key);
            Assert.IsNotNull(key);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
 private void btn_Enter_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var autoriz = context.Autoriz.Where(i => i.login == txt_Login.Text && i.password == psb_Password.Password).FirstOrDefault();
         if (autoriz != null)
         {
             var user  = context.Teachers.Where(i => i.login == autoriz.idAutoriz).FirstOrDefault();
             var user2 = context.Students.Where(i => i.login == autoriz.idAutoriz).FirstOrDefault();
             if (user != null && user2 == null && autoriz.uRole == 2 && user.available == 1)
             {
                 userTeach = user;
                 TeachWin teach = new TeachWin();
                 Hide();
                 teach.ShowDialog();
                 Show();
             }
             else if (user == null && user2 != null && autoriz.uRole == 3 && user2.available == 1)
             {
                 userStud = user2;
                 StudentWin student = new StudentWin();
                 Hide();
                 student.ShowDialog();
                 Show();
             }
             else if (user != null && user2 == null && autoriz.uRole == 1)
             {
                 userTeach = user;
                 AdminWin admin = new AdminWin();
                 Hide();
                 admin.ShowDialog();
                 Show();
             }
             txt_Login.Text        = string.Empty;
             psb_Password.Password = string.Empty;
         }
         else
         {
             MessageBox.Show("Пользователь не найден");
         }
     }
     catch (Exception g)
     {
         MessageBox.Show(g.Message, "Что-то пошло не так!");
     }
 }
Exemplo n.º 4
0
        public void getInfo()
        {
            StudentWin obj  = new StudentWin();
            Panel      obj2 = null;

            List <Control> list = new List <Control>();

            GlobalItems.GetAllControl(obj, list);
            foreach (Control control in list)
            {
                if (control.GetType() == typeof(Panel) && control.Name == "myInfoPanel")
                {
                    obj2 = new Panel();
                }
            }

            Assert.IsNotNull(obj2);
        }
Exemplo n.º 5
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);
            }
        }