Ejemplo n.º 1
0
        private void login()
        {

            String success = null;
            bool error = false;

            while (success == null)
            {
                cmd = il.Login(error);
                switch (cmd.cmd)
                {
                    case "login":
                        success = controller.requestLogin(cmd.data);
                        if (success != null)
                        {
                            controller.start(cmd.data[0], success);
                            success = null;
                        }
                        else
                        {
                            error = true;
                        }
                        break;
                    case "exit":
                        exit();
                        //success = "exit";
                        return;
                }
            }            
        }
Ejemplo n.º 2
0
        public CMD TeacherMainMenu()
        {
            //WriteMenu
            position = 1;
            Console.Clear();
            Console.SetCursorPosition(1, 2);
            Console.Write(timeTable);
            Console.SetCursorPosition(15, 2);
            Console.Write(filter);
            Console.SetCursorPosition(27, 2);
            Console.Write(studentBlock);
            Console.SetCursorPosition(50, 2);
            Console.Write(demand);
            Console.SetCursorPosition(65, 2);
            Console.Write(logOut);
            MainMenuunderline();

            //Action
            do
            {
                input = Console.ReadKey();
                Console.Write("\b ");
                if (input.Key == ConsoleKey.RightArrow)
                    position++;
                if (input.Key == ConsoleKey.LeftArrow)
                    position--;
                if (position < 1)
                    position = 5;
                if (position > 5)
                    position = 1;
                MainMenuunderline();
            } while (input.Key != ConsoleKey.Enter);

            //return           
            CMD command = new CMD();
            switch (position)
            {
                case 1:
                    command.cmd = "timeTable";
                    break;
                case 2:
                    command.cmd = "filter";
                    break;
                case 3:
                    command.cmd = "studentBlock";
                    break;
                case 4:
                    command.cmd = "demand";
                    break;
                case 5:
                    command.cmd = "logout";
                    break;
            }
            return command;
        }
Ejemplo n.º 3
0
        public CMD AdminMainMenu()
        {
            //WriteMenu
            position = 1;
            Console.Clear();
            Console.SetCursorPosition(1, 2);
            Console.Write(demandSubmission);
            Console.SetCursorPosition(23, 2);
            Console.Write(requestMaintenance);
            Console.SetCursorPosition(40, 2);
            Console.Write(requestJudgement);
            Console.SetCursorPosition(62, 2);
            Console.Write(logOut);
            MainMenuunderline();

            //Action
            do
            {
                input = Console.ReadKey();
                Console.Write("\b ");
                if (input.Key == ConsoleKey.RightArrow)
                    position++;
                if (input.Key == ConsoleKey.LeftArrow)
                    position--;
                if (position < 1)
                    position = 4;
                if (position > 4)
                    position = 1;
                MainMenuunderline();
            } while (input.Key != ConsoleKey.Enter); 
            
            //return           
            CMD command = new CMD();
            switch (position)
            {
                case 1:
                    command.cmd = "demandSubmission";
                    break;
                case 2:
                    command.cmd = "requestMaintenance";
                    break;
                case 3:
                    command.cmd = "requestJudgement";
                    break;
                case 4:
                    command.cmd = "logout";
                    break;
            }
            return command;
        }
Ejemplo n.º 4
0
        //Mains
        private void adminMain()
        {
            //ui = new AdminInterface();

            while (true)
            {
                cmd = aui.AdminMainMenu();
                switch (cmd.cmd)
                {
                    case "demandSubmission":
                        demandJudgement();
                        break;
                    case "requestMaintenance":
                        requestMaintenance();
                        break;
                    case "requestJudgement":
                        requestJudgement();
                        break;
                    case "logout":
                        return;
                }
            }

        }
Ejemplo n.º 5
0
        //Demand Judgement
        private bool demandJudgement()
        {
            List<Demand> demands = new List<Demand>();

            try
            {
                demands = db.getAllDemand();
            }
            catch (Exception e)
            {

                Console.WriteLine(e);
            }

            while (true)
            {
                cmd = aui.selectDemand(demands);
                if (cmd.cmd != "exit")
                {
                    int judg = requestDemandJudgement(cmd.data[0]);
                    if (judg == 1)
                    {
                        aui.demand_accept();
                        return true;
                    }
                    else if (judg == 0)
                    {
                        aui.demand_decline();
                        return true;
                    }
                    else
                    {
                        aui.demand_unsuccessful();
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
Ejemplo n.º 6
0
        public CMD demandMenu()
        {
            position = 1;
            Console.SetCursorPosition(36, 4);
            Console.Write("_________________|_________________");
            Console.SetCursorPosition(36, 5);
            Console.Write("|                |                |");
            Console.SetCursorPosition(28, 6);
            Console.Write(demandSubmission);
            Console.SetCursorPosition(46, 6);
            Console.Write(demandChange);
            Console.SetCursorPosition(65, 6);
            Console.Write(back);            
            demandMenuUnderline();
            do
            {
                input = Console.ReadKey();
                Console.Write("\b ");
                if (input.Key == ConsoleKey.RightArrow)
                    position++;
                if (input.Key == ConsoleKey.LeftArrow)
                    position--;
                if (position < 1)
                    position = 3;
                if (position > 3)
                    position = 1;
                demandMenuUnderline();
            } while (input.Key != ConsoleKey.Enter);

            CMD command = new CMD();
            switch (position)
            {
                case 1:
                    command.cmd = "demandSubmission";
                    break;
                case 2:
                    command.cmd = "demandChange";
                    break;
                case 3:
                    command.cmd = "back";
                    break;
            }
            return command;
        }
Ejemplo n.º 7
0
        private int requestDemandChange(String demand_id)
        {
            Demand demand = db.getDemand(demand_id); ;


            cmd = tui.demandChangeSubMenu(demand, db.getAllRoom());

            if (cmd.cmd != "exit")
            {
                Demand newDemand = new Demand(cmd.data[1], "null", userLoggedIn.getNeptunCode(), 
                    cmd.data[0], cmd.data[1], cmd.data[2], cmd.data[3], cmd.data[4], cmd.data[5]);
                
                bool ret = db.demandChange(newDemand);
                if (ret)
                {
                    return 1;
                }
                else
                {
                    return -1;
                }
            }
            else
            {
                return 0;
            }
        }
Ejemplo n.º 8
0
        //Request Judgement
        private bool requestJudgement()
        {
            List<Request> requests = db.getAllRequest();

            while (true)
            {
                cmd = aui.selectRequest(requests);
                if (cmd.cmd != "exit")
                {
                    int judg = requestRequestJudgement(cmd.data[0]);
                    if (judg == 1)
                    {
                        aui.request_accept();
                        return true;
                    }
                    else if (judg == 0)
                    {
                        aui.request_decline();
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
Ejemplo n.º 9
0
        //Request Submission
        private bool requestRequestSubmission()
        {
            cmd = sui.requestSubmissionMenu();
            if (cmd.cmd != "exit")
            {
                String time = DateTime.Now.ToString("MM-dd-yy-hh-mm-ss");
                Request newRequest = new Request(userLoggedIn.getNeptunCode()+time, "null", cmd.data[0], userLoggedIn.getNeptunCode(),
                    cmd.data[1]);


                if (db.requestSubmission(newRequest, userLoggedIn.getNeptunCode()))
                {
                    sui.requestSubmission_successful();
                    return true;
                }
                else
                {
                    sui.requestSubmission_unsuccessful();
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 10
0
        //Register For Subject
        private bool registerForSubject()
        {
            List<Subject> subjects = new List<Subject>();

            try
            {
                subjects = db.getAllSubject();
            }
            catch (Exception e)
            {

                Console.WriteLine(e);
            }

            while (true)
            {
                cmd = sui.selectSubject(subjects);
                if (cmd.cmd != "exit")
                {
                    if (requestRegisterForSubject(cmd.data[0]))
                    {
                        sui.regForSubject_successful();
                        return true;
                    }
                    else
                    {
                        sui.regForSubject_unsuccessful();
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
Ejemplo n.º 11
0
        //Filter - x
        private bool requestFilter()
        {
            cmd = tui.selectFilterTime();

            if (cmd.cmd != "exit")
            {
                List<ClassRoom> classes = db.getFreeClasses(cmd.data[0], cmd.data[1], cmd.data[2]);
                CMD cmd2 = tui.filterSelectClass(classes);
                if (cmd2.cmd != "exit")
                {
                    requestDemandSubmission(cmd2.data[0], cmd.data[0], cmd.data[1], cmd.data[2]);
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }


        }
Ejemplo n.º 12
0
 public CMD filterSelectClass(List<ClassRoom> rooms)
 {
     position = 1;
     subMenuremove(6, 12);
     Console.SetCursorPosition(1, 6);
     Console.Write("Adja meg, hogy melyik termet szeretné választani, amit lefoglalhat:");
     Console.SetCursorPosition(5, 8);
     Console.Write(back + "   ");
     countrooms = rooms.Count;
     for (int i = 0; i < countrooms; i++)
     {
         Console.SetCursorPosition(5, 10 + i);
         Console.Write(rooms[i].getId() + "   ");
     }
     subMainUnderline(countrooms, 0);
     do
     {
         input = Console.ReadKey();
         if (input.Key == ConsoleKey.DownArrow)
             position++;
         if (input.Key == ConsoleKey.UpArrow)
             position--;
         if (position < 1)
             position = countrooms + 1;
         if (position > countrooms + 1)
             position = 1;
         subMainUnderline(countrooms, 0);
     } while (input.Key != ConsoleKey.Enter);    
     CMD command = new CMD();
     command.data = new List<string>();
     if (position == 1)
             command.cmd = "exit";
     else
     {
         command.data.Add(rooms[position - 2].getId());
         subMenuremove(4, 6+ countrooms);
         position = 1;
         for (int i = 0; i < 20; i++)
         {
             Console.SetCursorPosition(i * 4, 8);
             Console.Write("____");
         }
         Console.SetCursorPosition(36, 4);
         Console.Write("_________________|_________________");
         Console.SetCursorPosition(36, 5);
         Console.Write("|                |                |");
         Console.SetCursorPosition(28, 6);
         Console.Write(demandSubmission);
         Console.SetCursorPosition(46, 6);
         Console.Write(demandChange);
         Console.SetCursorPosition(65, 6);
         Console.Write(back);
         demandMenuUnderline();
     }
     
     return command;
 }
Ejemplo n.º 13
0
        private void teacherMain()
        {
            //ui = new TeacherInterface();

            while (true)
            {
                cmd = tui.TeacherMainMenu();
                switch (cmd.cmd)
                {
                    case "filter":
                        requestFilter();
                        break;
                    case "studentBlock":
                        studentBlock();
                        break;
                    
                    case "demand":
                        cmd = tui.demandMenu();
                        switch (cmd.cmd)
                        {
                            case "demandSubmission":
                                requestDemandSubmission();
                                break;
                            case "demandChange":
                                demandChange();
                                break;
                            case "logout":
                                break;
                        }
                        break;                    
                    case "timeTable":
                        requestTeacherTimeTable();
                        break;
                    case "logout":
                        return;
                }
            }
        }
Ejemplo n.º 14
0
 public CMD demandChangeSubMenu(Demand demand, List<ClassRoom> rooms)
 { 
     
     position = 1;
     subMenuremove(15, countdemands);
     for (int i = 0; i < 20; i++)
     {
         Console.SetCursorPosition(i * 4, 9);
         Console.Write("____");
     }
     Console.SetCursorPosition(1, 11);
     Console.Write("Adja meg, melyik termet szeretné igényelni a/az " + demand.getRoomId() + " helyett:");
     Console.SetCursorPosition(5, 13);
     Console.Write(back + "   ");
     countrooms = rooms.Count;
     for (int i = 0; i < countrooms; i++)
     {
         Console.SetCursorPosition(5, 15 + i);
         Console.Write(rooms[i].getId() + "   ");
     }
     subMainUnderline(countrooms, 5);
     do
     {
         input = Console.ReadKey();
         if (input.Key == ConsoleKey.DownArrow)
             position++;
         if (input.Key == ConsoleKey.UpArrow)
             position--;
         if (position < 1)
             position = countrooms + 1;
         if (position > countrooms + 1)
             position = 1;
         subMainUnderline(countrooms, 5);
     } while (input.Key != ConsoleKey.Enter);
     CMD command = new CMD();
     command.data = new List<string>();            
     if (position == 1)
         command.cmd = "exit";
     else
         command.data.Add(rooms[position - 2].getId());
     String day = "";
     switch(demand.getDay())
     {
         case "Hetfo":
             day = "1";
             break;
         case "Kedd":
             day = "2";
             break;
         case "Szerda":
             day = "3";
             break;
         case "Csutortok":
             day = "4";
             break;
         case "Pentek":
             day = "5";
             break;
     }
     String subjectID = "";
     String subjectName = "";            
     String start = "";
     String end = "";
     if (command.cmd != "exit")
     {
         List<String> list;
         list = new List<string>();
         list = demandSubMenu(demand.getSubjectId(), demand.getSubjectName(), day, demand.getStartTime(), demand.getEndTime());
         subjectID = list[0];
         subjectName = list[1];
         day = list[2];
         start = list[3];
         end = list[4];
     }
     String subjectDay = "";
     switch (day)
     {
         case "1":
             subjectDay = "Hetfo";
             break;
         case "2":
             subjectDay = "Kedd";
             break;
         case "3":
             subjectDay = "Szerda";
             break;
         case "4":
             subjectDay = "Csutortok";
             break;
         case "5":
             subjectDay = "Pentek";
             break;
     }
     if (position == 1)
         command.cmd = "exit";
     else
     {
         command.data.Add(subjectID);
         command.data.Add(subjectName);
         command.data.Add(subjectDay);
         command.data.Add(start + ":00");
         command.data.Add(end + ":00");
     }
     return command;
 }
Ejemplo n.º 15
0
        public CMD selectFilterTime()
        {
            position = 1;
            for (int i = 0; i < 20; i++)
            {
                Console.SetCursorPosition(i * 4, 4);
                Console.Write("____");
            }
            Console.SetCursorPosition(3, 6);            
            Console.Write("Adja meg, milyen időpont szerint szeretne szűri termekre:");
            Console.SetCursorPosition(2, 8);
            Console.Write(back + "   ");
            Console.SetCursorPosition(2, 10);
            Console.Write(filtering + "   ");
            Console.SetCursorPosition(2, 12);
            Console.Write("Melyik napon legyen (számot írjon: 1 - Hétfő ... 5 - Péntek): ");
            Console.SetCursorPosition(2, 14);            
            Console.Write("Mikor kezdődjön (Csak 8, 10,...,18 számokat írjon be, Pl: 8->8:00): ");
            Console.SetCursorPosition(2, 16);
            Console.Write("Óra vége (Rendszerben 2 órásak az órák. Pl: kezdés: 8 -> vége: 10): ");

            String day = "";
            String start = "";
            String end = "";
            int lengthDay = 0;
            int lengthStart = 0;
            int lengthEnd = 0;
            selectFilterUnderline(lengthDay, lengthStart, lengthEnd);
            Boolean again = true;
            do
            {
                do
                {
                    input = Console.ReadKey();
                    if (Console.CursorLeft > 78)
                    {
                        Console.Write("\b ");
                    }
                    else
                    {
                        if (position < 3)
                        {
                            Console.Write("\b ");
                        }
                        if (!((input.KeyChar >= 'a' && input.KeyChar <= 'z') || (input.KeyChar >= 'A' && input.KeyChar <= 'Z') || (input.KeyChar >= '0' && input.KeyChar <= '9') || (input.Key == ConsoleKey.Spacebar)) && input.Key != ConsoleKey.Backspace)
                        {
                            Console.Write("\b ");
                        }
                        if (((input.KeyChar >= 'a' && input.KeyChar <= 'z') || (input.KeyChar >= 'A' && input.KeyChar <= 'Z') || (input.KeyChar >= '0' && input.KeyChar <= '9') || (input.Key == ConsoleKey.Spacebar)))
                        {
                            switch (position)
                            {
                                case 3:
                                    lengthDay++;
                                    day += input.KeyChar;
                                    break;
                                case 4:
                                    lengthStart++;
                                    start += input.KeyChar;
                                    break;
                                case 5:
                                    lengthEnd++;
                                    end += input.KeyChar;
                                    break;
                            }
                        }
                    }
                    if (input.Key == ConsoleKey.Backspace)
                    {
                        switch (position)
                        {
                            case 3:
                                if (lengthDay > 0)
                                {
                                    day = day.Remove(day.Length - 1);
                                    lengthDay--;
                                    Console.Write(" ");
                                }
                                break;
                            case 4:
                                if (lengthStart > 0)
                                {
                                    start = start.Remove(start.Length - 1);
                                    lengthStart--;
                                    Console.Write(" ");
                                }
                                break;
                            case 5:
                                if (lengthEnd > 0)
                                {
                                    end = end.Remove(end.Length - 1);
                                    lengthEnd--;
                                    Console.Write(" ");
                                }
                                break;
                        }
                    }
                    if (input.Key == ConsoleKey.DownArrow)
                        position++;
                    if (input.Key == ConsoleKey.UpArrow)
                        position--;
                    if (position < 1)
                        position = 5;
                    if (position > 5)
                        position = 1;
                    selectFilterUnderline(lengthDay, lengthStart, lengthEnd);
                } while (input.Key != ConsoleKey.Enter || position > 2);
                if (position == 1) again = false;
                if (position == 2)
                {
                    try
                    {
                        int dayNumb = Int16.Parse(day);
                        if (dayNumb >= 1 && dayNumb <= 5)
                        {
                            try
                            {
                                int startNumb = Int16.Parse(start);
                                int endNumb = Int16.Parse(end);
                                if (startNumb >= 8 && startNumb <= 18 && endNumb >= 10 && endNumb <= 20 && startNumb % 2 == 0 && endNumb % 2 == 0 && startNumb + 2 == endNumb)
                                {
                                    again = false;
                                }
                                else
                                {
                                    Console.SetCursorPosition(25, 10);
                                    for (int i = 0; i < 10; i++)
                                        Console.Write("     ");
                                    Console.SetCursorPosition(25, 10);
                                    Console.Write("Hibásan adta meg az óra kezdését, vagy végét!");
                                }
                            }
                            catch (FormatException)
                            {
                                Console.SetCursorPosition(25, 10);
                                for (int i = 0; i < 10; i++)
                                    Console.Write("     ");
                                Console.SetCursorPosition(25, 10);
                                Console.Write("Hibásan adta meg az óra kezdését, vagy végét!");
                            }
                        }
                        else
                        {
                            Console.SetCursorPosition(25, 10);
                            for (int i = 0; i < 10; i++)
                                Console.Write("     ");
                            Console.SetCursorPosition(25, 10);
                            Console.Write("Hibásan adta meg a napot!");
                        }
                    }
                    catch (FormatException)
                    {
                        Console.SetCursorPosition(25, 10);
                        for (int i = 0; i < 10; i++)
                            Console.Write("     ");
                        Console.SetCursorPosition(25, 10);
                        Console.Write("Hibásan adta meg a napot!");
                    }
                }
            } while (again);
            CMD command = new CMD();
            command.data = new List<string>();
            String subjectDay = "";
            switch (day)
            {
                case "1":
                    subjectDay = "Hetfo";
                    break;
                case "2":
                    subjectDay = "Kedd";
                    break;
                case "3":
                    subjectDay = "Szerda";
                    break;
                case "4":
                    subjectDay = "Csutortok";
                    break;
                case "5":
                    subjectDay = "Pentek";
                    break;
            }
            if (position == 1)
            {
                command.cmd = "exit";
            }
            else
            {
                command.data.Add(subjectDay);
                command.data.Add(start + ":00");
                command.data.Add(end + ":00");
            }
            return command;
        }
Ejemplo n.º 16
0
 public CMD demandChangeMenu(List<Demand> demands)
 {
     position = 1;
     for (int i = 0; i < 20; i++)
     {
         Console.SetCursorPosition(i * 4, 9);
         Console.Write("____");
     }
     Console.SetCursorPosition(1, 11);
     Console.Write("Adja meg, hogy melyik igényt szeretné megváltoztatni:");
     Console.SetCursorPosition(5, 13);
     Console.Write(back + "   ");
     countdemands = demands.Count;
     for (int i = 0; i < countdemands; i++)
     {
         Console.SetCursorPosition(5, 15 + i);
         Console.Write(demands[i].getSubjectId() + "   " + demands[i].getSubjectName() + "   ");
     }
     subMainUnderline(countdemands, 5);
     do
     {
         input = Console.ReadKey();
         if (input.Key == ConsoleKey.DownArrow)
             position++;
         if (input.Key == ConsoleKey.UpArrow)
             position--;
         if (position < 1)
             position = countdemands + 1;
         if (position > countdemands + 1)
             position = 1;
         subMainUnderline(countdemands, 5);
     } while (input.Key != ConsoleKey.Enter);
     CMD command = new CMD();
     command.data = new List<string>();
     if (position == 1)
         command.cmd = "exit";
     else
     {
         int demandNumb = position - 2;
         command.data.Add(demands[demandNumb].getId()); 
     }
     return command;
 }
Ejemplo n.º 17
0
 public CMD demandSubmissionMenu(List<ClassRoom> rooms, string selected_room="", string defday = "", string defstart="", string defend="")
 {
     if (selected_room == "")
     {
         position = 1;
         for (int i = 0; i < 20; i++)
         {
             Console.SetCursorPosition(i * 4, 9);
             Console.Write("____");
         }
         Console.SetCursorPosition(1, 11);
         Console.Write("Adja meg, hogy melyik termet szeretné igényelni egy új tantárgy felvitelére:");
         Console.SetCursorPosition(5, 13);
         Console.Write(back + "   ");
         countrooms = rooms.Count;                
         for (int i = 0; i < countrooms; i++)
         {
             Console.SetCursorPosition(5, 15 + i);
             Console.Write(rooms[i].getId() + "   ");
         }
         subMainUnderline(countrooms, 5);
         do
         {
             input = Console.ReadKey();
             if (input.Key == ConsoleKey.DownArrow)
                 position++;
             if (input.Key == ConsoleKey.UpArrow)
                 position--;
             if (position < 1)
                 position = countrooms + 1;
             if (position > countrooms + 1)
                 position = 1;
             subMainUnderline(countrooms, 5);
         } while (input.Key != ConsoleKey.Enter);
     }
     CMD command = new CMD();
     command.data = new List<string>();
     if (selected_room == "")
     {
         if (position == 1)
             command.cmd = "exit";
         else
             command.data.Add(rooms[position - 2].getId());
     }
     else
         command.data.Add(selected_room);
     String subjectID = "";
     String subjectName = "";
     String day = "";
     switch (defday)
     {
         case "Hetfo":
             day = "1";
             break;
         case "Kedd":
             day = "2";
             break;
         case "Szerda":
             day = "3";
             break;
         case "Csutortok":
             day = "4";
             break;
         case "Pentek":
             day = "5";
             break;
     }
     String start = defstart;
     String end = defend;
     if (command.cmd != "exit")
     {
         List<String> list;
         list = new List<string>();
         list = demandSubMenu(subjectID, subjectName, day, start, end);
         subjectID = list[0];
         subjectName = list[1];
         day = list[2];
         start = list[3];
         end = list[4];
     }
     String subjectDay="";
     switch(day)
     {
         case "1":
             subjectDay = "Hetfo";
             break;
         case "2":
             subjectDay = "Kedd";
             break;
         case "3":
             subjectDay = "Szerda";
             break;
         case "4":
             subjectDay = "Csutortok";
             break;
         case "5":
             subjectDay = "Pentek";
             break;
     }
     if(position==1)                
             command.cmd = "exit";
     else
     {
         command.data.Add(subjectID);
         command.data.Add(subjectName);
         command.data.Add(subjectDay);
         command.data.Add(start+":00");
         command.data.Add(end+":00");
     }   
     return command;
 }
Ejemplo n.º 18
0
 public CMD selectSubject(List<short_subject> subject)
 {
     subMenuremove(10, countusers);
     position = 1;
     for (int i = 0; i < 20; i++)
     {
         Console.SetCursorPosition(i * 4, 4);
         Console.Write("____");
     }
     Console.SetCursorPosition(3, 6);
     Console.Write("Adja meg, hogy melyik tantárgyról szeretne diákot letiltani:");
     Console.SetCursorPosition(5, 8);
     Console.Write(back + "   ");
     countsubject = subject.Count;
     subMainUnderline(countsubject,0);            
     for (int i = 0; i < subject.Count; i++)
     {
         Console.SetCursorPosition(5, 10 + i);
         Console.Write(subject[i].name + "   ");
         
     }
     Console.SetCursorPosition(8 + back.Length, 8);
     do
     {
         input = Console.ReadKey();
         if (input.Key == ConsoleKey.DownArrow)
             position++;
         if (input.Key == ConsoleKey.UpArrow)
             position--;
         if (position < 1)
             position = countsubject + 1;
         if (position > countsubject + 1)
             position = 1;
         subMainUnderline(countsubject, 0);
     } while (input.Key != ConsoleKey.Enter);
     CMD command = new CMD();
     command.data = new List<string>();
     if (position == 1)
         command.cmd = "exit";
     else
         command.data.Add(subject[position-2].id);
     return command;
 }
Ejemplo n.º 19
0
 private int requestDemandJudgement(String demand_id)
 {
     cmd = aui.judgeDemand();
     if (cmd.cmd != "exit")
     {
         if (db.demandJudgement(demand_id, userLoggedIn.getNeptunCode(), Boolean.Parse(cmd.cmd)))
         {
             if (db.getDemand(demand_id).getState() == "accepted")
             {
                 return 1;
             }
             else
             {
                 return 0;
             }
         }
         else
         {
             return -1;
         }
     }
     else
     {
         return -1;
     }
 }
Ejemplo n.º 20
0
        private void studentMain()
        {
            //ui = new StudentInterface();

            while (true)
            {
                cmd = sui.StudentMainMenu();
                switch (cmd.cmd)
                {
                    case "timeTable":
                        requestStudentTimeTable();
                        break;
                    case "requestSubmission":
                        requestRequestSubmission();
                        break;
                    case "registerForSubject":
                        registerForSubject();
                        break;
                    case "deregisterSubject":
                        deregisterSubject();
                        break;
                    case "logout":
                        return;
                }
            }
        }
Ejemplo n.º 21
0
        //Demand Submission
        private bool requestDemandSubmission(String selected_class = "", String day="", String startTime = "", String endTime="")
        {
            List<ClassRoom> rooms = db.getAllRoom();

            cmd = tui.demandSubmissionMenu(rooms, selected_class, day, startTime, endTime);

            
            if (cmd.cmd != "exit")
            {

                Demand newDemand = new Demand(cmd.data[1], "null", userLoggedIn.getNeptunCode(),
                   cmd.data[0], cmd.data[1], cmd.data[2], cmd.data[3], cmd.data[4], cmd.data[5]);

                if (db.demandSubmission(newDemand, userLoggedIn.getNeptunCode()))
                {
                    tui.demandSubmission_successful();
                    return true;
                }
                else
                {
                    tui.demandSubmission_unsuccessful();
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 22
0
        //Teacher Functions

        //Student Block
        private bool studentBlock()
        {
            List<short_subject> subjects = db.getShortSubjects(userLoggedIn.getNeptunCode());

            while (true)
            {
                cmd = tui.selectSubject(subjects);

                if (cmd.cmd != "exit")
                {
                    int ret = studentBlock_studentSelect(cmd.data[0]);
                    if (ret == 1)
                    {
                        tui.studentBlock_successful();
                        return true;
                    }
                    else if (ret == -1)
                    {
                        tui.studentBlock_unsuccessful();
                        return true;
                    }
                    //ha ret == 0, akkor újrafut a ciklus úgyis
                }
                else
                {
                    return false; //visszalép a main menu-be és újra fut ott a while ciklus
                }
            }
        }
Ejemplo n.º 23
0
        //Deregister Subject
        private bool deregisterSubject()
        {
            List<Subject> subjects = db.getSubjects(userLoggedIn.getNeptunCode());

            while (true)
            {
                cmd = sui.selectSubject(subjects);

                if (cmd.cmd != "exit")
                {
                    if (requestDeregisterSubject(cmd.data[0]))
                    {
                        sui.deregister_successful();
                        return true;
                    }
                    else
                    {
                        sui.deregister_unsuccessful();
                    }
                }
                else
                {
                    return false;
                }
            }
        }
Ejemplo n.º 24
0
        public CMD timeTableView(List<Subject> subjects)
        {
            for (int i = 0; i < 20; i++)
            {
                Console.SetCursorPosition(i * 4, 4);
                Console.Write("____");
            }
            Console.SetCursorPosition(3, 6);
            Console.Write(back);
            for (int i = 0; i < back.Length; i++)
            {
                Console.SetCursorPosition(3 + i, 7);
                Console.Write("-");
            }
            Console.SetCursorPosition(3 + back.Length, 6);
            for(int i=8;i<20;i+=2)
            {
                Console.SetCursorPosition(3, 2 + i);
                Console.Write(i + ":00 - " + (i+2) + ":00");
            }
            Console.SetCursorPosition(20, 8);
            Console.Write("Hétfő");
            Console.SetCursorPosition(32, 8);
            Console.Write("Kedd");
            Console.SetCursorPosition(44, 8);
            Console.Write("Szerda");
            Console.SetCursorPosition(56, 8);
            Console.Write("Csütörtök");
            Console.SetCursorPosition(68, 8);
            Console.Write("Péntek");
            int pos=0;
            string current = "";
            for (int i = 0; i < subjects.Count; i++)
            {
                switch (subjects[i].getDay())
                {
                    case "Hetfo":
                        cursorpos = 20;
                        break;
                    case "Kedd":
                        cursorpos = 32;
                        break;
                    case "Szerda":
                        cursorpos = 44;
                        break;
                    case "Csutortok":
                        cursorpos = 56;
                        break;
                    case "Pentek":
                        cursorpos = 68;
                        break;
                }

                current = subjects[i].getStartTime().Remove(subjects[i].getStartTime().Length - 3);
                pos = Int32.Parse(current) + 2;                
                if (subjects[i].getName().Length < 11)
                {
                    Console.SetCursorPosition(cursorpos, pos);
                    Console.Write(subjects[i].getName());
                }
                else if(subjects[i].getName().Length < 21)
                {
                    Console.SetCursorPosition(cursorpos, pos);
                    Console.Write(subjects[i].getName().Remove(10));
                    Console.SetCursorPosition(cursorpos, pos+1);
                    Console.Write(subjects[i].getName().Remove(0, 10));
                }
                else
                {
                    Console.SetCursorPosition(cursorpos, pos);
                    Console.Write(subjects[i].getName().Remove(10));
                    Console.SetCursorPosition(cursorpos, pos + 1);
                    Console.Write(subjects[i].getName().Remove(0, 10).Remove(10));
                }
                               

            }
            Console.SetCursorPosition(4 + back.Length, 6);

            do
            {
                input = Console.ReadKey();
                Console.Write("\b ");
                Console.SetCursorPosition(4 + back.Length, 6);
            } while (input.Key != ConsoleKey.Enter);
            CMD command = new CMD();
            return command;
        }
Ejemplo n.º 25
0
        //Maintenance
        private bool requestMaintenance()
        {
            cmd = aui.requestMaintenanceMenu();

            if (cmd.cmd != "exit")
            {
                if (db.maintenance())
                {
                    aui.maintenance_successful();
                    return true;
                }
                else
                {
                    aui.maintenance_unsuccessful();
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 26
0
        private void requestTeacherTimeTable()
        {
            List<Subject> timeTable = db.TimeTable(userLoggedIn.getNeptunCode());

            cmd = tui.timeTableView(timeTable);

            return;
        }
Ejemplo n.º 27
0
        private int requestRequestJudgement(String request_id)
        {
            cmd = aui.judgeRequest(db.getRequest(request_id));
            //request delete
            if (cmd.cmd != "exit")
            {

                if (db.requestJudgement(request_id, userLoggedIn.getNeptunCode(), Boolean.Parse(cmd.cmd)))
                {
                    if (db.getRequest(request_id).getState() == "accepted")
                    {
                        return 1;
                    }
                    else
                    {
                        return 0;
                    }
                }
                else
                {
                    return -1;
                }
            }
            else
            {
                return -1;
            }
        }
Ejemplo n.º 28
0
        //Demand Change
        private bool demandChange()
        {
            List<Demand> demands = new List<Demand>();

            try
            {
                demands = db.getDemands(userLoggedIn.getNeptunCode());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            while (true)
            {
                cmd = tui.demandChangeMenu(demands);

                if (cmd.cmd != "exit")
                {
                      int ret = requestDemandChange(cmd.data[0]);
                      if (ret == 1)
                      {
                          tui.demandChange_successful();
                          return true;
                      }
                      else if (ret == -1)
                      {
                          tui.demandChange_unsuccessful();
                          return true;
                      }
                      else
                      {
                          return false;
                      }             
                }
                else
                {
                    return false;
                }
            }
        }
Ejemplo n.º 29
0
        private int studentBlock_studentSelect(String subject_id)
        {
            while (true)
            {
                List<short_user> student_list = db.getStudents(subject_id);

                cmd = tui.selectStudent(student_list);

                if (cmd.cmd != "exit")
                {
                    if (requestStudentBlock(cmd.data[0], subject_id, cmd.data[1]))
                    {
                        return 1; //sikerült
                    }
                    else
                    {
                        return -1; //sikertelen
                    }
                }
                else
                {
                    return 0; //exit code
                }
            }
        }
Ejemplo n.º 30
0
 public CMD selectStudent(List<short_user> users)
 {
     subMenuremove(10, countsubject);
     position = 1;
     Console.SetCursorPosition(3, 6);
     Console.Write("Adja meg, hogy melyik diákot szeretné letiltani:              ");
     countusers = users.Count;
     subMainUnderline(countusers,0);            
     for (int i = 0; i < users.Count; i++)
     {
         Console.SetCursorPosition(5, 10 + i);
         Console.Write(users[i].id + "  " + users[i].name + "   ");                
     }
     Console.SetCursorPosition(8 + back.Length, 8);
     do
     {
         input = Console.ReadKey();
         if (input.Key == ConsoleKey.DownArrow)
             position++;
         if (input.Key == ConsoleKey.UpArrow)
             position--;
         if (position < 1)
             position = countusers + 1;
         if (position > countusers + 1)
             position = 1;
         subMainUnderline(countusers,0);
     } while (input.Key != ConsoleKey.Enter);
     CMD command = new CMD();
     command.data = new List<string>();
     if (position == 1)
         command.cmd = "exit";
     else
     {
         command.data.Add(users[position - 2].id);
         command.data.Add(users[position - 2].name);
     }
     return command;
 }