Example #1
0
        static void Main(string[] args)
        {
            Student s = new Student();

            s.input();
            s.Output();
        }
Example #2
0
        public static int login(string path)
        {
            while (true)
            {
                Console.WriteLine("------>登录<------");
                Console.WriteLine();
                Console.WriteLine("Tip:学生登录名为学号");
                Console.WriteLine();

                Console.Write("Username:"******"Password:"******"用户名或密码错误!按任意键重新登录...");
                    Console.Clear();
                    continue;
                }

                if (username == "admin" && username == password)                // 教师用户
                {
                    Teacher teacher = new Teacher(path);
                    teacher.input();                                            // 处理输入
                    return(1);
                }

                string sql = "SELECT Sno FROM student WHERE Sno= " + username;  // 查看是否是学生用户

                SQLiteDataReader reader = connect.selectSQL(sql);
                if (reader == null)                                             // 若出错
                {
                    UI.waitReturn("用户名或密码错误!按任意键重新登录...");
                    Console.Clear();
                    continue;
                }
                while (reader.Read())
                {
                    if (reader["Sno"].ToString() == username)                   // 若匹配数据库的学号
                    {
                        Student stu = new Student(username, path);
                        stu.input();
                        return(2);
                    }
                }

                UI.waitReturn("用户名或密码错误!按任意键重新登录...");
                Console.Clear();
            }
        }
        static void Main(string[] args)
        {
            Student s1 = new Student();

            s1.printDefaultConstructor();

            Student s = new Student("Ghulam Ghous", "2018-CS-31");

            s.printParameterizedConstructor();
            s.input();
            s.Output();

            Console.ReadLine();
            ;
        }