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; }
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; }
//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; } }
public bool requestSubmission(Request newRequest, String neptun_code) { bool user = userHandler.AppendRequest(neptun_code, newRequest.getId()); bool request = requestHandler.CreateRequest(newRequest); return user && request; }