public void ValueView() { int[] temp; tree.ExpandAll(); Rumus.SearchAllGain(); for (int i = 0; i < 5; i++) { tree.Nodes[0].Nodes[i].Text = SetText(Rumus.coloumAndGain[i].Coloum, Rumus.coloumAndGain[i].Gain.ToString(), 18); } //double test = Rumus.Entropy(3,0,3); //jenis beasiswa; temp = DatabaseScript.SearchDataEntropy("Jenis_beasiswa", "BBM"); tree.Nodes[1].Nodes[0].Nodes[0].Text = SetText("BBM", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 5); temp = DatabaseScript.SearchDataEntropy("Jenis_beasiswa", "PPA"); tree.Nodes[1].Nodes[0].Nodes[1].Text = SetText("PPA", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 5); //prestasi temp = DatabaseScript.SearchDataEntropy("Prestasi", "Internasional"); tree.Nodes[1].Nodes[4].Nodes[0].Text = SetText("Internasional", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); temp = DatabaseScript.SearchDataEntropy("Prestasi", "Nasional"); tree.Nodes[1].Nodes[4].Nodes[1].Text = SetText("Nasional", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); temp = DatabaseScript.SearchDataEntropy("Prestasi", "Regional"); tree.Nodes[1].Nodes[4].Nodes[2].Text = SetText("Regional", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); temp = DatabaseScript.SearchDataEntropy("Prestasi", "Lokal"); tree.Nodes[1].Nodes[4].Nodes[3].Text = SetText("Lokal", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); //aktif anggota temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Ketua"); tree.Nodes[1].Nodes[2].Nodes[0].Text = SetText("Ketua", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Pengurus"); tree.Nodes[1].Nodes[2].Nodes[1].Text = SetText("Pengurus", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Anggota"); tree.Nodes[1].Nodes[2].Nodes[2].Text = SetText("Anggota", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); //Semesta temp = DatabaseScript.SearchDataEntropy("Select count(IF(Diterima ='ya',1,Null)) as ya,count(IF(Diterima ='tidak',1,Null)) as tidak,count(IF(Diterima,1,Null)) as total from beasiswa;"); tree.Nodes[1].Nodes[5].Text = SetText("Semesta", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); //Financial temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 1000000,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Financial <= 1000000,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Financial <= 1000000,1,Null)) Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[0].Text = SetText(" <=1jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[1].Text = SetText(" 1jt - 5jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[2].Text = SetText(" 5jt - 7.5jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[3].Text = SetText("7.5jt - 10jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial > 10000000,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Financial > 10000000,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Financial > 10000000,1,Null)) Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[4].Text = SetText(" > 10jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); //IPK temp = DatabaseScript.SearchDataEntropy("select count(if(ipk = '4',1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(ipk = '4',1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(ipk = '4',1,Null)) Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[0].Text = SetText(" 4 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[1].Text = SetText(" 4 - 3.5 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[2].Text = SetText("3.5 - 3.25", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[3].Text = SetText("3.25- 3 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3,1,Null))as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[4].Text = SetText(" < 3 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); }
public static float SearchGain(int coloum) //Mencari Gain sesuai colom; { float Hasil = 0.0f; int[,] data = new int[1, 3]; int[] temp = new int[3]; switch (coloum) { case 1: { data = new int[3, 3]; for (int i = 1; i < 3; i++) { if (i == 1) { temp = DatabaseScript.SearchDataEntropy("Jenis_beasiswa", "PPA"); } else { temp = DatabaseScript.SearchDataEntropy("Jenis_beasiswa", "BBM"); } data[i, 0] = temp[0]; data[i, 1] = temp[1]; data[i, 2] = temp[2]; } break; } case 2: { data = new int[6, 3]; for (int i = 1; i < 4; i++) { if (i == 1) { //ipk 4 temp = DatabaseScript.SearchDataEntropy("select count(if(ipk = '4',1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(ipk = '4',1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(ipk = '4',1,Null)) Total from beasiswa;"); } else if (i == 2) { temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null)) as Total from beasiswa;"); } else if (i == 3) { temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null)) as Total from beasiswa;"); } else if (i == 4) { temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null)) as Total from beasiswa;"); } else if (i == 5) { temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3,1,Null))as Total from beasiswa;"); } data[i, 0] = temp[0]; data[i, 1] = temp[1]; data[i, 2] = temp[2]; } break; } case 3: { data = new int[4, 3]; for (int i = 1; i < 4; i++) { if (i == 1) { temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Ketua"); } else if (i == 2) { temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Pengurus"); } else if (i == 3) { temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Anggota"); } data[i, 0] = temp[0]; data[i, 1] = temp[1]; data[i, 2] = temp[2]; } break; } case 4: { data = new int[6, 3]; for (int i = 1; i < 4; i++) { if (i == 1) { temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 1000000,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Financial <= 1000000,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Financial <= 1000000,1,Null)) Total from beasiswa;"); } else if (i == 2) { temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null)) as Total from beasiswa;"); } else if (i == 3) { temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null)) as Total from beasiswa;"); } else if (i == 4) { temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null)) as Total from beasiswa;"); } else if (i == 5) { temp = DatabaseScript.SearchDataEntropy("select count(if(Financial > 10000000,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Financial > 10000000,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Financial > 10000000,1,Null)) Total from beasiswa;"); } data[i, 0] = temp[0]; data[i, 1] = temp[1]; data[i, 2] = temp[2]; } break; } case 5: { data = new int[6, 3]; for (int i = 1; i < 4; i++) { if (i == 1) { temp = DatabaseScript.SearchDataEntropy("select count(if(Prestasi is null,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Prestasi is null,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Prestasi is null,1,Null)) Total from beasiswa;"); } else if (i == 2) { temp = DatabaseScript.SearchDataEntropy("Prestasi", "Internasional"); } else if (i == 3) { temp = DatabaseScript.SearchDataEntropy("Prestasi", "Nasional"); } else if (i == 4) { temp = DatabaseScript.SearchDataEntropy("Prestasi", "Regional"); } else if (i == 5) { temp = DatabaseScript.SearchDataEntropy("Prestasi", "Lokal"); } data[i, 0] = temp[0]; data[i, 1] = temp[1]; data[i, 2] = temp[2]; } break; } default: { break; } } temp = DatabaseScript.SearchDataEntropy("Select count(IF(Diterima ='ya',1,Null)) as ya,count(IF(Diterima ='tidak',1,Null)) as tidak,count(IF(Diterima,1,Null)) as total from beasiswa;"); data[0, 0] = temp[0]; data[0, 1] = temp[1]; data[0, 2] = temp[2]; Hasil = Gain(data); return(Hasil); }