Ejemplo n.º 1
0
        public bool CreateRequest(Request request)
        {
            //TODO try catch
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.IndentChars = "\t";

            using (XmlWriter writer = XmlWriter.Create(GetXmlFileName(request.getId()), settings))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("request");
                writer.WriteAttributeString("id", request.getId());
                writer.WriteElementString("state", request.getState());
                writer.WriteElementString("owner", request.getOwner());
                writer.WriteElementString("subject", request.getSubject());
                writer.WriteElementString("text", request.getText());

                writer.WriteEndElement();
                writer.WriteEndDocument();
            }

            return true;
        }
Ejemplo n.º 2
0
        public CMD judgeRequest(Request request)
        {
            subMenuremove(10, countrequest);
            Console.SetCursorPosition(3, 6);
            Console.Write(new string(' ', Console.WindowWidth));
            Console.SetCursorPosition(3, 6);
            Console.Write("El szeretné fogadni a következő kérvényt?");
            position = 1;
            Console.SetCursorPosition(3, 8);
            Console.Write(new string(' ', Console.WindowWidth));
            Console.SetCursorPosition(3, 8);
            Console.Write(yes);
            Console.SetCursorPosition(12, 8);
            Console.Write(no);
            Console.SetCursorPosition(21, 8);
            Console.Write(back);
            Console.SetCursorPosition(1, 10);
            Console.Write(request.getSubject());
            Console.SetCursorPosition(1, 12);
            Console.Write(request.getText());
            requestLength = request.getText().Length;
            judgeDemandOrRequestUnderline();
            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;
                judgeDemandOrRequestUnderline();
            } while (input.Key != ConsoleKey.Enter);

            CMD command = new CMD();
            switch (position)
            {
                case 1:
                    command.cmd = "True";
                    break;
                case 2:
                    command.cmd = "False";
                    break;
                case 3:
                    command.cmd = "exit";
                    break;
            }
            return command;
        }