public NtConnection GetNtConnection() { if (ntConnection == null) { ntConnection = new NtConnection("http://neso/newton/", "user", "login"); } return ntConnection; }
/// <summary> /// Posts changes to the Newton API server /// </summary> /// <param name="connection">API server connection</param> /// <returns>True if succeed, otherwise false</returns> public bool Update(NtConnection connection) { Connection = connection; return Update(); }
/// <summary> /// Constructor /// </summary> /// <param name="connection">Connection to Newton API</param> public NtBusinessNeed(NtConnection connection) { Connection = connection; Clear(); }
static void Main(string[] args) { NtConnection connection = new NtConnection("http://oiltec-odessa.tenet.odessa.ua/newton/", "", ""); /// /// Get classifiers /// /// Uncomment to test NtClassifierCollection classifiers = connection.GetClassifiers(); //foreach(NtClassifier cls in classifiers) //{ // Console.Clear(); // Console.WriteLine(cls.ToString()); // Console.ReadKey(); // foreach(NtClassifierItem cls_item in cls.Items) // { // Console.WriteLine(cls_item.ToString()); // } // Console.ReadKey(); //} /// /// Get business needs /// Uncomment to test //NtBusinessNeedCollection bnc = connection.GetBusinessNeeds(); //foreach (NtBusinessNeed bn in bnc) //{ // Console.Clear(); // Console.WriteLine(bn.ToString()); // Console.WriteLine(); // Console.WriteLine("Press any key to continue... Q to quit"); // ConsoleKey ck = Console.ReadKey().Key; // if (ck == ConsoleKey.Q) // break; //} // Create business need //NtBusinessNeed newNeed = new NtBusinessNeed(connection); //newNeed.Title = "Моя нужда"; //newNeed.Description = "Описание моей нужды"; //newNeed = connection.AddBusinessNeed(newNeed); // Create business need (another approach) //NtBusinessNeed newNeed = new NtBusinessNeed(connection); //newNeed.Title = "Моя нужда"; //newNeed.Description = "Описание моей нужды"; //newNeed.Update(); //Console.WriteLine(newNeed.ToString()); //Console.ReadKey(); // Update business need //536c7117-7560-4ad7-9200-81f0d544bb23 //NtBusinessNeed need = connection.GetBuisnessNeed(Guid.Parse("DA9EB8B3-4F8B-4608-833E-6CEAF3B4A835")); NtBusinessNeed existingNeed = connection.GetBuisnessNeed(Guid.Parse("44786702-4596-4D41-8D9A-8F84FC966214")); Console.WriteLine(existingNeed.ToString()); Console.ReadKey(); existingNeed.Title = "Нужда моя"; existingNeed.Description = "Описание моей очень нужды"; existingNeed.RemoveAllClassifiers(); existingNeed.AddClassifier(classifiers[1]); existingNeed.Update(); Console.WriteLine(existingNeed.ToString()); Console.ReadKey(); }