Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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);
                }
            }
        }