Exemplo n.º 1
0
        private void getstudentInfo()
        {
            List <string> sinfo = xdl.selectItems("students_table", "user_id, contact_number", new string[] { "user_id", "contact_number" },
                                                  "student_number = " + this.student_n)[0];

            user_id    = sinfo.ElementAt(0);
            contactnum = sinfo.ElementAt(1);
            List <string> stdinfo = xdl.selectItems("users_table", "first_name, last_name, middle_name, extension",
                                                    new string[] { "first_name", "last_name", "middle_name", "extension" }, "user_id = " + user_id)[0];
            List <string> allInfo = new List <string>();

            allInfo.AddRange(sinfo);
            allInfo.AddRange(stdinfo);

            for (int i = 0; i < allInfo.Count; i++)
            {
                string key = i == 0 ? "user_id" : i == 1 ? "contact_number" : i == 2 ? "first_name" :
                             i == 3 ? "last_name" : i == 4 ? "middle_name" : i == 5 ? "extension" : "";
                this.student_info.Add(key, allInfo.ElementAt(i));
            }
        }
Exemplo n.º 2
0
        private void student_select(object sender, SelectionChangedEventArgs e)
        {
            ListView lv = new ListView();

            lv = sender as ListView;
            var item = lv.SelectedItem as Student;

            if (item != null)
            {
                Student.stud_num = item.Student_Number;
                Student.rfid_num = xdl.selectItems("students_table", "rfid_number", new string[] { "rfid_number" }, "student_number = " + item.Student_Number)[0].ElementAt(0);
            }
        }
Exemplo n.º 3
0
        private async void login(object sender, RoutedEventArgs e)
        {
            string pass = password.Password;
            string un   = username.Text;

            responseString = await client.GetStringAsync("http://localhost/rtams-portal/lib/decrypt-pass.php?pw=" + pass);

            List <string>[] credentials = xdl.selectItems("users_table", "username", new string[] { "username" }, "username = \"" +
                                                          un + "\" and password = \"" + responseString + "\" and account_type = 'admin'");
            try
            {
                if (credentials[0].ElementAt(0) == un)
                {
                    MainWindow mw = new MainWindow();
                    mw.Show();
                    this.Close();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Wrong Username or Password!", "Login Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }