using System; using System.Collections.Generic; using System.Text; using com.lim.mimapi; using MimException = com.lim.mimapi.MimException; /** * Add a relation to the Demo folder with some defaults. */ namespace DEMO_MIMAPI { class addRelation { MimConnection mim = null; public void execute(String host, Int32 port, string relation) { try { MimDate exp_date = new MimDate(2008, 6, 1); MimDate first_notice = new MimDate(2007, 1, 1); // Connect to MIM server mim = ConnectionFactory.connect(host, port, "AddRelation"); MimSchema ms = mim.getSchemaManager(); // Create Relation Object Relation r = new Relation(relation, "Demo"); r.setDescription("Demo Example"); r.setExchange("1"); r.setExchange("CST"); r.setBeginTradingTime(new MimTime(10, 0, 0, 0)); r.setEndTradingTime(new MimTime(11, 0, 0, 0)); mim.lockDb(); // Add Relation to the MIM's Schema ms.addRelation(r); mim.unlock(); } catch (Exception e) { Console.Out.WriteLine("Exception: " + e.Message); } finally { try { if (mim != null) mim.disconnect(); } catch (Exception e) { Console.Out.WriteLine("Exception: " + e.Message); } } } } }