public static void AlertSecurity() //E-mail functionality is not fully developed, because it depends on outside conditions
        {
            string[] i = Array.ConvertAll(MoneyStock.RevealMoneyAvailable(), denom => denom.ToString());

            MailMessage securityMessage = new MailMessage("VendingMachineID42", "SecurityID1D42");

            securityMessage.Subject = "Vending machine needs a new set of money";
            securityMessage.Body    = ($"On {DateTime.Now.ToString()}, a security issue was registered concerning the stock of money.\nThe current stock is {i[0]}*1000kr, {i[1]}*500kr, {i[2]}100kr, {i[3]}*50kr, {i[4]}*20kr, {i[5]}*10kr, {i[6]}*5kr and {i[7]}*1kr.");
            SmtpClient client = new SmtpClient();

            client.UseDefaultCredentials = true;

            try
            {
                client.Send(securityMessage);
            }
            catch { }
        }
Exemple #2
0
 //This represents a physical function
 protected static void TransferAmount(int moneyInserted)
 {
     MoneyStock.ReceiveAmount(moneyInserted);
 }
Exemple #3
0
 public static void OptimiseMoneyStock()
 {
     //The array "moneyAvailable": [0] 1000kr [1] 500kr [2] 100kr [3] 50kr [4] 20kr [5] 10kr [6] 5kr [7] 1kr
     MoneyStock.ReplaceMoneyAvailable(new int[] { 0, 1, 10, 10, 10, 10, 10, 50 }); // Amounts to 2400kr
 }
Exemple #4
0
        private static int[] changeByDenomination = new int[9]; // The last number in the array functions as a control value

        public static bool QueryMoneyStock(int denominationNumber)
        {
            int[] denominationsAvailable = MoneyStock.RevealMoneyAvailable();
            return(denominationsAvailable[denominationNumber] > 0);
        }
Exemple #5
0
 public static void SettleDebtToCustomer()
 {
     MoneyStock.SendAmount(CalculateChange.CalculateChangeByDenomination(debtToCustomer));
     CalculateChange.ResetChangeByDenomination();
     MoneyInsert.EmptyMoneyHeld();
 }