private void btnUscita_Click(object sender, RoutedEventArgs e) { if (utenteCorrente != null) { Presenza pres = utenteCorrente.ListPresenze[utenteCorrente.getLastKey()]; pres.OraUscita = new TimeSpan(DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, DateTime.Now.TimeOfDay.Seconds); btnIngresso.IsEnabled = true; btnUscita.IsEnabled = false; DBSqlLite.modificaPresenza(pres); loadPresenzeTabella(); } }
private void btnConfirm_Click(object sender, RoutedEventArgs e) { switch (type) { case "var": if (!Helper.checkVariazioneCompleta(textBoxDescrVar.Text, textBoxImportoVar.Text)) { MessageBox.Show("Errore inserimento dati"); return; } varToEdit.Data = datePickerVariazione.SelectedDate.Value; varToEdit.DareAvere = Convert.ToBoolean(RbDare.IsChecked) ? 'D' : 'A'; double importo = Double.Parse(textBoxImportoVar.Text); if (RbDare.IsChecked.Value) { varToEdit.DescrizioneDare = textBoxDescrVar.Text; varToEdit.DescrizioneAvere = ""; varToEdit.ImportoDare = importo; varToEdit.ImportoAvere = 0; } else { varToEdit.DescrizioneDare = ""; varToEdit.DescrizioneAvere = textBoxDescrVar.Text; varToEdit.ImportoDare = 0; varToEdit.ImportoAvere = importo; } DBSqlLite.modificaVariazione(varToEdit); break; case "pres": presToEdit.Data = datePickerIngressi.SelectedDate.Value; presToEdit.OraIngresso = TimeSpan.Parse(textBoxOraIn.Text); presToEdit.OraUscita = TimeSpan.Parse(textBoxOraOut.Text); DBSqlLite.modificaPresenza(presToEdit); break; case "stor": storToEdit.Data = datePickerStorico.SelectedDate.Value; storToEdit.Descr = textBoxDescrStorico.Text; storToEdit.Fattura = textBoxFatturaStorico.Text; storToEdit.Importo = Double.Parse(textBoxImportoStorico.Text); DBSqlLite.modificaStorico(storToEdit); VariazioneEconomica varEco = new VariazioneEconomica(storToEdit.Data, storToEdit.Descr + " Fattura " + storToEdit.Fattura, storToEdit.Importo, true); varEco.IdVariazione = storToEdit.Idvariazione; DBSqlLite.modificaVariazione(varEco); break; } this.Close(); }