Beispiel #1
0
        //public string validate(string uName, string password)
        //{
        //    string valMessage = "User Authenticated";
        //    string valDecline = "User does not exist";
        //    DBCon myDB = new DBCon();
        //    user record = new user();
        //    record.username = uName;
        //    record.userPW = password;
        //    if (myDB.authenticateUser(record) == true)
        //    {
        //        Console.WriteLine("Congrats it works lol");
        //        return valMessage;
        //    }
        //    else
        //    {
        //        Console.WriteLine("NOPE DOESNT WORK BRAH");
        //        return valDecline;
        //    }
        //    #region badcode
        //    //string userName;
        //    //string userPW;
        //    //string ans;
        //    //bool stop = false;
        //    //int task;
        //    //bool found;
        //    //user record = new user();
        //    //while (!stop)
        //    //{
        //    //    //Console.Write("Enter userName: "******"Password of "
        //    //          + userName + " is " + password);
        //    //        found = true;
        //    //        stop = true;
        //    //    }
        //    //    else
        //    //    {
        //    //        Console.WriteLine("Password is incorrect");
        //    //        stop = true;
        //    //    }
        //    //    //else
        //    //    //{
        //    //    //    Console.WriteLine("hehe" + record.userPW);
        //    //    //    stop = true;
        //    //    //}
        //    //    //else
        //    //    //{
        //    //    //    Console.WriteLine("User " +
        //    //    //        userName + " not found!");
        //    //    //    found = false;
        //    //    //}
        //    //    //if (found)
        //    //    //{
        //    //    //    Console.Write(
        //    //    //        "Select task 0 (exit), 1 (modify), 2 (delete) 3 (next): ");
        //    //    //    ans = Console.ReadLine();
        //    //    //    task = Convert.ToInt16(ans);
        //    //    //    switch (task)
        //    //    //    {
        //    //    //        case 0: stop = true;
        //    //    //            break;
        //    //    //        case 1:
        //    //    //            Console.Write(
        //    //    //                "New password: "******"Record changed successfully");
        //    //    //            }
        //    //    //            else
        //    //    //            {
        //    //    //                Console.WriteLine(
        //    //    //                    "Record changed unsuccessfully");
        //    //    //            }
        //    //    //            userPW = record.userPW;
        //    //    //            Console.WriteLine(
        //    //    //              "Password of user " +
        //    //    //                userName + " is " +
        //    //    //                userPW);
        //    //    //            break;
        //    //    //        case 2:
        //    //    //            Console.Write(
        //    //    //             "Delete user? (Y/N) ");
        //    //    //            ans = Console.
        //    //    //                        ReadLine();
        //    //    //            if (ans == "Y" ||
        //    //    //                ans == "y")
        //    //    //            {
        //    //    //                if (myDB.deleteUser(
        //    //    //                  record))
        //    //    //                {
        //    //    //                    Console.WriteLine(
        //    //    //                     "Record deleted successfully");
        //    //    //                }
        //    //    //                else
        //    //    //                {
        //    //    //                    Console.WriteLine(
        //    //    //                      "Record deleted unsuccessfully");
        //    //    //                }
        //    //    //            }
        //    //    //            break;
        //    //    //        default: continue;
        //    //    //    }
        //    //    //}
        //    //    //else
        //    //    //{
        //    //    //    Console.Write(
        //    //    //        "add user? (Y/N) ");
        //    //    //    ans = Console.ReadLine();
        //    //    //    if (ans == "Y" || ans == "y")
        //    //    //    {
        //    //    //        record.surname = userName;
        //    //    //        record.userPW = "IamNew_" +
        //    //    //                        userName;
        //    //    //        if (myDB.addUser(record))
        //    //    //        {
        //    //    //            Console.WriteLine(
        //    //    //                "Record added successfully");
        //    //    //            userPW = record.userPW;
        //    //    //            Console.WriteLine(
        //    //    //                "Password of user " +
        //    //    //                userName + " is " +
        //    //    //                userPW);
        //    //    //        }
        //    //    //        else
        //    //    //        {
        //    //    //            Console.WriteLine(
        //    //    //                "Record added unsuccessfully");
        //    //    //        }
        //    //    //    }
        //    //    //}
        //    //}
        //    #endregion
        //}
        //public static List<tute> getTutorials() //List<tute>
        //{
        //    DatabaseHandler dh = new DatabaseHandler();
        //    string[][] tuteArray = dh.getAllTutorials();
        //    List<tute> tuteList = new List<tute>();
        //    foreach (string[] ar in tuteArray)
        //    {
        //        tuteList.Add(new tute(Int16.Parse(ar[0]), ar[1], ar[2], ar[3]));
        //    }
        //    string tList = "";
        //    for (int i = 0; i < tuteList.Count; i++)
        //    {
        //        //string[] tList = { Convert.ToString(tuteList[i].Session), tuteList[i].Tutor, tuteList[i].Time, tuteList[i].Room};
        //        tList += Convert.ToString(tuteList[i].Session) + ";" + tuteList[i].Tutor + ";" + tuteList[i].Time +";" + tuteList[i].Room + "!!!";
        //        Console.WriteLine(tList);
        //    }
        //    return tuteList;
        //}
        public string requestStudentsInTutorial(string tutorial)
        {
            DatabaseHandler dh = new DatabaseHandler();
            string[][] reqArray = dh.getStudentSession();
            List<user> reqList = new List<user>();

            string requestedStudents = "";

            foreach (string[] ar in reqArray)
            {
                reqList.Add(new user(ar[0], ar[1], Int16.Parse(ar[2])));

                if (tutorial == ar[2])
                {
                    //requestedStudents += ar[0] + ";" + Convert.ToString(ar[2]) + ";";
                    requestedStudents += getPersonDetails(ar[0]);
                }
            }
            return requestedStudents;
        }
Beispiel #2
0
        public string getUsers_Details(string user_name)
        {
            DatabaseHandler dh = new DatabaseHandler();
            string[][] sessionArray = dh.getStudentSession();
            List<user> sessionList = new List<user>();

            string sessionNo = "";

            foreach (string[] ar in sessionArray)
            {
                sessionList.Add(new user(ar[0], ar[1], Int16.Parse(ar[2])));

                if (user_name == ar[0])
                {
                    sessionNo = ar[0] + ";" + ar[2] + ";";
                }
            }
            return sessionNo;
        }
Beispiel #3
0
        public string getSessionNumber(string user_name)
        {
            DatabaseHandler dh = new DatabaseHandler();
            string[][] sessionArray = dh.getStudentSession();
            List<user> sessionList = new List<user>();

            string sessionNo = "";

            foreach (string[] ar in sessionArray)
            {
                sessionList.Add(new user(ar[0], ar[1], Int16.Parse(ar[2])));

                if (user_name == ar[0])
                {
                    sessionNo = Convert.ToString(ar[2]);
                }
            }
            return sessionNo;
        }
Beispiel #4
0
        //List<tute>
        public string getTutorials()
        {
            DatabaseHandler dh = new DatabaseHandler();
            string[][] tuteArray = dh.getAllTutorials();
            List<tute> tuteList = new List<tute>();

            foreach (string[] ar in tuteArray)
            {
                tuteList.Add(new tute(Int16.Parse(ar[0]), ar[1], ar[2], ar[3]));
            }

            string tList = "";

            for (int i = 0; i < tuteList.Count; i++)
            {
                //string[] tList = { Convert.ToString(tuteList[i].Session), tuteList[i].Tutor, tuteList[i].Time, tuteList[i].Room};

                tList += Convert.ToString(tuteList[i].Session) + ";" + tuteList[i].Tutor + ";" + tuteList[i].Time + ";" + tuteList[i].Room + "!";

                //Console.WriteLine(tList);

            }

            return tList;
        }
Beispiel #5
0
        public string getPersonDetails(string user_name)
        {
            DatabaseHandler dh = new DatabaseHandler();
            string[][] personArray = dh.getDST_Users();
            List<user> personList = new List<user>();

            string person = "";

            foreach (string[] ar in personArray)
            {
                personList.Add(new user(ar[0], ar[1], ar[2], ar[3]));

                if (user_name == ar[0])
                {
                    person = ar[0] +";"+ ar[1] +";"+ ar[2] +";"+ ar[3] + "!";
                }
            }
            return person;
        }