private void InsertDocument(decimal denomination, DeviceLibrary.Models.Enums.DocumentType type) { DeviceLibrary.Models.Document dep = new DeviceLibrary.Models.Document(denomination, type, 1); device.Enable(); device.SimulateInsertion(dep); device.Disable(); }
void updateData(double pay) { DeviceStatus status = deviceLibrary.Status; if (status != DeviceStatus.Enabled) { MessageBox.Show("Error de conexion."); goBack(); return; } if (lblRemaining.Text == "$0") { return; } //deviceLibrary.AcceptedDocument += DeviceLibrary_AcceptedDocument; Document document = new Document(Decimal.Parse(pay.ToString()), pay > 20 ? DocumentType.Bill : DocumentType.Coin, 1); deviceLibrary.SimulateInsertion(document); double newDebt = (double.Parse(lblRemaining.Text.Substring(1, lblRemaining.Text.Length - 1)) - pay); if (newDebt < 0) { newDebt = 0; } if (newDebt == 0) { lblChange.Text = "$" + ((double.Parse(lblDesposited.Text.Substring(1, lblDesposited.Text.Length - 1)) + pay) - double.Parse(lblDebt.Text.Substring(1, lblDebt.Text.Length - 1))).ToString(); } lblRemaining.Text = "$" + newDebt.ToString(); lblDesposited.Text = "$" + (double.Parse(lblDesposited.Text.Substring(1, lblDesposited.Text.Length - 1)) + pay).ToString(); dataAccess.addPayment(account.user, int.Parse(account.account), newDebt, double.Parse(lblDesposited.Text.Substring(1, lblDesposited.Text.Length - 1)) + pay); }
private void Button_Click(object sender, RoutedEventArgs e) { VariablesGlobales.c_quinientos += 1; dv.Enable(); dv.SimulateInsertion(quinentos); }