Nama : Ahmad Farhan Zuhdi
NIM : 13141008
Kelas : 13.6A.37 (BSI PEMUDA)
Tugas Network Programming II
Gambar 2.1. Tampilan Billing
Gambar 2.3. Tampilan Display Billing
Coding Project :
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.Diagnostics;
namespace Billing_Warnet
{
public partial class Form1 : Form
{
private Stopwatch wkt = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text != "")
{
wkt = new Stopwatch();
if(button1.Text == "Login")
{
wkt.Start();
if(radioButton1.Checked)
{
label3.Text = "Biasa";
}
else if(radioButton2.Checked)
{
label3.Text = "2 Jam";
}
else if(radioButton3.Checked)
{
label3.Text = "3 Jam";
}
else if(radioButton4.Checked)
{
label3.Text = "4 Jam";
}
else if(radioButton5.Checked)
{
label3.Text = "8 Jam";
}
label3.Visible = true;
wkt.Start();
button1.Text = "STOP";
label5.Visible = true;
button1.Text = "STOP";
radioButton1.Enabled=false;
radioButton2.Enabled=false;
radioButton3.Enabled=false;
radioButton4.Enabled=false;
radioButton5.Enabled=false;
}
else if(button1.Text=="STOP")
{
wkt.Stop();
if(radioButton1.Checked)
{
if(wkt.Elapsed.TotalMinutes <= 30.00)
{
MessageBox.Show("Jumlah Bayar Rp.2000","Total Bayar");
}
else if(wkt.Elapsed.TotalHours <= 1.00)
{
MessageBox.Show("Jumlah Bayar Rp.3000","Total Bayar");
}
else if(wkt.Elapsed.TotalHours <= 2.00)
{
MessageBox.Show("Jumlah Bayar Rp.6000","Total Bayar");
}
}
if(radioButton2.Checked)
{
MessageBox.Show("Jumlah Bayar Rp.5000","Total Bayar Paket 2");
}
if(radioButton3.Checked)
{
MessageBox.Show("Jumlah Bayar Rp.8000","Total Bayar Paket 3");
}
if(radioButton4.Checked)
{
MessageBox.Show("Jumlah Bayar Rp.10000","Total Bayar Paket 4");
}
if (radioButton5.Checked)
{
MessageBox.Show("Jumlah Bayar Rp.15000", "Total Bayar Paket Malam");
}
wkt.Reset();
label3.Visible=false;
button1.Text="Login";
textBox1.Text=null;
label5.Visible=false;
button1.Text="Login";
radioButton1.Enabled=true;
radioButton2.Enabled = true;
radioButton3.Enabled = true;
radioButton4.Enabled = true;
radioButton5.Enabled = true;
}
}
else if (textBox1.Text == "")
{
MessageBox.Show("Nama Harus Diisi !", "Important Message");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (wkt != null)
{
label5.Text = wkt.Elapsed.ToString(@"hh\:mm\:ss");
}
if (radioButton2.Checked)
{
if (label5.Text == "02:00:00")
{
wkt.Reset();
label3.Visible = false;
button1.Text = "Log In";
textBox1.Text = null;
label5.Visible = false;
button1.Text = "Log In";
MessageBox.Show("Jumlah Bayar Rp. 5000", "Total Bayar Paket 2");
radioButton1.Enabled = true;
radioButton2.Enabled = true;
radioButton3.Enabled = true;
radioButton4.Enabled = true;
radioButton5.Enabled = true;
}
}
if (radioButton3.Checked)
{
if (label5.Text == "03:00:00")
{
wkt.Reset();
label3.Visible = false;
button1.Text = "Log In";
textBox1.Text = null;
label5.Visible = false;
button1.Text = "Log In";
MessageBox.Show("Jumlah Bayar Rp.8000", "Total Bayar Paket 3");
radioButton1.Enabled = true;
radioButton2.Enabled = true;
radioButton3.Enabled = true;
radioButton4.Enabled = true;
radioButton5.Enabled = true;
}
}
if (radioButton4.Checked)
{
if (label5.Text == "04:00:00")
{
wkt.Reset();
label3.Visible = false;
button1.Text = "Log In";
textBox1.Text = null;
label5.Visible = false;
button1.Text = "Log In";
MessageBox.Show("Jumlah Bayar Rp.10000", "Total Bayar Paket 4");
radioButton1.Enabled = true;
radioButton2.Enabled = true;
radioButton3.Enabled = true;
radioButton4.Enabled = true;
radioButton5.Enabled = true;
}
}
if (radioButton5.Checked)
{
if (label5.Text == "08:00:00")
{
wkt.Reset();
label3.Visible = false;
button1.Text = "Log In";
textBox1.Text = null;
label5.Visible = false;
button1.Text = "Log In";
MessageBox.Show("Jumlah Bayar Rp.15000", "Total Bayar Paket Malam");
radioButton1.Enabled = true;
radioButton2.Enabled = true;
radioButton3.Enabled = true;
radioButton4.Enabled = true;
radioButton5.Enabled = true;
}
}
}
}
}
0 komentar:
Posting Komentar