Exemplo n.º 1
0
 private void checkAttivo_CheckedChanged(object sender, RoutedEventArgs e)
 {
     if (utenteCorrente != null && !startup)
     {
         utenteCorrente.Status = checkAttivo.IsChecked.Value?1:0;
         DBSqlLite.modificaCliente(utenteCorrente);
         reloadUtenti();
     }
 }
Exemplo n.º 2
0
        //private void textBox_TextChanged(object sender, TextChangedEventArgs e)
        //{
        //    TextBox tb = ((TextBox)sender);
        //    tb.Text = tb.Text.ToUpper();
        //    tb.CaretIndex = tb.Text.Length;
        //}

        //private void textBoxMail_TextChanged(object sender, TextChangedEventArgs e)
        //{
        //    textBoxMail.Text = textBoxMail.Text.ToLower();
        //    textBoxMail.CaretIndex = textBoxMail.Text.Length;
        //}

        private void btnConferma_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (checkAllFilled())
                {
                    if (mUtente == null)
                    {
                        mUtente = new Utente();
                        if (users != null)
                        {
                            users.Add(mUtente.Identifier, mUtente);
                        }
                    }

                    mUtente.Nome                 = textBoxNome.Text;
                    mUtente.Cognome              = textBoxCognome.Text;
                    mUtente.DataDiNascita        = datePickerNascita.SelectedDate.Value;
                    mUtente.Email                = textBoxMail.Text;
                    mUtente.Indirizzo            = textBoxIndirizzo.Text;
                    mUtente.LuogoNascita         = textBoxLuogoNascita.Text;
                    mUtente.ScadenzaAbb          = datePickerAbb.SelectedDate.Value;
                    mUtente.ScadenzaVisitaMedica = datePickerVM.SelectedDate.Value;
                    mUtente.Sesso                = rbSessoM.IsChecked.Value ? "M" : "F";
                    mUtente.Stato                = comboBoxStato.SelectedItem.ToString();
                    mUtente.Telefono             = textBoxTelefono.Text;
                    mUtente.CodiceFiscale        = textBoxCF.Text;
                    if (provinciaBinding.ContainsKey(comboBoxProvincia.SelectedItem.ToString()))
                    {
                        mUtente.Provincia = provinciaBinding[comboBoxProvincia.SelectedItem.ToString()];
                    }

                    if (update)
                    {
                        DBSqlLite.modificaCliente(mUtente);
                    }
                    else
                    {
                        DBSqlLite.aggiungiCliente(mUtente);
                    }
                    resultOK = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Completare tutti i campi");
                }
            }
            catch (Exception ex)
            {
                Helper.Logger("class=WindowUtente btnConferma_Click - " + ex.Message);
            }
        }
Exemplo n.º 3
0
 private void btnElimina_Click(object sender, RoutedEventArgs e)
 {
     if (utenteCorrente != null)
     {
         MessageBoxResult result = System.Windows.MessageBox.Show("Eliminando il cliente verranno perse tutte le sue informazioni e la cronologia.Eliminare?", "Attezione", MessageBoxButton.YesNo);
         if (MessageBoxResult.Yes == result)
         {
             utenteCorrente.Status = -1;
             DBSqlLite.modificaCliente(utenteCorrente);
             reloadUtenti();
         }
     }
 }