コード例 #1
0
 public void RemoveChipCoin(int ChipCoinCode)
 {
     //Checks all ChipCoins currenty active.
     foreach (ChipCoin ChipCoin in chipCoin)
     {
         //Checks if the Hashcodes match.
         if (ChipCoinCode == ChipCoin.GetHashCode())
         {
             //Removes that ChipCoin from the list
             chipCoin.Remove(ChipCoin);
             break;
         }
     }
 }
コード例 #2
0
        public ChipCoinPaid ChipCoinEntered(int ChipCoinCode)
        {
            foreach (ChipCoin ChipCoin in ChipCoins.GetChipCoins())
            {
                if (ChipCoin.GetHashCode() == ChipCoinCode)
                {
                    if (ChipCoin.IsPaid() == true)
                    {
                        message = "Thank you, drive safely.";
                        ChipCoins.RemoveChipCoin(ChipCoinCode);
                        carPark.ChipCoinValidated();
                        return(ChipCoinPaid.ChipCoin_REMOVED);
                    }
                    else
                    {
                        MessageBoxManager.OK = "Present card"; MessageBoxManager.Cancel = "Pay by cash"; MessageBoxManager.Register();
                        if (MessageBox.Show("Please pay by card.", "PayByCard", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            message = "Thank you, drive safely.";
                            ChipCoins.RemoveChipCoin(ChipCoinCode);
                            carPark.ChipCoinValidated();
                            return(ChipCoinPaid.ChipCoin_REMOVED);
                        }

                        else
                        {
                            message = "ChipCoin has not been paid.";
                        }
                        return(ChipCoinPaid.NOT_PAID);
                    }
                }
            }

            message = "Not Valid ChipCoin.";
            return(ChipCoinPaid.NOT_VALID);
        }
コード例 #3
0
        public void PayForChipCoin(int ChipCoinCode)
        {
            if (ChipCoins.GetChipCoins().Count() > 0)
            {
                //Checks every active ChipCoin
                foreach (ChipCoin ChipCoin in ChipCoins.GetChipCoins())
                {
                    //Checks if the Hashcodes match.
                    if (ChipCoinCode == ChipCoin.GetHashCode())
                    {
                        //Removes that ChipCoin from the list
                        MessageBoxManager.OK = "Cash"; MessageBoxManager.Cancel = "Card"; MessageBoxManager.Register();

                        //ask to select a payment, if cash is pressed set paid to true
                        if (MessageBox.Show("Please select payment method. \n\nCard payments will be processed at the barrier.", "Payment type", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            ChipCoin.SetPaid(true);
                        }
                        MessageBoxManager.Unregister();
                        break;
                    }
                }
            }
        }