-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
113 lines (100 loc) · 3.19 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System.Drawing.Text;
using System;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace pencarianDekstop
{
public partial class Form1 : Form
{
private long noDaftar;
private string nama;
private long telepon;
private int biayaWeb = 1000000;
private int biayaNetwork = 800000;
private int biayaNET = 980000;
private int biayaKursus = 250000;
private int totalBayar;
private int totalCicilan;
public Form1()
{
InitializeComponent();
this.Load += Form1_Load;
}
private void Form1_Load(object sender, EventArgs e)
{
HidePaymentLabels();
}
private void HidePaymentLabels()
{
textBoxTotalCicilan.Hide();
textBoxTotalBayar.Hide();
labelTotalCicil.Hide();
labelTotalBayar.Hide();
}
private void AcceptForm()
{
try
{
noDaftar = long.Parse(textBoxNo.Text);
}
catch
{
MessageBox.Show("Terjadi Kesalahan Pada Nomor Pendaftaran");
}
if (nama == null)
{
try
{
nama = textBoxNama.Text;
}
catch
{
MessageBox.Show("Terjadi Kesalahan Pada Nama Pendaftaran");
}
}
try
{
telepon = long.Parse(textBoxTelepon.Text);
}
catch
{
MessageBox.Show("Terjadi Kesalahan Pada Nomor Telepon");
};
}
private int ResultRadio(int biayaDaftar, int biayaPilihan) {
int result = biayaDaftar + biayaPilihan;
return result;
}
private void buttonOK_Click(object sender, EventArgs e)
{
AcceptForm();
totalBayar = radioButtonWeb.Checked ? ResultRadio(biayaKursus, biayaWeb) :
radioButtonNetwork.Checked ? ResultRadio(biayaKursus, biayaNetwork) :
radioButtonNET.Checked ? ResultRadio(biayaKursus, biayaNET) :
totalBayar;
textBoxTotalCicilan.Visible = !radioButtonCash.Checked;
labelTotalCicil.Visible = !radioButtonCash.Checked;
totalCicilan = radioButtonCicil.Checked ? totalBayar / 3 : 0;
textBoxTotalCicilan.Text = radioButtonCicil.Checked ? "Rp . " + totalCicilan.ToString() : "";
textBoxTotalBayar.Text = "Rp. " + totalBayar.ToString();
labelTotalBayar.Show();
textBoxTotalBayar.Show();
}
private void clearForm()
{
textBoxNo.Clear();
textBoxNama.Clear();
textBoxTelepon.Clear();
radioButtonWeb.Checked = false;
radioButtonNetwork.Checked = false;
radioButtonNET.Checked = false;
radioButtonCash.Checked = false;
radioButtonCicil.Checked = false;
HidePaymentLabels();
}
private void buttonClear_Click(object sender, EventArgs e)
{
clearForm();
}
}
}