BILING

Cara Membuat Biling Menggunakan Visual Studio




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 biling_4
{
    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")
                {
                   if (radioButton1.Checked)
                   {
                       label3.Text= "2jam";
                   }
                    else if (radioButton2.Checked)
                   {
                        label3.Text="5jam";
                    }
                    else if(radioButton3.Checked)
                   {
                        label3.Text ="7jam";
                    }
                    else if (radioButton4.Checked)
                   {
                        label3.Text="9jam";
                    }
                    label3.Visible = true;
                    label2.Visible=true;
                    wkt.Start();
                    button1.Text ="stop";
                    radioButton1.Enabled = false;
                    radioButton2.Enabled = false;
                    radioButton3.Enabled = false;
                    radioButton4.Enabled = false;
                }
                else if (button1.Text == "stop")
                {
                    wkt.Start();
                    if (radioButton1.Checked)
                    {
                        MessageBox.Show("jumalah tagihan anda sebesar RP 3000", "paket 2 jam");
                    }
                    else if (radioButton2.Checked)
                    {
                        MessageBox.Show("jumlah tagihan anda sebesar RP 15000", "paket 5 jam");
                    }
                    else if (radioButton3.Checked)
                    {
                        MessageBox.Show("jumlah tagihan anda sebesar Rp18000", "paket 7 jam");
                    }
                    else if (radioButton4.Checked)
                    {
                        MessageBox.Show("jumalah tagihan anda sebesar RP 20000", "paket 9 jam");
                    }
                    wkt.Reset();
                    label2.Visible = false;
                    button1.Text = "login";
                    textBox1.Text = null;
                }
                else if (textBox1.Text == "")
                {
                    MessageBox.Show("nama harus di isi");
                }
            }

                }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (wkt != null)
            {
                label2.Text = wkt.Elapsed.ToString(@"hh\:mm\:ss");
                if (radioButton1.Checked)
                {
                    if (label2.Text == "02:00:00")
                    {
                        wkt.Reset();
                        label3.Visible = false;
                        button1.Text = "login";
                        textBox1.Text = null;
                        label2.Visible = false;
                        button1.Text = "login";
                        MessageBox.Show("jumalah tagihan anda sebesar RP 15000", "paket 5 jam");
                        radioButton1.Enabled = true;
                    }
                }

                else if (radioButton3.Checked)
                {
                    if (label2.Text == "07:00:00")
                    {
                        wkt.Reset();
                        label3.Visible = false;
                        button1.Text = "login";
                        textBox1.Text = null;
                        label2.Visible = false;
                        button1.Text = "login";
                        MessageBox.Show("jumalah tagihan anda sebesar RP 18000", "paket 7 jam");
                        radioButton3.Enabled = true;
                    }
                }
                else if (radioButton4.Checked)
                {
                    if (label2.Text == "09:00:00")
                    {
                        wkt.Reset();
                        label3.Visible = false;
                        button1.Text = "login";
                        textBox1.Text = null;
                        label2.Visible = false;
                        button1.Text = "login";
                        MessageBox.Show("jumalah tagihan anda sebesar RP 20000", "paket 9 jam");
                        radioButton2.Enabled = true;
                    }
                }
            }
        }

       

        

    }
}

Komentar