public void TestGetNetWorkFromDatabase()
 {
     DB_Manager db = new DB_Manager("networkvis");
     Graph g = db.get_network("ABC");
     Assert.AreEqual(true, g != null);
     db.close();
 }
 public static DataTable EdgeGen(DB_Manager dbm, DataTable Vertex, String first, String second)
 {
     DataTable group = dbm.mysql_query(String.Format("SELECT {0},{1} FROM networkvis.allinone GROUP BY {2};", first, second, first));
     
     DataTable result = new DataTable();
     result.Columns.Add("FromID", typeof(int));
     result.Columns.Add("ToID", typeof(int));
     for (int id = 0; id < group.Rows.Count;id++)
     {
         DataRow row = group.Rows[id];
         String Content = row[second].ToString();
         for (int id2 = 0; id2 < id; id2++)
         {
             DataRow data = group.Rows[id2];
             //Console.WriteLine(data[second].ToString() + " " + Content);
             if (Content.Equals(data[second].ToString()))
             {
                 DataRow edge = result.NewRow();
                 edge["FromID"] = id;
                 edge["ToID"] = id2;
                 result.Rows.Add(edge);
                 
                 break;
             }
         }
     }
     return result;
 }
 public NetworkID(DB_Manager db, EventHandler<IgraphGenerateEvent> _e)
 {
     InitializeComponent();
     loadNetwork(listView1, db.list_network());
     GraphGenerated = _e;
     db.close();
 }
 public GenerateGraph(DB_Manager _dbm, EventHandler<IgraphGenerateEvent> _e)
 {
     dbm = _dbm;
     GraphGenerated = _e;
     InitializeComponent();            
     loadVertexFields(listView1);
     loadEdgeFields(listView2, preview_vertex.getFirst());
     comboBox1.SelectedIndex = 0;
 }
 public void Testlist_net()
 {
     DB_Manager db = new DB_Manager("networkvis");
     DataTable dt = db.list_network();
     String[] post = db.list_post_schema();
     db.list_post_like_schema();
     Assert.AreEqual(true, dt != null);
     Assert.AreEqual(true, post.Length > 0);
     db.close();
 }
 public PreviewVertex(DB_Manager dbm)
 {
     String[] fields = dbm.list_post_schema();
     list_set = new ListViewItem[fields.Length];
     for (int i = 0; i < fields.Length; i++)
     {
         list_set[i] = new ListViewItem(fields[i], 0);
         append(dbm.mysql_query(String.Format("select {0} from networkvis.allinone WHERE ({1} is not null and {2} != '') limit 10", fields[i], fields[i], fields[i])));
     }
     list_set[0].Selected = true;
 }
        public void TestGetNetWorkFromImporter()
        {
            DB_Manager db = new DB_Manager("networkvis");
            String[] post = db.list_post_schema();
            Assert.AreEqual(true, post.Length > 1);

            db.setting.vertexCol = post[0];
            db.setting.edgeCol = post[1];
            Graph g = db.get_network("ABC",0);
            Assert.AreEqual(true, g != null);
            db.close();
        }
        public void testConstructor()
        {
            EventHandler<IgraphGenerateEvent> handler = new System.EventHandler<IgraphGenerateEvent>(this.gen_graph_call_back);
            EventHandler<statusEventHandler> handler2 = new System.EventHandler<statusEventHandler>(this.get_network_call_back);
            DB_Manager db = new DB_Manager("networkvis");
            NetworkID UI_1 = new NetworkID(db, handler);
            GenerateGraph UI_2 = new GenerateGraph(db, handler);
            AskNetWorkID UI_3 = new AskNetWorkID(handler2);

            Assert.AreEqual(true, UI_1 != null);
            Assert.AreEqual(true, UI_2 != null);
            Assert.AreEqual(true, UI_3 != null);
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         Console.WriteLine(listView1.SelectedItems[0].Text);
         String ID = listView1.SelectedItems[0].Text;
         DB_Manager dbm = new DB_Manager("networkvis");
         this.Close();
         GraphGenerated(this, new IgraphGenerateEvent(dbm.get_network(ID)));
         
         /*TODO: Make query to generate graph*/
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     DB_Manager db = new DB_Manager("networkvis");
     DataTable dt = db.mysql_query(String.Format("SELECT DISTINCT NetworkID FROM networkvis.nodes WHERE NetworkID = '{0}'", textBox1.Text));
     
     if (dt.Rows.Count > 0)
     {
         return;
     }
     else
     {
         this.Close();
         inputGet(this, new statusEventHandler(1, textBox1.Text));
     }
 }
 private void generateFromDBToolStripMenuItem_Click(object sender, EventArgs e)
 {
     EventHandler<IgraphGenerateEvent> handler = new System.EventHandler<IgraphGenerateEvent>(this.SetAndShowGraph);
     DB_Manager dbm = new DB_Manager("networkvis");
     GenerateGraph genGraph = new GenerateGraph(dbm, handler);
     genGraph.Show(this);
 }
 private void loadFromDBToolStripMenuItem_Click(object sender, EventArgs e)
 {
     EventHandler<IgraphGenerateEvent> handler = new System.EventHandler<IgraphGenerateEvent>(this.SetAndShowGraph);
     DB_Manager dbm = new DB_Manager("networkvis");
     NetworkID nid = new NetworkID(dbm, handler);
     nid.Show(this);
 }