public void printElements() { var elementsrunway = runWaySpace.QueryAll(typeof(string), typeof(int)); var elementstaxiway = taxiWaySpace.QueryAll(typeof(string), typeof(int), typeof(int)); var elementslocks = taxiWaySpace.QueryAll(typeof(string), typeof(int), typeof(int)); var elementscontrol = controlTowerSpace.QueryAll(typeof(string), typeof(int), typeof(ControlTower)); var elementsairplane = airplaneSpace.QueryAll(typeof(ITuple)); foreach (var t in elementsrunway) { Console.WriteLine(t); } foreach (var t in elementslocks) { Console.WriteLine(t); } foreach (var t in elementstaxiway) { Console.WriteLine(t); } foreach (var t in elementscontrol) { Console.WriteLine(t); } foreach (var t in elementsairplane) { Console.WriteLine(t); } }
private Account SelectAccount(string Username) { var list = _userAccounts.QueryAll(typeof(Account)); var returnVal = list.Select(t => t[0] as Account).FirstOrDefault(a => a.Username == Username); if (returnVal != null) { return(returnVal); } throw new Exception("no such user"); }
private void GetConferenceListService() { while (true) { var request = _getConferences.Get(typeof(string), typeof(string), typeof(string), typeof(int), typeof(string)); var username = (string)request[0]; var conferenceName = (string)request[1]; var ipOfConference = (string)request[2]; var requestType = (int)request[3]; var pass = (string)request[4]; SelectAccount(username); // don't remove Console.WriteLine("got request to create or delete conference"); if (!IsAuthorized(username, pass)) { Console.WriteLine("User was not authorized"); _getConferences.Put("Result", 0, username); break; } if (requestType == 1) { //add _conferences.Put(username, conferenceName, ipOfConference); List <string> confList = _conferences.QueryAll(typeof(string), typeof(string), typeof(string)).Select(t => t.Get <string>(1)).ToList(); _getConferences.Get(typeof(List <string>)); _getConferences.Put(confList); Console.WriteLine("added conference " + conferenceName); _getConferences.Put("Result", 1, username); } if ((int)request[3] == 0) { //remove _conferences.Get(username, conferenceName, ipOfConference); List <string> confList = _conferences.QueryAll(typeof(string), typeof(string), typeof(string)).Select(t => t.Get <string>(1)).ToList(); _getConferences.Get(typeof(List <string>)); _getConferences.Put(confList); Console.WriteLine("removed conference " + conferenceName); } } }