Lampiran 1. Data Pelanggan - thesis.binus.ac.idthesis.binus.ac.id/Doc/Lampiran/2010-1-00606-STIF...
Transcript of Lampiran 1. Data Pelanggan - thesis.binus.ac.idthesis.binus.ac.id/Doc/Lampiran/2010-1-00606-STIF...
L1
LAMPIRAN
Lampiran 1. Data Pelanggan
CostumerID CustomerName Address Destination
1 AWANA, CV SELATAN PASAR PRAMBANAN JL.
NURI NO.30 KLURAK BARU
JOGJAKARTA
2 AGRINDO JAVA,
CV
JL. SEMARANG - PURWODADI KM 23 PURWODADI
3 ANUGRAH, UD JL. RAYA MANDING-JETIS
KEYONGAN KIDUL SABDODADI BA
BANTUL
4 JASA TANI JL. JENDRAL A. YANI C 64,
PEMALANG
PEMALANG
5 ABDI TANI KARYA JL. SURYO KUSUMO NO. 538,
MOJOBO KUDUS
KUDUS
6 ABDI TANI DS. KARABAN RT 05/01, PASAR
KARABAN - KUDUS
KUDUS
7 ARYA TANI, UD DESA NYAMPLUNG SARI 01/03 KEC.
PETARUKAN KAB. PEMA
PEMALANG
8 BINA TANI
MAKMUR
DS IGALUNAN RT05/11, JEPARA JEPARA
9 BINTANG AGUNG,
CV
JL. VETERAN NO. 63, PURWOREJO PURWOREJO
10 BINTANG TANI, UD DUSUN.SAWAHAN RT. 01/04,
BANTUL
BANTUL
11 BERKAH
AGROTAMA, CV
JL.MANDING KM.1, BREBES BREBES
12 BEN ASIL GROUP DS. LIMBUNG RT01/01, KEC.
KEDUNGTUBAN, KAB. BLORA
BLORA
13 CIPTA TANI JL BERINGIN NO. 18, TEMANGGUNG MAGELANG
14 GLOBAL AGRO
TANGGUH, PT
JL.TAMAN SISWA NO.86
YOGYAKARTA
JOGJAKARTA
15 INTAN TANI DESA PENGKOK RT 01/RW 03 KEC
KEDAWUNG, KENDAL
KENDAL
16 INDAH JAYA, UD JL GEREJA NO. 10 JEPON (DEPAN
KORAMIL JEPON)-BLORA
BLORA
17 JASA TANI, UD JL PASAR KELET 43 KELING,
SLEMAN
SLEMAN
18 MURAH TANI JL RAYA JEPARA KUDUS KM 13,
KUDUS
KUDUS
19 MURIA TANI, UD -
AGRINDO JAVA-
JL. RAYA GABUS, DEPAN PASAR
GABUS, KENDAL
KENDAL
20 MAKMUR TANI, UD DSN GOLENG RT.06 RW.04 DS
TERKESI, PURWOREJO
PURWOREJO
21 MARGO SUBUR DESA MARGOREJO RT 02 RW 06 PATI PATI
L2
CostumerID CustomerName Address Destination
22 MULYO TANI,
TOKO
JL.PURWODADI-KUDUS KM 17 DESA
PENGANTEN-KELAMBU-PU
PURWODADI
23 NIAGA TANI JL.RAYA GEMUH-CEPIRING NO.15
KEC. CEPIRING KAB.KEN
KENDAL
24 PODOMORO TANI JALAN DESA GEBANG KEC.GEMUH
KAB.KENDAL
KENDAL
25 PRASETYO TANI BANJARSARI RT01 MULUR, TEGAL TEGAL
26 PUSAKA TANI JLN.STASIUN NO.67
KETANGGUNGAN BARAT, BREBES
BREBES
27 RIZKI ABADI, UD DESA NGAWEN RT.02 RW 01,
PEMALANG
PEMALANG
28 RESTU TANI DS. JATI TENGAH, KEC. SUKODONO,
KAB. SLEMAN
SLEMAN
29 SUMBER MAKMUR,
UD
KOMP. PASAR PERTAHANAN
KEBUMEN
KEBUMEN
30 SAHABAT TANI,
TOKO (H. RIYANTO
JL. RAYA KUDUS PURWODADI PURWODADI
31 SUMBER MAKMUR
,CV
JL.LAUT BOPONG,PURING,KEBUMEN KEBUMEN
32 SRI AGUNG JL. VETERAN 22,
MOJOLABAN,BECONANG,
PURWODADI
PURWODADI
33 SARANA TANI
(AGUS H.)
DUKUH KRAJAAN RT.002 RW.001
PIDODOKULON KEC.PATEBO
KENDAL
34 SENTRA TANI DS. TAMBAH ROTO RT 04/05, DEMAK DEMAK
35 SERBAGUNA,
TOKO
JL.SULTAN FATAH NO.1 DEPAN
PASAR BINTARO DEMAK
DEMAK
36 TANI JAYA KADI LANGU RT 01/03 BAKI, KUDUS KUDUS
KADI LANGU RT 01/
37 TAMAS (TANI
MAJU),CV
KOMPLEK TERMINAL ANGKOT,
JOGJAKARTA
JOGJAKARTA
38 TANI LANGGENG,
TOKO
JL.TAMBAKROMO-MAITAN RT 05 RW
02, BANTUL
BANTUL
39 UNTUNG TANI DUKUH BONGKOTAN DS
KETUNDAN, SEMARANG
SEMARANG
40 UPAYA TANI JL. BANDAR RAYA 186, BANDAR
BATANG, PURWODADI
PURWODADI
L3
Lampiran 2. Data Jarak
DistanceID Start DestinationWay KM PriceForDelivery Via
1 PATI REMBONG 20 42500
2 REMBONG BLORA 23 45000
3 PATI BLORA 20 42500 REMBONG
4 BLORA PURWODADI 35 50000
5 PATI PURWODADI 20 42500 REMBONG
6 PATI PURWODADI 23 45000 BLORA
7 PATI JEPARA 75 86000
8 PATI KUDUS 25 45000
9 KUDUS JEPARA 20 40000
10 PATI JEPARA 25 45000 KUDUS
11 KUDUS DEMAK 15 30000
12 PATI DEMAK 25 45000 KUDUS
13 DEMAK PURWODADI 20 43000
14 PATI PURWODADI 25 45000 KUDUS
15 PATI PURWODADI 15 30000 DEMAK
16 DEMAK SEMARANG 45 70000
17 PATI SEMARANG 25 45000 KUDUS
18 PATI SEMARANG 15 30000 DEMAK
19 SEMARANG KENDAL 20 42500
20 PATI KENDAL 25 45000 KUDUS
21 PATI KENDAL 15 30000 DEMAK
22 PATI KENDAL 45 70000 SEMARANG
23 SEMARANG REMANGGUNG 80 180000
24 PATI TEMANGGUNG 25 45000 KUDUS
25 PATI TEMANGGUNG 15 30000 DEMAK
26 PATI TEMANGGUNG 45 70000 SEMARANG
27 KENDAL PEKALONGAN 75 130000
28 PATI PEKALONGAN 25 45000 KUDUS
29 PATI PEKALONGAN 15 30000 DEMAK
30 PATI PEKALONGAN 45 70000 SEMARANG
31 PATI PEKALONGAN 20 42500 KENDAL
32 PEKALONGAN PEMALANG 25 37500
33 PATI PEMALANG 25 37500 KUDUS
34 PATI PEMALANG 15 30000 DEMAK
35 PATI PEMALANG 45 70000 SEMARANG
36 PATI PEMALANG 20 42500 KENDAL
37 PATI PEMALANG 75 130000 PEKALONGAN
L4
DistanceID Start DestinationWay KM PriceForDelivery Via
38 PEMALANG TEGAL 25 35000
39 PATI TEGAL 25 45000 KUDUS
40 PATI TEGAL 15 30000 DEMAK
41 PATI TEGAL 45 70000 SEMARANG
42 PATI TEGAL 20 42500 KENDAL
43 PATI TEGAL 75 130000 PEKALONGAN
44 PATI TEGAL 25 37500 PEMALANG
45 TEGAL BREBES 15 35000
46 PATI BREBES 25 45000 KUDUS
47 PATI BREBES 15 30000 DEMAK
48 PATI BREBES 45 70000 SEMARANG
49 PATI BREBES 20 42500 KENDAL
50 PATI BREBES 75 130000 PEKALONGAN
51 PATI BREBES 25 37500 PEMALANG
52 PATI BREBES 25 35000 TEGAL
53 PEMALANG PURWOKERTO 85 180000
54 PATI PURWOKERTO 25 45000 KUDUS
55 PATI PURWOKERTO 15 30000 DEMAK
56 PATI PURWOKERTO 45 70000 SEMARANG
57 PATI PURWOKERTO 20 42500 KENDAL
58 PATI PURWOKERTO 75 130000 PEKALONGAN
59 PATI PURWOKERTO 25 37500 PEMALANG
60 TEMANGGUNG PURWOKERTO 160 250000
61 PATI PURWOKERTO 80 180000 TEMANGGUNG
62 PURWOKERTO KEBUMEN 175 250000
63 PATI KEBUMEN 25 45000 KUDUS
64 PATI KEBUMEN 15 30000 DEMAK
65 PATI KEBUMEN 45 70000 SEMARANG
66 PATI KEBUMEN 80 180000 TEMANGGUNG
67 PATI KEBUMEN 160 250000 PURWOKERTO
68 TEMANGGUNG MAGELANG 43 65000
69 PATI MAGELANG 25 45000 KUDUS
70 PATI MAGELANG 15 30000 DEMAK
71 PATI MAGELANG 45 70000 SEMARANG
72 PATI MAGELANG 80 180000 TEMANGGUNG
73 MAGELANG PURWOREJO 40 80000
74 PATI PURWOREJO 25 45000 KUDUS
75 PATI PURWOREJO 15 30000 DEMAK
76 PATI PURWOREJO 45 70000 SEMARANG
L5
DistanceID Start DestinationWay KM PriceForDelivery Via
77 PATI PURWOREJO 80 180000 TEMANGGUNG
78 PATI PURWOREJO 43 65000 MAGELANG
79 MAGELANG JOGJAKARTA 43 80000
80 PATI JOGJAKARTA 25 45000 KUDUS
81 PATI JOGJAKARTA 15 30000 DEMAK
82 PATI JOGJAKARTA 45 70000 SEMARANG
83 PATI JOGJAKARTA 80 180000 TEMANGGUNG
84 PATI JOGJAKARTA 43 65000 MAGELANG
85 PURWOREJO KEBUMEN 50 125000
86 PATI KEBUMEN 43 65000 MAGELANG
87 PATI KEBUMEN 40 80000 PURWOREJO
88 PURWOREJO BANTUL 80 140000
89 PATI BANTUL 25 45000 KUDUS
90 PATI BANTUL 15 30000 DEMAK
91 PATI BANTUL 45 70000 SEMARANG
92 PATI BANTUL 80 180000 TEMANGGUNG
93 PATI BANTUL 43 65000 MAGELANG
94 PATI BANTUL 40 80000 PURWOREJO
95 PURWODADI JOGJAKARTA 280 400000
96 PATI JOGJAKARTA 25 45000 KUDUS
97 PATI JOGJAKARTA 15 30000 DEMAK
98 PATI JOGJAKARTA 20 43000 PURWODADI
99 PATI JOGJAKARTA 20 42500 REMBONG
100 PATI JOGJAKARTA 23 45000 BLORA
101 PATI JOGJAKARTA 35 50000 PURWODADI
102 JOGJAKARTA BANTUL 22 40000
103 PATI BANTUL 25 45000 KUDUS
104 PATI BANTUL 15 30000 DEMAK
105 PATI BANTUL 20 43000 PURWODADI
106 PATI BANTUL 280 400000 JOGJAKARTA
107 PATI BANTUL 20 42500 REMBONG
108 PATI BANTUL 23 45000 BLORA
109 PATI BANTUL 30 50000 PURWODADI
L6
Lampiran 3. Data Transaksi
CustomerName Address Destination ProductName Price Quan
tity
DeliveryDate
CIPTA TANI JL BERINGIN NO. 18,
TEMANGGUNG
MAGELANG Centazole 250
EC Kemasan 80
ml
125000
0
4 18/11/2009
SUMBER
MAKMUR, UD
KOMP. PASAR
PERTAHANAN
KEBUMEN
KEBUMEN Extratine 200
EC Kemasan
400 ml
820000 5 15/11/2009
BEN ASIL
GROUP
DS. LIMBUNG RT01/01,
KEC. KEDUNGTUBAN,
KAB. BLORA
BLORA Alphador 10
WP Kemasan
100 gr
600000 2 18/11/2009
BEN ASIL
GROUP
DS. LIMBUNG RT01/01,
KEC. KEDUNGTUBAN,
KAB. BLORA
BLORA Alphadine 6 GR
Kemasan 1 kg
92000 10 18/11/2009
BINA TANI
MAKMUR
DS IGALUNAN
RT05/11, JEPARA
JEPARA Indodine 6 GR
Kemasan 1 kg
92000 10 19/11/2009
BINA TANI
MAKMUR
DS IGALUNAN
RT05/11, JEPARA
JEPARA Alphadine 6 GR
Kemasan 1 kg
92000 10 19/11/2009
JASA TANI JL. JENDRAL A. YANI
C 64, PEMALANG
PEMALANG Centafur 3 GR
Kemasan 1 kg
82500 350 19/11/2009
UNTUNG TANI DUKUH BONGKOTAN
DS KETUNDAN,
SEMARANG
SEMARANG Extratine 200
EC Kemasan
400 ml
820000 25 23/11/2009
PRASETYO
TANI
BANJARSARI RT01
MULUR, TEGAL
TEGAL Indodine 6 GR
Kemasan 1 kg
92000 5 23/11/2009
PRASETYO
TANI
BANJARSARI RT01
MULUR, TEGAL
TEGAL Alphadine 6 GR
Kemasan 1 kg
92000 10 23/11/2009
PRASETYO
TANI
BANJARSARI RT01
MULUR, TEGAL
TEGAL Centadine 450
SL Kemasan
200 ml
576000 5 23/11/2009
PRASETYO
TANI
BANJARSARI RT01
MULUR, TEGAL
TEGAL Centadine 450
SL Kemasan
500 ml
550000 15 30/11/2009
PRASETYO
TANI
BANJARSARI RT01
MULUR, TEGAL
TEGAL Centafur 3 GR
Kemasan 2 kg
160000 25 30/11/2009
BINA TANI
MAKMUR
DS IGALUNAN
RT05/11, JEPARA
JEPARA Centafur 3 GR
Kemasan 1 kg
82500 300 02/12/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES Extratine 200
EC Kemasan
400 ml
820000 10 05/12/2009
GLOBAL AGRO
TANGGUH, PT
JL.TAMAN SISWA
NO.86 YOGYAKARTA
JOGJAKART
A
Primaxone 276
SL Kemasan
500 ml
375000 10 05/12/2009
GLOBAL AGRO
TANGGUH, PT
JL.TAMAN SISWA
NO.86 YOGYAKARTA
JOGJAKART
A
CentallyPlus 40
WG Kemasan
250 gr
150000
0
20 05/12/2009
MAKMUR TANI,
UD
DSN GOLENG RT.06
RW.04 DS TERKESI,
PURWOREJO
PURWOREJ
O
PilarQuat
Kemasan 5 Liter
460000 15 08/12/2009
MAKMUR TANI,
UD
DSN GOLENG RT.06
RW.04 DS TERKESI,
PURWOREJO
PURWOREJ
O
PilarQuat
Kemasan 1 Liter
500000 20 08/12/2009
L7
CustomerName Address Destination ProductName Price Quan
tity
DeliveryDate
MAKMUR TANI,
UD
DSN GOLENG RT.06
RW.04 DS TERKESI,
PURWOREJO
PURWOREJ
O
Alphadine 6 GR
Kemasan 1 kg
92000 5 08/12/2009
MAKMUR TANI,
UD
DSN GOLENG RT.06
RW.04 DS TERKESI,
PURWOREJO
PURWOREJ
O
PilarUp 480 SL
Kemasan 1 Liter
580000 4 08/12/2009
MAKMUR TANI,
UD
DSN GOLENG RT.06
RW.04 DS TERKESI,
PURWOREJO
PURWOREJ
O
PrimaUp 480
SL Kemasan 20
Liter
52000 4 08/12/2009
MAKMUR TANI,
UD
DSN GOLENG RT.06
RW.04 DS TERKESI,
PURWOREJO
PURWOREJ
O
PilarUp 480 SL
Kemasan 500
ml
248000 4 08/12/2009
PUSAKA TANI JLN.STASIUN NO.67
KETANGGUNGAN
BARAT, BREBES
BREBES PilarQuat
Kemasan 5 Liter
460000 20 10/12/2009
PUSAKA TANI JLN.STASIUN NO.67
KETANGGUNGAN
BARAT, BREBES
BREBES PilarQuat
Kemasan 1 Liter
500000 10 10/12/2009
PUSAKA TANI JLN.STASIUN NO.67
KETANGGUNGAN
BARAT, BREBES
BREBES Primax 485 SL
Kemasan 1 Liter
580000 5 10/12/2009
INDAH JAYA,
UD
JL GEREJA NO. 10
JEPON (DEPAN
KORAMIL JEPON)-
BLORA
BLORA Primax 485 SL
Kemasan 1 Liter
580000 10 13/12/2009
INDAH JAYA,
UD
JL GEREJA NO. 10
JEPON (DEPAN
KORAMIL JEPON)-
BLORA
BLORA PilarQuat
Kemasan 5 Liter
460000 10 13/12/2009
INDAH JAYA,
UD
JL GEREJA NO. 10
JEPON (DEPAN
KORAMIL JEPON)-
BLORA
BLORA Kill up 485 SL
Kemasan 1 Liter
580000 5 13/12/2009
SAHABAT
TANI, TOKO (H.
RIYANTO
JL. RAYA KUDUS
PURWODADI
PURWODAD
I
PilarQuat
Kemasan 5 Liter
460000 3 15/12/2009
MULYO TANI,
TOKO
JL.PURWODADI-
KUDUS KM 17 DESA
PENGANTEN-
KELAMBU-PU
PURWODAD
I
CBA 6 865 SL
Kemasan 5 Liter
660000 25 15/12/2009
MULYO TANI,
TOKO
JL.PURWODADI-
KUDUS KM 17 DESA
PENGANTEN-
KELAMBU-PU
PURWODAD
I
Rondaplus 360
/5 SL Kemasan
500 ml
240000 1 15/12/2009
MULYO TANI,
TOKO
JL.PURWODADI-
KUDUS KM 17 DESA
PENGANTEN-
KELAMBU-PU
PURWODAD
I
Kill up 485 SL
Kemasan 20
Liter
520000 1 15/12/2009
NIAGA TANI JL.RAYA GEMUH-
CEPIRING NO.15 KEC.
CEPIRING KAB.KEN
KENDAL Centafur 3 GR
Kemasan 1 kg
82500 300 15/11/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES PilarQuat
Kemasan 5 Liter
460000 83 15/11/2009
L8
CustomerName Address Destination ProductName Price Quan
tity
DeliveryDate
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES PilarQuat
Kemasan 1 Liter
500000 50 15/11/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES PrimaUp 480
SL Kemasan 1
Liter
580000 38 15/11/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES PrimaUp 480
SL Kemasan 5
Liter
560000 37 15/11/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES Rondaplus 360
/5 SL Kemasan
500 ml
240000 38 15/11/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES Rondaplus 360
/5 SL Kemasan
4 Liter
648000 12 15/11/2009
BERKAH
AGROTAMA,
CV
JL.MANDING KM.1,
BREBES
BREBES PilarQuat
Kemasan 5 Liter
460000 17 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
PilarQuat
Kemasan 5 Liter
460000 5 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
PilarQuat
Kemasan 1 Liter
500000 5 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
Primax 485 SL
Kemasan 1 Liter
580000 3 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
Centafur 3 GR
Kemasan 2 kg
160000 30 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
Centadine 6 GR
Kemasan 1 kg
92000 5 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
Indodine 6 GR
Kemasan 1 kg
92000 5 15/11/2009
AWANA, CV SELATAN PASAR
PRAMBANAN JL. NURI
NO.30 KLURAK BARU
JOGJAKART
A
Alphadine 6 GR
Kemasan 1 kg
92000 5 15/11/2009
L9
Lampiran 4. Listing Program
Form CBA.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Project_CBA_Pati
{
public partial class FormCBA : Form
{
public FormCBA()
{
InitializeComponent();
}
private void shortestPathToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new ResultRoute();
a.Show();
this.Hide();
}
private void valueOptimationToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new SearchingRoute();
a.Show();
this.Hide();
}
private void valuePathAnalysisToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new Optimation();
a.Show();
this.Hide();
}
private void pathAnalysisToolStripMenuItem1_Click(object sender, EventArgs e)
{
var a = new PathAnalysis();
a.Show();
this.Hide();
}
private void pathAnalysisToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new ResultPathAnalysis();
L10
a.Show();
this.Hide();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void msCustomerToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new MsCustomer();
a.Show();
this.Hide();
}
private void msProductToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new MsProduct();
a.Show();
this.Hide();
}
private void optimationToolStripMenuItem_Click(object sender, EventArgs e)
{
var a = new ResultOptimation();
a.Show();
this.Hide();
}
}
}
SearchingRoute.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using MySql.Data.MySqlClient;
using System.Collections.ObjectModel;
namespace Project_CBA_Pati
{
public partial class SearchingRoute : Form
{
L11
Collection<DataTampil> dt = new Collection<DataTampil>();
public SearchingRoute()
{
InitializeComponent();
}
private static bool temp = false;
private void BtnOKMainMenu_Click(object sender, EventArgs e)
{
if (temp == false)
{
MessageBox.Show("Choosen Date!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else
{
var a = new FormCBA();
a.Show();
this.Hide();
}
}
class DataTampil
{
public string CustomerName {set;get;}
public string Address {set;get;}
public string Destination { set; get; }
public string DeliveryDate { set; get; }
}
private void DataGridViewSearch_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if(e.RowIndex!=-1 && e.RowIndex < DataGridViewSearch.Rows.Count)
{
string[] cell = new string[4];
string customername = DataGridViewSearch.Rows[e.RowIndex].Cells[0].Value.ToString();
string address = DataGridViewSearch.Rows[e.RowIndex].Cells[1].Value.ToString();
string destination = DataGridViewSearch.Rows[e.RowIndex].Cells[2].Value.ToString();
string deliverydate = DataGridViewSearch.Rows[e.RowIndex].Cells[3].Value.ToString();
cell[0] = customername;
cell[1] = address;
cell[2] = destination;
cell[3] = deliverydate;
DataGridViewAdd.Rows.Add(cell);
Global.customername = cell[0];
Global.address = cell[1];
Global.destination = cell[2];
Global.deliverydate = cell[3];
DataGridViewSearch.Visible = false;
L12
DataGridViewAdd.Visible = true;
}
}
private void MainMenu_Load(object sender, EventArgs e)
{
DataGridViewSearch.Visible = true;
DataGridViewAdd.Visible = false;
temp = false;
}
private void button1_Click(object sender, EventArgs e)
{
if (temp)
{
string MyConString = "SERVER = localhost;" + "database = databasepati;" + "UID = root;";
MySqlConnection conection = new MySqlConnection(MyConString);
MySqlCommand comand = conection.CreateCommand();
MySqlDataReader reader;
string thisrow = "";
string searchdate = dateTimePicker1.Value.ToString("yyyy-MM-dd");
comand.CommandText = "select mscustomer.CustomerName, mscustomer.Address,
mscustomer.Destination, msproduct.ProductName, msproduct.Price, msresult.Quantity,
msresult.DeliveryDate from ((mscustomer inner join msresult on mscustomer.CostumerID =
msresult.CustomerID)inner join msproduct on msproduct.ProductID=msresult.ProductID) where
DeliveryDate ='" + searchdate + "'";
conection.Open();
reader = comand.ExecuteReader();
var dt = new Collection<DataTampil>();
while (reader.Read())
{
thisrow += reader.GetValue(0).ToString() + "\n";
thisrow += reader.GetValue(1).ToString() + "\n";
thisrow += reader.GetValue(2).ToString() + "\n";
thisrow += reader.GetValue(3).ToString() + "\n";
thisrow += reader.GetValue(4).ToString() + "\n";
dt.Add(new DataTampil { CustomerName = reader.GetValue(0).ToString(), Address =
reader.GetValue(1).ToString(), Destination = reader.GetValue(2).ToString(), DeliveryDate =
reader.GetValue(6).ToString() });
}
//conection.Close();
DataGridViewSearch.DataSource = dt;
if (dt.Count() != 0)
{
DataGridViewSearch.DataSource = dt;
//DateTime date = new DateTime();
}
DataGridViewSearch.Visible = true;
DataGridViewAdd.Visible = false;
}
else MessageBox.Show("Choosen
Date!","Warning",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
L13
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
temp = true;
}
}
}
Optimation.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using MySql.Data.MySqlClient;
using System.Collections.ObjectModel;
using System.IO;
namespace Project_CBA_Pati
{
public partial class Optimation : Form
{
Collection<DataTampil2> dt = new Collection<DataTampil2>();
public Optimation()
{
InitializeComponent();
}
private static bool isNumber = false;
private static bool isNumber2 = false;
private static bool isNumber3 = false;
private static bool isNumber4 = false;
private static bool isNumber5 = false;
private static bool isNumber6 = false;
private static bool isNumber7 = false;
private static bool isNumber8 = false;
private static bool isNumber9 = false;
private static bool isNumber10 = false;
private static bool isNumber11 = false;
private static bool isNumber12 = false;
private static bool isNumber13 = false;
private static bool isNumber14 = false;
private static bool isNumber15 = false;
private static int outputvalue = 0;
class DataTampil2
{
public string CustomerName { set; get; }
L14
public string ProductName { set; get; }
public string Price { set; get; }
public string Quantity { set; get; }
}
private void BtnOKResult_Click(object sender, EventArgs e)
{
StreamWriter fw = new StreamWriter(Directory.GetCurrentDirectory().ToString()+
@"\datadiagnosa.txt");
fw.Write(Input1.Text.ToString() + "\t");
fw.Write(Input2.Text.ToString() + "\t");
fw.WriteLine(Input3.Text.ToString());
fw.Write(Input4.Text.ToString() + "\t");
fw.Write(Input5.Text.ToString() + "\t");
fw.WriteLine(Input6.Text.ToString());
fw.Write(Input7.Text.ToString() + "\t");
fw.Write(Input8.Text.ToString() + "\t");
fw.WriteLine(Input9.Text.ToString());
fw.Write(Input10.Text.ToString() + "\t");
fw.Write(Input11.Text.ToString() + "\t");
fw.WriteLine(Input12.Text.ToString());
fw.Write(Input13.Text.ToString() + "\t");
fw.Write(Input14.Text.ToString() + "\t");
fw.Write(Input15.Text.ToString() + "\t");
fw.Close();
isNumber = int.TryParse(Input1.Text, out outputvalue);
isNumber2 = int.TryParse(Input2.Text, out outputvalue);
isNumber3 = int.TryParse(Input3.Text, out outputvalue);
isNumber4 = int.TryParse(Input4.Text, out outputvalue);
isNumber5 = int.TryParse(Input5.Text, out outputvalue);
isNumber6 = int.TryParse(Input6.Text, out outputvalue);
isNumber7 = int.TryParse(Input7.Text, out outputvalue);
isNumber8 = int.TryParse(Input8.Text, out outputvalue);
isNumber9 = int.TryParse(Input9.Text, out outputvalue);
isNumber10 = int.TryParse(Input10.Text, out outputvalue);
isNumber11 = int.TryParse(Input11.Text, out outputvalue);
isNumber12 = int.TryParse(Input12.Text, out outputvalue);
isNumber13 = int.TryParse(Input13.Text, out outputvalue);
isNumber14 = int.TryParse(Input14.Text, out outputvalue);
isNumber15 = int.TryParse(Input15.Text, out outputvalue);
if (!isNumber)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input1.Text = "";
Input1.Focus();
}
else if (!isNumber2)
{
L15
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input2.Text = "";
Input2.Focus();
}
else if (!isNumber3)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input3.Text = "";
Input3.Focus();
}
else if (!isNumber4)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input4.Text = "";
Input4.Focus();
}
else if (!isNumber5)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input5.Text = "";
Input5.Focus();
}
else if (!isNumber6)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input6.Text = "";
Input6.Focus();
}
else if (!isNumber7)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input7.Text = "";
Input7.Focus();
}
else if (!isNumber8)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input8.Text = "";
Input8.Focus();
}
else if (!isNumber9)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input9.Text = "";
Input9.Focus();
}
L16
else if (!isNumber10)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input10.Text = "";
Input10.Focus();
}
else if (!isNumber11)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input11.Text = "";
Input11.Focus();
}
else if (!isNumber12)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input12.Text = "";
Input12.Focus();
}
else if (!isNumber13)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input13.Text = "";
Input13.Focus();
}
else if (!isNumber14)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input14.Text = "";
Input14.Focus();
}
else if (!isNumber15)
{
MessageBox.Show("Input Must Be Number!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
Input15.Text = "";
Input15.Focus();
}
else
{
System.Diagnostics.Process.Start("Optimasi.exe");
}
}
private void BtnCancelOptimation_Click(object sender, EventArgs e)
{
var a = new FormCBA();
a.Show();
this.Hide();
}
L17
}
}
Optimation.cpp
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <fstream>
#define INFINITY 999
#define N 3
#define M 6
using namespace std;
void minimum(float *arr,int *arrminpos,int n);
void display (float c[],float b[],float a[][M],int basic[]);
void displayframe(float c[M]);
void calctemp(float *,float [][M],float [],int []);
int main()
{
float c[M]={{5},{4},{3},{0},{0},{0}};
float a[N][M]={
{2,3,1,1,0,0},
{4,1,2,0,1,0},
{3,4,2,0,0,1}
};
float b[N]={{5},{11}};//,{8}};
float temp[M]={{0},{0},{0},{0},{0},{0}};
int tempminpos;
float miniratio[N];
int miniratiominpos;
float key;
int gooutcol;
float z;
float x[M];
int i,j;
int basic[N];
int nonbasic[N];
int flag=0;
FILE *in,*out;
for(i=0;i<N;i++)
{
basic[i]=(i+N);
nonbasic[i]=i;
}
printf("\nMax z = c1x1 + c2x2 + c3x3\n");
L18
printf("\na11x1 + a12x2 + a13x3 <= b1\n");
printf("\na21x1 + a22x2 + a23x3 <= b2\n");
printf("\na31x1 + a31x2 + a32x3 <= b3\n");
printf("\nEnter values of ci's\n");
if ((in = fopen("datadiagnosa.txt","r"))==NULL)
{
printf("The File was not opened");
}
int temptemp;
int tempData[20];
i=0;
while(!feof(in))
{
fscanf(in,"%d",&temptemp);
tempData[i++]=temptemp;
printf("%d",temptemp);
}
fclose(in);
for(i=0;i<N;i++)
{
c[i]=tempData[i];
}
printf("\nEnter values of ai's\n");
int kk=3;
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
a[i][j]=tempData[kk++];
}
}
printf("\nEnter values of bi's\n");
for(i=0;i<N;i++)
{
b[i]=tempData[kk++];
}
while(flag==0)
{
z=0;
calctemp(temp,a,c,basic);
printf("\n");
minimum(temp,&tempminpos,M);
display(c,b,a,basic);
printf("\nZj-Cj\t\t\t");
if ((out = fopen("optimationresult.txt","w"))==NULL)
{
printf("The File was not opened");
}
L19
for(i=0;i<M;i++)
printf("%.4g\t",temp[i]);
printf("\n\n");
for(i=0;i<N;i++)
{
x[basic[i]]=b[i];
x[nonbasic[i]]=0;
printf("x[%d]=%g\n",basic[i]+1,b[i]);
fprintf(out,"%g\n",b[i]);
}
for(i=0;i<N;i++)
z=z+c[i]*x[i];
printf("Max(z) = %g",z);
fprintf(out,"%g",z);
fclose(out);
for(i=0;i<N;i++)
{
if(a[i][tempminpos]==0)
{
miniratio[i]=INFINITY;
continue;
}
if(a[i][tempminpos]<0)
{
miniratio[i]=INFINITY;
continue;
}
miniratio[i]=b[i]/a[i][tempminpos];
}
minimum(miniratio,&miniratiominpos,N);
for(i=0;i<N;i++)
if(miniratiominpos==i)
gooutcol=basic[i];
printf("\nComing in variable = X%d\t",tempminpos+1);
printf("Going out variable = X%d\n",gooutcol+1);
basic[miniratiominpos]=tempminpos;
nonbasic[tempminpos]=gooutcol;
key=a[miniratiominpos][tempminpos];
b[miniratiominpos]=b[miniratiominpos]/key;
for(i=0;i<M;i++)
a[miniratiominpos][i]=a[miniratiominpos][i]/key;
for(i=0;i<N;i++)
{
if(miniratiominpos==i)
continue;
key=a[i][tempminpos];
for(j=0;j<M;j++)
{
a[i][j]=a[i][j]-a[miniratiominpos][j]*key;
}
b[i]=b[i]-b[miniratiominpos]*key;
}
for(i=0;i<M;i++)
{
L20
flag=1;
if(temp[i]<0)
{
flag=0;
break;
}
}
}
return 0;
}
void calctemp(float *temp,float a[N][M],float c[M],int basic[N])
{
int i,j;
for(i=0;i<M;i++)
{
temp[i]=0;
for(j=0;j<N;j++)
temp[i]=temp[i]+c[basic[j]]*a[j][i];
temp[i]=temp[i]-c[i];
}
}
void minimum(float *arr,int *arrminpos, int n)
{
int i;
float arrmin;
arrmin=arr[0];
*arrminpos=0;
for(i=0;i<n;i++)
if(arr[i]<arrmin)
{
arrmin=arr[i];
*arrminpos=i;
}
printf("\n%d\n",*arrminpos);
}
void display (float c[N],float b[N],float a[N][M],int basic[N])
{
int i,j;
displayframe(c);
for(i=0;i<N;i++)
{
printf("\n%.4g\tX%d\t%.4g\t",c[basic[i]],basic[i]+1,b[i]);
for(j=0;j<M;j++)
printf("%.4g\t",a[i][j]);
printf("\n");
}
}
void displayframe(float c[M])
{
printf("\t\tc[j]\t");
printf("%g\t%g\t%g\t%g\t%g\t%g\n",c[0],c[1],c[2],c[3],c[4],c[5]);
printf("\nc[b]\tB\tb\ta1\ta2\ta3\ta4\ta5\ta6\n");
}
L21
PathAnalysis.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Project_CBA_Pati
{
public partial class PathAnalysis : Form
{
public PathAnalysis()
{
InitializeComponent();
}
private void DataGridViewPathAnalysis_CellValueChanged(object sender,
DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1 && e.RowIndex < DataGridViewPathAnalysis.Rows.Count)
{
if (e.ColumnIndex == 0)
{
var temp = DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[0].Value.ToString();
int temp2;
if (int.TryParse(temp, out temp2))
{
DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[3].Value = (temp2 *
temp2).ToString();
}
}
else if (e.ColumnIndex == 1)
{
var temp = DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[1].Value.ToString();
int temp2;
if (int.TryParse(temp, out temp2))
{
DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[4].Value = (temp2 *
temp2).ToString();
}
}
else if (e.ColumnIndex == 2)
{
var temp = DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[2].Value.ToString();
int temp2;
if (int.TryParse(temp, out temp2))
{
DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[5].Value = (temp2 *
temp2).ToString();
L22
}
}
if (e.ColumnIndex == 1)
{
var temp = DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[1].Value.ToString();
int temp2;
int temp3;
if (int.TryParse(temp, out temp2) &&
int.TryParse(DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[0].Value.ToString(),out temp3) )
{
DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[6].Value = (temp2 *
temp3).ToString();
}
}
if (e.ColumnIndex == 2)
{
var temp = DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[2].Value.ToString();
int temp2;
int temp3;
if (int.TryParse(temp, out temp2) &&
int.TryParse(DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[0].Value.ToString(), out temp3))
{
DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[7].Value = (temp2 *
temp3).ToString();
}
}
if (e.ColumnIndex == 2)
{
var temp = DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[2].Value.ToString();
int temp2;
int temp3;
if (int.TryParse(temp, out temp2) &&
int.TryParse(DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[1].Value.ToString(), out temp3))
{
DataGridViewPathAnalysis.Rows[e.RowIndex].Cells[8].Value = (temp2 *
temp3).ToString();
}
}
}
}
private void PathAnalysis_Load(object sender, EventArgs e)
{
DataGridViewPathAnalysis.Columns[3].Visible = false;
DataGridViewPathAnalysis.Columns[4].Visible = false;
DataGridViewPathAnalysis.Columns[5].Visible = false;
DataGridViewPathAnalysis.Columns[6].Visible = false;
DataGridViewPathAnalysis.Columns[7].Visible = false;
DataGridViewPathAnalysis.Columns[8].Visible = false;
BtnCancelPathAnalysis.Visible = false;
lblInfo.Visible = false;
Lblrx1x2.Visible = false;
Lblrx1y.Visible = false;
Lblrx2y.Visible = false;
L23
Lblrx1x2y.Visible = false;
textBox1.Visible = false;
textBox2.Visible = false;
textBox3.Visible = false;
textBox4.Visible = false;
}
private void BtnCalculate_Click(object sender, EventArgs e)
{
BtnCancelPathAnalysis.Visible = true;
BtnCalculate.Visible = false;
lblInfo.Visible = true;
Lblrx1x2.Visible = true;
Lblrx1y.Visible = true;
Lblrx2y.Visible = true;
Lblrx1x2y.Visible = true;
textBox1.Visible = true;
textBox2.Visible = true;
textBox3.Visible = true;
textBox4.Visible = true;
int n = 0;
int sum = 0;
int sum2 = 0;
int sum3 = 0;
int sum4 = 0;
int sum5 = 0;
int sum6 = 0;
int sum7 = 0;
int sum8 = 0;
int sum9 = 0;
n = Convert.ToInt32(DataGridViewPathAnalysis.RowCount - 1);
Global.sumbaris = n;
//textBox1.Text = Global.sumbaris.ToString();
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[0].Value);
Global.sumjumlahbarang = sum;
//textBox1.Text = Global.sumjumlahbarang.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum2 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[1].Value);
Global.sumjarakpengiriman = sum2;
//textBox2.Text = Global.sumjarakpengiriman.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum3 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[2].Value);
Global.sumbiayapengiriman = sum3;
//textBox3.Text = Global.sumbiayapengiriman.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum4 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[3].Value);
L24
Global.sumx1x1 = sum4;
//textBox1.Text = Global.sumx1x1.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum5 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[4].Value);
Global.sumx2x2 = sum5;
//textBox2.Text = Global.sumx2x2.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum6 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[5].Value);
Global.sumyy = sum6;
//textBox3.Text = Global.sumyy.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum7 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[6].Value);
Global.sumx1x2 = sum7;
//textBox3.Text = Global.sumyy.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum8 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[7].Value);
Global.sumx1y = sum8;
//textBox3.Text = Global.sumyy.ToString();
}
for (int i = 0; i < DataGridViewPathAnalysis.RowCount - 1; i++)
{
sum9 += Convert.ToInt32(DataGridViewPathAnalysis.Rows[i].Cells[8].Value);
Global.sumx2y = sum9;
//textBox3.Text = Global.sumyy.ToString();
}
//untuk korelasi antara x1 dengan x2
var ax1 = (Global.sumbaris * Global.sumx1x2) - (Global.sumjumlahbarang *
Global.sumjarakpengiriman);
var ax2 = Math.Sqrt(((Global.sumbaris * Global.sumx1x1) - Math.Pow(Global.sumjumlahbarang,
2)) * ((Global.sumbaris * Global.sumx2x2) - Math.Pow(Global.sumjarakpengiriman, 2)));
textBox1.Text = Math.Round(ax1 / ax2, 4).ToString();
Global.rx1x2 = (double)Math.Round(ax1 / ax2, 4);
//untuk korelasi antara x1 dengan y
var bx1 = (Global.sumbaris * Global.sumx1y) - (Global.sumjumlahbarang *
Global.sumbiayapengiriman);
var by = Math.Sqrt(((Global.sumbaris * Global.sumx1x1) - Math.Pow(Global.sumjumlahbarang,
2)) * ((Global.sumbaris * Global.sumyy) - Math.Pow(Global.sumbiayapengiriman, 2)));
textBox2.Text = Math.Round(bx1 / by, 4).ToString();
Global.rx1y = (double)Math.Round(bx1 / by, 4);
//untuk korelasi antara x2 dengan y
var cx2 = (Global.sumbaris * Global.sumx2y) - (Global.sumjarakpengiriman *
Global.sumbiayapengiriman);
L25
var cy = Math.Sqrt(((Global.sumbaris * Global.sumx2x2) -
Math.Pow(Global.sumjarakpengiriman, 2)) * ((Global.sumbaris * Global.sumyy) -
Math.Pow(Global.sumbiayapengiriman, 2)));
textBox3.Text = Math.Round(cx2 / cy, 4).ToString();
Global.rx2y = (double)Math.Round(cx2 / cy, 4);
//untuk korelasi berganda antara x1, x2 terhadap y
var d = ((Math.Pow(Global.rx1y, 2) + Math.Pow(Global.rx2y, 2)) - (2 * (Global.rx1y) *
(Global.rx2y) * (Global.rx1x2)));
var d2 = (1 - Math.Pow(Global.rx1x2, 2));
var d3 = (d / d2);
textBox4.Text = Math.Round(Math.Sqrt(d3), 4).ToString();
Global.rx1x2y = (double)Math.Round(Math.Sqrt(d3), 4);
}
private void BtnCancelPathAnalysis_Click(object sender, EventArgs e)
{
var a = new FormCBA();
a.Show();
this.Hide();
}
}
}
ResultRoute.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using MySql.Data.MySqlClient;
using System.Collections.ObjectModel;
namespace Project_CBA_Pati
{
public partial class ResultRoute : Form
{
int index = 0;
string awal="PATI";
string master_source = "";
List<int> km = new List<int>();
List<string> route = new List<string>();
List<int> jarak = new List<int>();
List<int> harga = new List<int>();
public ResultRoute()
L26
{
InitializeComponent();
}
public void function_retrieve(string start, string destination,string rute)
{
string MyConString = "SERVER = localhost;" + "database = databasepati;" + "UID = root;";
MySqlConnection conection = new MySqlConnection(MyConString);
MySqlCommand comand = new MySqlCommand("select * from msDistance where Start like '" +
start + "' and DestinationWay like '" + destination + "' ", conection);
MySqlDataReader reader;
if (rute == null)
{
route.Add(awal + "-");
jarak.Add(0);
harga.Add(0);
master_source = awal + "-";
}
else
{
reader = null;
conection.Close();
route[index] += rute;
}
conection.Open();
reader = comand.ExecuteReader();
string via = "";
while (reader.Read())
{
if (reader.GetValue(5).ToString() != "")
{
via = reader.GetValue(5).ToString();
rute = reader.GetValue(5).ToString() + "-";
jarak[index] += Convert.ToInt32(reader.GetValue(3).ToString());
harga[index] += Convert.ToInt32(reader.GetValue(4).ToString());
function_retrieve(via, destination, rute);
}
else
{
route[index] += destination;
jarak[index] += Convert.ToInt32(reader.GetValue(3).ToString());
harga[index] += Convert.ToInt32(reader.GetValue(4).ToString());
index++;
route.Add(master_source);
jarak.Add(0);
harga.Add(0);
}
}
conection.Close();
}
private void FormResult_Load(object sender, EventArgs e)
{
L27
TxtCustomerName.Text = Global.customername;
TxtDestination.Text=Global.destination;
function_retrieve(awal, Global.destination, null);
for (int i = 0; i < route.Count()-1; i++)
{
LblResult.Text += route[i].ToString() + " " + "\n" + jarak[i].ToString() + " " + "KM" + "\n" +
"Rp." + harga[i].ToString() + ",00" +"\n" + "\n";
if (jarak.Count()-1 == 1)
{
LblChoosenRoute.Text = route[0].ToString() + " " + "\n" + jarak[0].ToString() + " " + "KM"
+ "\n" + "Rp." + harga[0].ToString() + ",00" + "\n" + "\n";
}
else if (jarak.Count()-1 == 2)
{
if (jarak[0] < jarak[1])
{
LblChoosenRoute.Text = route[0].ToString() + " " + "\n" + jarak[0].ToString() + " " +
"KM" + "\n" + "Rp." + harga[0].ToString() + ",00" + "\n" + "\n";
}
else
{
LblChoosenRoute.Text = route[1].ToString() + " " + "\n" + jarak[1].ToString() + " " +
"KM" + "\n" + "Rp." + harga[1].ToString() + ",00" + "\n" + "\n";
}
}
else if (jarak.Count()-1 == 3)
{
if (jarak[0] < jarak[1] && jarak[0] < jarak[1])
{
LblChoosenRoute.Text = route[0].ToString() + " " + "\n" + jarak[0].ToString() + " " +
"KM" + "\n" + "Rp." + harga[0].ToString() + ",00" + "\n" + "\n";
}
else if (jarak[1] < jarak[0] && jarak[1] < jarak[2])
{
LblChoosenRoute.Text = route[1].ToString() + " " + "\n" + jarak[1].ToString() + " " +
"KM" + "\n" + "Rp." + harga[1].ToString() + ",00" + "\n" + "\n";
}
else
{
LblChoosenRoute.Text = route[2].ToString() + " " + "\n" + jarak[2].ToString() + " " +
"KM" + "\n" + "Rp." + harga[2].ToString() + ",00" + "\n" + "\n";
}
}
}
char[] delimiters = new char[] {' '};
string[] parts = LblChoosenRoute.Text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length; i++)
{
Global.choosenroute = parts[0];
}
}
private void BtnCancelResult_Click(object sender, EventArgs e)
L28
{
var a = new FormCBA();
a.Show();
this.Hide();
}
}
}