Implementasi Metode Simple Additive Weighting dan Weighted Product Model Dalam Pemilihan Lembaga Bimbingan Belajar di Kota Medan

46

LAMPIRAN A : LISTING PROGRAM

1. Mainform
/*
* Created by SharpDevelop.
* User: User7
* Date: 28/09/2015
* Time: 9:38
*
* To change this template use Tools | Options | Coding | Edit
Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace home1
{
///

/// Description of MainForm.
///
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows
Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
void KRITERIALAHANToolStripMenuItemClick(object sender, Event
Args e)
{
Form a=new databimbingan();

a.Show();
}
void DATALAHANToolStripMenuItemClick(object sender, EventArgs
e)
{

Universitas Sumatera Utara

47

Form b=new kriteriabobot();
b.Show();
}
void EXITToolStripMenuItemClick(object sender, EventArgs e)
{
DialogResult button= MessageBox.Show("Are you sure want
to EXIT?","EXIT",
MessageBoxButtons.Ye
sNo,MessageBoxIcon.Question,
MessageBoxDefaultBut

ton.Button2);
if(button==DialogResult.Yes)
Application.Exit();
}

void ABOUTToolStripMenuItemClick(object sender, EventArgs e)
{
Form c=new about();
c.Show();
}
void HOMEToolStripMenuItemClick(object sender, EventArgs e)
{
}
void METODEToolStripMenuItemClick(object sender, EventArgs e)
{
Form f=new metode();
f.Show();
}
void Label2Click(object sender, EventArgs e)
{

}
void Label3Click(object sender, EventArgs e)
{
}
void Label1Click(object sender, EventArgs e)
{
}
void PictureBox2Click(object sender, EventArgs e)
{

Universitas Sumatera Utara

48

}
void Label42Click(object sender, EventArgs e)
{
}
}
}

2. About
/*
* Created by SharpDevelop.
* User: User7
* Date: 28/09/2015
* Time: 10:09
*
* To change this template use Tools | Options | Coding | Edit
Standard Headers.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace home1
{
///
/// Description of about.
///
public partial class about : Form
{

public about()
{
//
// The InitializeComponent() call is required for Windows
Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}

void AboutLoad(object sender, EventArgs e)
{
}

Universitas Sumatera Utara

49


void Label2Click(object sender, EventArgs e)
{
}
void PictureBox2Click(object sender, EventArgs e)
{
}
void Label3Click(object sender, EventArgs e)
{
}
void Label1Click(object sender, EventArgs e)
{
}
void Label4Click(object sender, EventArgs e)
{
}
void Label6Click(object sender, EventArgs e)
{
}
void Label8Click(object sender, EventArgs e)

{
}
}
}
3.Metode
/*
* Created by SharpDevelop.
* User: User7
* Date: 28/09/2015
* Time: 10:58
*
* To change this template use Tools | Options | Coding | Edit
Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using MySql.Data.MySqlClient;


Universitas Sumatera Utara

50

using System.Data;
using System.Data.OleDb;
namespace home1
{
///
/// Description of metode.
///
public partial class metode : Form
{
MySqlConnection koneksi2 =
new MySqlConnection("server=localhost;port=3306;username=root
;password=");
double maxc1,maxc2,maxc3,maxc4,minc5,minc6,minc7,minc8;
double tertinggi=0;
string lahanterbaik,temp_pm;
public metode()

{
//
// The InitializeComponent() call is required for Windows
Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
void Panel2Paint(object sender, PaintEventArgs e)
{
}
void Button1Click(object sender, EventArgs e)
{
try
{
DateTime waktuawal,waktuakhir;
waktuawal=DateTime.Now;

double hc1,hc2,hc3,hc4,hc5,hc6,hc7,hc8;
string MyConnection2
= "server=localhost;port=3306;username=root;password=";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
//MySqlCommand MyCommand2 = new MySqlCommand(Query,
MyConn2);
MyConn2.Open();
MySqlCommand command1 = new MySqlCommand("select
max(C1) from db_spk_bimbel.tb_bobot",MyConn2);

Universitas Sumatera Utara

51

maxc1=Convert.ToDouble(command1.ExecuteScalar().ToStr
ing());
MySqlCommand command2 = new MySqlCommand("select
max(C2) from db_spk_bimbel.tb_bobot",MyConn2);
maxc2=Convert.ToDouble(command2.ExecuteScalar().ToStr
ing());
MySqlCommand command3 = new MySqlCommand("select
max(C3) from db_spk_bimbel.tb_bobot",MyConn2);
maxc3=Convert.ToDouble(command3.ExecuteScalar().ToStr
ing());
//MessageBox.Show("min" + minc3.ToString());
MySqlCommand command4 = new MySqlCommand("select
max(C4) from db_spk_bimbel.tb_bobot",MyConn2);
maxc4=Convert.ToDouble(command4.ExecuteScalar().ToStr
ing());
MySqlCommand command5 = new MySqlCommand("select
min(C5) from db_spk_bimbel.tb_bobot",MyConn2);
minc5=Convert.ToDouble(command5.ExecuteScalar().ToStr
ing());
MySqlCommand kueri = new MySqlCommand("SELECT * FROM
db_spk_bimbel.tb_bobot",MyConn2);
string temp;
//kueri.CommandText = qw;
//koneksi.Open();
MySqlDataReader dr;
dr = kueri.ExecuteReader();
while(dr.Read())
{
temp = dr["nama"].ToString();
//matriks normalisasi
hc1 = (Convert.ToDouble(dr["c1"]))/maxc1;
hc2 = (Convert.ToDouble(dr["c2"]))/maxc2;
hc3 = (Convert.ToDouble(dr["c3"]))/maxc3;
hc4 = (Convert.ToDouble(dr["c4"]))/maxc4;
hc5 = (Convert.ToDouble(dr["c5"]))/minc5;
//perkalian dengan w
//MessageBox.Show(hc1.ToString());
double skor
= (hc1*0.3)+(hc2*0.2)+(hc3*0.15)+(hc4*0.25)+(hc5*0.1);

if (skor >= tertinggi){
tertinggi=skor;
lahanterbaik=temp;
}

Universitas Sumatera Utara

52

updateskorsaw(temp,hc1,hc2,hc3,hc4,hc5,skor);
}
//koneksi.Close();
MyConn2.Close();
waktuakhir=DateTime.Now;
TimeSpan lama =waktuakhir.Subtract(waktuawal);
textBox1.Text=lama.TotalMilliseconds.ToString()+"
MilliSeconds";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
lihatperangkingan();
sawtinggi.Text=lahanterbaik;
//datatertinggi_pm();
}
void lihatwpm(){
try{
string MyConnection2
= "server=localhost;port=3306;username=root;password=";
//Display query
string Query = "select * from db_spk_bimbel.tb_wpm
ORDER BY skor DESC;";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MyConn2.Open();
//For offline connection we weill
use MySqlDataAdapter class.
MySqlDataAdapter MyAdapter
= new MySqlDataAdapter();
MyAdapter.SelectCommand = MyCommand2;
//DataTable dTable = new DataTable();
DataTable dTable = new DataTable();
MyAdapter.Fill(dTable);
dataGridView1.DataSource = dTable; // here i have
assign dTable object to the dataGridView1 object to display
data.
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

Universitas Sumatera Utara

53

void lihatperangkingan()
{
try{
string MyConnection2
= "server=localhost;port=3306;username=root;password=";
//Display query
string Query = "select * from
db_spk_bimbel.tb_normalisasi_saw ORDER BY skor DESC;";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MyConn2.Open();
//For offline connection we weill
use MySqlDataAdapter class.
MySqlDataAdapter MyAdapter
= new MySqlDataAdapter();
MyAdapter.SelectCommand = MyCommand2;
//DataTable dTable = new DataTable();
DataTable dTable = new DataTable();
MyAdapter.Fill(dTable);
dataGridView4.DataSource = dTable; // here i have
assign dTable object to the dataGridView1 object to display
data.
MyConn2.Close();
}catch(Exception){
MessageBox.Show("Ada Error");
}
}
void updateskorsaw(string nama,double hc1,double hc2,double h
c3,double hc4,double hc5, double skor)
{
try{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string query2= "update
db_spk_bimbel.tb_normalisasi_saw set
normalisasi_c1='" + hc1+ "',normalisasi_c2='" +hc2+ "',normalisasi_c3
='" +hc3+ "',normalisasi_c4='" + hc4+ "',normalisasi_c5='" + hc5+ "',
skor='" + skor+ "' where nama='" + nama+ "';";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
//MySqlCommand MyCommand2 = new MySqlCommand(Query,
MyConn2);
MySqlCommand MyCommand3
= new MySqlCommand(query2, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();

Universitas Sumatera Utara

54

//MyReader2 = MyCommand2.ExecuteReader();
our query will be executed and data saved into the database.
MyReader2 = MyCommand3.ExecuteReader();
// MessageBox.Show("Save Data");
MyConn2.Close();

// Here

}catch(Exception){
MessageBox.Show("Ada Error");
}
}
void updateskorwpm(string nama,double hc1,double hc2,double h
c3,double hc4,double hc5, String skor)
{
try{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string query2= "update db_spk_bimbel.tb_wpm set
c1='" + hc1+ "',c2='" +hc2+ "',c3='" +hc3+ "',c4='" + hc4+ "',c5='" +
hc5+ "',skor='" + skor+ "' where
nama='" + nama+ "';";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
//MySqlCommand MyCommand2 = new MySqlCommand(Query,
MyConn2);
MySqlCommand MyCommand3
= new MySqlCommand(query2, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
//MyReader2 = MyCommand2.ExecuteReader();
// Here
our query will be executed and data saved into the database.
MyReader2 = MyCommand3.ExecuteReader();
// MessageBox.Show("Save Data");
MyConn2.Close();
}catch(Exception){
MessageBox.Show("Ada Error");
}
}
void Button2Click(object sender, EventArgs e)
{
try{
DateTime waktuawal,waktuakhir;
waktuawal=DateTime.Now;
double hc1,hc2,hc3,hc4,hc5,skorwpm;
double tinggi=0;
string MyConnection2
= "server=localhost;port=3306;username=root;password=";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
//MySqlCommand MyCommand2 = new MySqlCommand(Query,

Universitas Sumatera Utara

55

MyConn2);
MyConn2.Open();
MySqlCommand kueri = new MySqlCommand("SELECT *
FROM db_spk_bimbel.tb_bobot",MyConn2);
string temp;
//kueri.CommandText = qw;
//koneksi.Open();
MySqlDataReader dr;
dr = kueri.ExecuteReader();
while(dr.Read())
{
temp = dr["nama"].ToString();
//matriks normalisasi
hc1 =Math.Pow(0.3,(Convert.ToDouble(dr["c1"])));
hc2 = Math.Pow(0.2,(Convert.ToDouble(dr["c2"])));
hc3
=Math.Pow(0.15, (Convert.ToDouble(dr["c3"])));
hc4 =Math.Pow(0.25,(Convert.ToDouble(dr["c4"])));
hc5 =Math.Pow(0.1, (Convert.ToDouble(dr["c5"])));
skorwpm=hc1*hc2*hc3*hc4*hc5;
String
strskorwpm=skorwpm.ToString("0.####################");
//MessageBox.Show(skorwpm.ToString());
if (skorwpm >= tinggi){
tinggi=skorwpm;
textBox2.Text=temp;
}
updateskorwpm(temp,hc1,hc2,hc3,hc4,hc5,strskorwpm
);
}
MyConn2.Close();
lihatwpm();
waktuakhir=DateTime.Now;
TimeSpan lamawpm=waktuakhir.Subtract(waktuawal);
wpm_time.Text=lamawpm.TotalMilliseconds.ToString()+"
MilliSeconds";
}catch(Exception ex){
MessageBox.Show(ex.Message);
}
}
void MetodeLoad(object sender, EventArgs e)
{
}
void Label4Click(object sender, EventArgs e)

Universitas Sumatera Utara

56

{
}
void Panel1Paint(object sender, PaintEventArgs e)
{
}
void TextBox1TextChanged(object sender, EventArgs e)
{
}
void Label7Click(object sender, EventArgs e)
{
}
void DataGridView4CellContentClick(object sender, DataGridVie
wCellEventArgs e)
{
}
}
}
4.Bobot Kriteria
/*
* Created by SharpDevelop.
* User: User7
* Date: 28/09/2015
* Time: 9:54
*
* To change this template use Tools | Options | Coding | Edit
Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq.Expressions;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Data;
using System.Data.OleDb;
namespace home1
{
///
/// Description of kriteriabobot.
///
public partial class kriteriabobot : Form

Universitas Sumatera Utara

57

{
public kriteriabobot()
{
//
// The InitializeComponent() call is required for Windows
Forms designer support.
//
InitializeComponent();
lihat();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
void lihat(){
string MyConnection2
= "server=localhost;port=3306;username=root;password=";
//Display query
string Query = "select * from
db_spk_bimbel.tb_kriteriabobot;";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MyConn2.Open();
//For offline connection we weill
use MySqlDataAdapter class.
MySqlDataAdapter MyAdapter
= new MySqlDataAdapter();
MyAdapter.SelectCommand = MyCommand2;
//DataTable dTable = new DataTable();
DataTable dTable = new DataTable();
MyAdapter.Fill(dTable);
dataGridView1.DataSource = dTable; // here i have
assign dTable object to the dataGridView1 object to display
data.
MyConn2.Close();
}
void KriteriabobotLoad(object sender, EventArgs e)
{
}
}
}
5. Data Bimbingan
/*
* Created by SharpDevelop.
* User: User7

Universitas Sumatera Utara

58

* Date: 28/09/2015
* Time: 9:53
*
* To change this template use Tools | Options | Coding | Edit
Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq.Expressions;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Data;
using System.Data.OleDb;
namespace home1
{
///
/// Description of datalahan.
///
public partial class databimbingan : Form
{
double c1,c2,c3,c4,c5,c6,c7,c8,c9,c10;
double c1_pm,c2_pm,c3_pm,c4_pm,c5_pm,c6_pm,c7_pm,c8_pm;
double c1_pm_ideal,c2_pm_ideal,c3_pm_ideal,c4_pm_ideal,c5_pm_
ideal,c6_pm_ideal,c7_pm_ideal,c8_pm_ideal;
double c1_pm_gap,c2_pm_gap,c3_pm_gap,c4_pm_gap,c5_pm_gap,c6_p
m_gap,c7_pm_gap,c8_pm_gap;
double cf,sf,skor;
public databimbingan()
{
//
// The InitializeComponent() call is required for Windows
Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the
InitializeComponent() call.
//
}
void Button1Click(object sender, EventArgs e)
{
try
{

string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string Query = "insert into

Universitas Sumatera Utara

59

db_spk_bimbel.data_bimbel(nama,biaya,fasilitas,jumlah_pertemuan,jumla
h_lulus_PTN,jumlah_pengajar)
values('" +this.namabimbel.Text+ "','" +this.c1_biaya.Text+ "','" +th
is.c2_fasilitas.Text+ "','" +this.c3_jlh_pert.Text+ "','" +this.c4_jl
h_lls.Text+ "','" +this.c5_jlh_peng.Text+ "');";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
//MySqlCommand MyCommand3 = new MySqlCommand(query2,
MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
//
MyReader2 = MyCommand2.ExecuteReader();
ekskusi kueri masuk ke database.
// MyReader2 = MyCommand3.ExecuteReader();
MessageBox.Show("Data Tersimpan");
MyConn2.Close();

insertbobot();
insertsaw_normalisasi();
insertwpm();
resetisi();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void insertbobot()
{
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
//string Query = "insert into
db_padi.padisawah(nama,C1,C2,C3,C4,C5) values('"
+this.namapadisawah.Text+ "','" +c1+ "','" +c2+ "','" +c3+ "','" +c4+
"','" +c5+ "');";
string query2="insert into
db_spk_bimbel.tb_bobot(nama,c1,c2,c3,c4,c5)
values('" +this.namabimbel.Text+ "','" +c1+ "','" +c2+ "','" +c3+ "',
'" +c4+ "','" +c5+ "');";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);

Universitas Sumatera Utara

60

//MySqlCommand MyCommand2 = new MySqlCommand(Query,
MyConn2);
MySqlCommand MyCommand3
= new MySqlCommand(query2, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
//MyReader2 = MyCommand2.ExecuteReader();
our query will be executed and data saved into the database.
MyReader2 = MyCommand3.ExecuteReader();
// MessageBox.Show("Save Data");
MyConn2.Close();
}
catch (Exception ex)
{

// Here

MessageBox.Show(ex.Message);
}
}
void insertsaw_normalisasi()
{
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
//string Query = "insert into
db_padi.padisawah(nama,C1,C2,C3,C4,C5) values('"
+this.namapadisawah.Text+ "','" +c1+ "','" +c2+ "','" +c3+ "','" +c4+
"','" +c5+ "');";
string query2="insert into
db_spk_bimbel.tb_normalisasi_saw(nama,normalisasi_c1,normalisasi_c2,n
ormalisasi_c3,normalisasi_c4,normalisasi_c5,skor)
values('" +this.namabimbel.Text+ "','" +c1+ "','" +c2+ "','" +c3+ "',
'" +c4+ "','" +c5+ "','" +0+ "');";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
//MySqlCommand MyCommand2 = new MySqlCommand(Query,
MyConn2);
MySqlCommand MyCommand3
= new MySqlCommand(query2, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
//MyReader2 = MyCommand2.ExecuteReader();
// Here
our query will be executed and data saved into the database.
MyReader2 = MyCommand3.ExecuteReader();
// MessageBox.Show("Save Data");
MyConn2.Close();
}
catch (Exception ex)
{

Universitas Sumatera Utara

61

MessageBox.Show(ex.Message);
}
}
void insertwpm()
{
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
//string Query = "insert into
db_padi.padisawah(nama,C1,C2,C3,C4,C5) values('"
+this.namapadisawah.Text+ "','" +c1+ "','" +c2+ "','" +c3+ "','" +c4+
"','" +c5+ "');";
string query2="insert into
db_spk_bimbel.tb_wpm(nama,c1,c2,c3,c4,c5,skor)
values('" +this.namabimbel.Text+ "','" +c1+ "','" +c2+ "','" +c3+ "',
'" +c4+ "','" +c5+ "','" +0+ "');";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
//MySqlCommand MyCommand2 = new MySqlCommand(Query,
MyConn2);
MySqlCommand MyCommand3
= new MySqlCommand(query2, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
//MyReader2 = MyCommand2.ExecuteReader();
// Here
our query will be executed and data saved into the database.
MyReader2 = MyCommand3.ExecuteReader();
// MessageBox.Show("Save Data");
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

void Unsur1SelectedIndexChanged(object sender, EventArgs e)
{
if (c2_fasilitas.SelectedIndex==0){
c2=1;

}
else if (c2_fasilitas.SelectedIndex==1){

Universitas Sumatera Utara

62

c2=1.5;

}
else if (c2_fasilitas.SelectedIndex==2){
c2=3;

}
else if (c2_fasilitas.SelectedIndex==3){
c2=5;

}
}
void Unsur2SelectedIndexChanged(object sender, EventArgs e)
{
if (c3_jlh_pert.SelectedIndex==0){
c3=1;

}
else if (c3_jlh_pert.SelectedIndex==1){
c3=2;

}
else if (c3_jlh_pert.SelectedIndex==2){
c3=2.5;

}
else if (c3_jlh_pert.SelectedIndex==3){
c3=3;
}
else if (c3_jlh_pert.SelectedIndex==4){
c3=4;

}
}
void Unsur3SelectedIndexChanged(object sender, EventArgs e)
{
if (c4_jlh_lls.SelectedIndex==0){
c4=1;

Universitas Sumatera Utara

63

}
else if (c4_jlh_lls.SelectedIndex==1){
c4=1.5;

}
else if (c4_jlh_lls.SelectedIndex==2){
c4=2;

}
else if (c4_jlh_lls.SelectedIndex==3){
c4=4;

}
else if (c4_jlh_lls.SelectedIndex==4){
c4=5;

}
}

void Button4Click(object sender, EventArgs e)
{
try
{
string MyConnection2
= "server=localhost;port=3306;username=root;password=";
//Display query
string Query = "select * from
db_spk_bimbel.data_bimbel;";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MyConn2.Open();
//For offline connection we weill
use MySqlDataAdapter class.
MySqlDataAdapter MyAdapter
= new MySqlDataAdapter();
MyAdapter.SelectCommand = MyCommand2;
//DataTable dTable = new DataTable();
DataTable dTable = new DataTable();
MyAdapter.Fill(dTable);
dataGridView1.DataSource = dTable; // here i have
assign dTable object to the dataGridView1 object to display

Universitas Sumatera Utara

64

data.
MyConn2.Close();

string MyConnectionpm
= "server=localhost;port=3306;username=root;password=";
//Display query
string Querypm = "select * from
db_spk_bimbel.tb_bobot;";
MySqlConnection MyConnpm
= new MySqlConnection(MyConnectionpm);
MySqlCommand MyCommandpm
= new MySqlCommand(Querypm, MyConnpm);
MyConnpm.Open();
//For offline connection we weill
use MySqlDataAdapter class.
MySqlDataAdapter MyAdapterpm
= new MySqlDataAdapter();
MyAdapterpm.SelectCommand = MyCommandpm;
//DataTable dTable = new DataTable();
DataTable dTablepm = new DataTable();
MyAdapterpm.Fill(dTablepm);
dataGridView2.DataSource = dTablepm; // here i
have assign dTable object to the dataGridView1 object to display
data.
MyConnpm.Close();
resetisi();

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void Button2Click(object sender, EventArgs e)
{
resetisi();
}
void resetisi(){
namabimbel.Text="";
c1_biaya.Text=null;
c2_fasilitas.Text=null;
c3_jlh_pert.Text=null;
c4_jlh_lls.Text=null;
c5_jlh_peng.Text=null;
}
void Button3Click(object sender, EventArgs e)

Universitas Sumatera Utara

65

{
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string Query = "delete from db_spk_bimbel.data_bimbel
where nama='" + this.namabimbel.Text + "';";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
MessageBox.Show("Data Deleted");
MyConn2.Close();
deletebobot();
deletesaw();
deletewpm();
resetisi();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void deletebobot(){
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string Query = "delete from db_spk_bimbel.tb_bobot
where nama='" + this.namabimbel.Text + "';";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
//MessageBox.Show("Data Deleted");
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

Universitas Sumatera Utara

66

}
void deletesaw(){
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string Query = "delete from
db_spk_bimbel.tb_normalisasi_saw where
nama='" + this.namabimbel.Text + "';";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
//MessageBox.Show("Data Deleted");
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void deletewpm(){
try
{
string MyConnection2
= "datasource=localhost;port=3306;username=root;password=";
string Query = "delete from db_spk_bimbel.tb_wpm
where nama='" + this.namabimbel.Text + "';";
MySqlConnection MyConn2
= new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2
= new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
// MessageBox.Show("Data Deleted");
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

Universitas Sumatera Utara

67

}
void statusBiayaSelectedIndexChanged(object sender, EventArgs
e)
{
if (c1_biaya.SelectedIndex==0){
c1=5;
}
else if (c1_biaya.SelectedIndex==1){
c1=3;

}
else if (c1_biaya.SelectedIndex==2){
c1=2.5;

}else if (c1_biaya.SelectedIndex==3){
c1=2;
}else if (c1_biaya.SelectedIndex==4){
c1=1;

}
}
void jlhpengajarSelectedIndexChanged(object sender, EventArgs
e)
{
if (c5_jlh_peng.SelectedIndex==0){
c5=1;

}
else if (c5_jlh_peng.SelectedIndex==1){
c5=2;

}
else if (c5_jlh_peng.SelectedIndex==2){
c5=2.5;

}
else if (c5_jlh_peng.SelectedIndex==3){
c5=3.5;

Universitas Sumatera Utara

68

}
else if (c5_jlh_peng.SelectedIndex==3){
c5=4;

}
else if (c5_jlh_peng.SelectedIndex==4){
c5=5;

}
}
void DataGridView1CellContentClick(object sender, DataGridVie
wCellEventArgs e)
{
namabimbel.Text=
dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
}
void DataGridView2CellContentClick(object sender, DataGridVie
wCellEventArgs e)
{
namabimbel.Text=
dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
}
void DatabimbinganLoad(object sender, EventArgs e)
{
}
void GroupBox2Enter(object sender, EventArgs e)
{
}
}
}

Universitas Sumatera Utara

69

CURRICULUM VITAE
------------------------------------------------------------------------------------------------------Data Pribadi

Nama

: M. Pristian R.

Tempat/Tanggal Lahir: Lhokseumawe, 16 Oktober 1992
Jenis Kelamin

: Laki-laki

Tinggi/Berta Badan

: 165 cm / 45 kg

Agama

: Islam

Kewarganegaraan

: Indonesia

Status

: Belum Menikah

Alamat

: Jl. Perjuangan No. 8, Setia Budi Medan, Sumatera Utara

No Hp

: 082362287622

Email

: pristian.mohd@yahoo.com

------------------------------------------------------------------------------------------------------Riwayat Pendidikan

[1998 – 2004]

: SD Swasta Iskandar Muda

[2004 – 2007]

: SMP Swasta Iskandar Muda

[2007 – 2010]

: SMA Swasta Iskandar Muda

[2010 – 2015]

: S-1 Ilmu Komputer Universitas Sumatera Utara

------------------------------------------------------------------------------------------------------Kemampuan IT :




Mampu mengoperasikan Microsoft Office (Ms.Word, Ms.Excel,
Ms.Power Point).
Mampu mengoperasikan Adobe Photoshop

Kemampuan Bahasa:

Universitas Sumatera Utara

70




Bahasa Inggris
Bahasa Indonesia

Universitas Sumatera Utara