public Form1() { InitializeComponent(); ds_random = new Random(); dsPojemnikiNominalow = new dsNominaly[dsWartosciNominalow.Length]; dsb = new dsBankomat(); dsDostepneProdukty = new List <dsProduktyStruct>() { new dsProduktyStruct() { produkt = dsProdukty.Cola, ilosc = 5, cenapln = 2.50M, cenaeur = 0.50M, cenahrn = 18.50M }, new dsProduktyStruct() { produkt = dsProdukty.Fanta, ilosc = 5, cenapln = 4.00M, cenaeur = 1.00M, cenahrn = 30.00M }, new dsProduktyStruct() { produkt = dsProdukty.Sprite, ilosc = 5, cenapln = 2.50M, cenaeur = 0.50M, cenahrn = 18.50M }, new dsProduktyStruct() { produkt = dsProdukty.Mars, ilosc = 5, cenapln = 5.00M, cenaeur = 1.50M, cenahrn = 45.50M }, new dsProduktyStruct() { produkt = dsProdukty.Twix, ilosc = 5, cenapln = 6.50M, cenaeur = 2.00M, cenahrn = 60.00M }, new dsProduktyStruct() { produkt = dsProdukty.Snickers, ilosc = 5, cenapln = 2.50M, cenaeur = 0.50M, cenahrn = 18.50M } }; }
public static void dsParagon(dsBankomat bankomat, string str) { string dsstr = ""; dsstr = $"\tThank you for shopping <EATPlus>\n\t-------------------------------------------" + $" \n\tYour choice:\n\tProduct:{bankomat.dsWybranyProdukt.ToString()};" + $"\n\tPrice:{bankomat.dsCena};\n\tCurrency:{bankomat.dsWaluta.ToString()}" + $"\n\t-------------------------------------------\n\tPlease, dont forget, to take your purchase..."; dsstr += str; System.Windows.Forms.MessageBox.Show(dsstr); }
public static bool dsZaplacKartą(dsBankomat bankomat, List <dsProduktyStruct> prod, decimal sum) { if (bankomat.dsCena > sum) { System.Windows.Forms.MessageBox.Show("\tRefusal\n\t-------------------------------------------" + "\n\t You dont have enough money on you bill..."); return(false); } bankomat.dsOdebranieProduktu(prod); dsParagon(bankomat); return(true); }
private void dsReset() { dsb.dsEdytujText(dstb, "Set the number of denominations randomly ?"); dsb.dsEdytujText(dstbWrzuconeMonety, ""); dscmbWaluta.Text = ""; dsbtntak.Visible = true; dsbtnnie.Visible = true; dscmbRodzajPlatnosci.Text = ""; dsbtnplace.Enabled = false; dslblplatnosc.Visible = false; dscmbRodzajPlatnosci.Enabled = false; dsb = new dsBankomat(); }
public static bool dsZaplacGotówką(dsBankomat bankomat, List <dsProduktyStruct> prod, dsNominaly [] nominaly) { decimal ds_reszta = 0.00M; if (bankomat.dsCena > bankomat.dsZaplacono) { System.Windows.Forms.MessageBox.Show("\tRefusal\n\t-------------------------------------------" + $"\n\t You dont have enough money on you bill...\n\tTo pay: {bankomat.dsCena-bankomat.dsZaplacono}..."); return(false); } else { ds_reszta = bankomat.dsZaplacono - bankomat.dsCena; if (ds_reszta > 0) { if (dsUdaSieWydacReszte(ds_reszta, nominaly)) { dsParagon(bankomat, dsOddajReszte(ds_reszta, nominaly)); bankomat.dsOdebranieProduktu(prod); return(true); } else { System.Windows.Forms.MessageBox.Show("\tRefusal\n\t-------------------------------------------" + $"\n\t The veding machine doesnt have enough coins to give change: {bankomat.dsCena - bankomat.dsZaplacono}" + $"\n\tPlease, pay by card or find another coins..."); return(false); } } else { dsParagon(bankomat); bankomat.dsOdebranieProduktu(prod); return(true); } } }