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 { } }
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); }