Ejemplo n.º 1
0
 // function to add items to listboxes
 public static void SepeteUrunEkle(Benzin Benzin, ListBox listBox1, ListBox listBox2, ListBox listBox3)
 {
     // add product items to listbox if choosen products > 0
     if (Benzin.Get_secilenadet() > 0)
     {
         listBox1.Items.Add(Benzin.Get_secilenadet());
         listBox2.Items.Add(Benzin.Get_Name());
         listBox3.Items.Add(Math.Round(Benzin.KdvUygula(Benzin.Get_Name()), 2));
     }
 }
Ejemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            // clear buttons in every click
            Fatura.SepeteTemizle(listBox1, listBox2, listBox3);


            // set choosen products
            VPower.Set_secilenadet(Convert.ToInt32(n1.Value));
            AGaz.Set_secilenadet(Convert.ToInt32(n2.Value));
            kursunsuz.Set_secilenadet(Convert.ToInt32(n3.Value));
            diesel.Set_secilenadet(Convert.ToInt32(n4.Value));



            // add info to listboxes
            Fatura.SepeteUrunEkle(VPower, listBox1, listBox2, listBox3);
            Fatura.SepeteUrunEkle(diesel, listBox1, listBox2, listBox3);
            Fatura.SepeteUrunEkle(AGaz, listBox1, listBox2, listBox3);
            Fatura.SepeteUrunEkle(kursunsuz, listBox1, listBox2, listBox3);


            // set new stokadedi
            VPower.Set_LitreAdedi(Convert.ToInt32(VPower.Get_LitreAdedi()) - VPower.Get_secilenadet());
            AGaz.Set_LitreAdedi(Convert.ToInt32(AGaz.Get_LitreAdedi()) - AGaz.Get_secilenadet());
            kursunsuz.Set_LitreAdedi(Convert.ToInt32(kursunsuz.Get_LitreAdedi()) - kursunsuz.Get_secilenadet());
            diesel.Set_LitreAdedi(Convert.ToInt32(diesel.Get_LitreAdedi()) - diesel.Get_secilenadet());

            // set new stokadedi
            l1.Text = Convert.ToString(VPower.Get_LitreAdedi());
            l2.Text = Convert.ToString(AGaz.Get_LitreAdedi());
            l3.Text = Convert.ToString(kursunsuz.Get_LitreAdedi());
            l4.Text = Convert.ToString(diesel.Get_LitreAdedi());


            // set numaricupdown Maximum and make sure the numaric updown number should not be bigger than stok adedi
            n1.Maximum = VPower.Get_LitreAdedi();
            n2.Maximum = AGaz.Get_LitreAdedi();
            n3.Maximum = kursunsuz.Get_LitreAdedi();
            n4.Maximum = diesel.Get_LitreAdedi();

            // calculate the total price
            double result = Math.Round((kursunsuz.KdvUygula(kursunsuz.Get_Name())) + (AGaz.KdvUygula(AGaz.Get_Name())) +
                                       (diesel.KdvUygula(diesel.Get_Name())) + (VPower.KdvUygula(VPower.Get_Name())), 2);

            if (result == 0)
            {
                l9.Text = result + "0 TL";
            }
            else
            {
                l9.Text = result + " TL";
            }
        }