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 btnInserisciVariazione_Click(object sender, RoutedEventArgs e)
        {
            double importo          = Double.Parse(txtImportoVariazione.Text);
            VariazioneEconomica var = new VariazioneEconomica(datePickerVariazione.SelectedDate.Value, txtVariazione.Text, importo, Convert.ToBoolean(RbDare.IsChecked));

            DBSqlLite.aggiungiVariazione(var);
            listVariazioni = DBSqlLite.readVariazioni();
            loadVariazioni();
        }
Exemplo n.º 3
0
 private void btnModificaVar_Click(object sender, RoutedEventArgs e)
 {
     if (utenteCorrente != null && dataGridVariazioni.SelectedItem != null)
     {
         VariazioneEconomica var        = (VariazioneEconomica)dataGridVariazioni.SelectedItem;
         WindowEdit          windowEdit = new WindowEdit(var);
         windowEdit.ShowDialog();
         listVariazioni = DBSqlLite.readVariazioni();
         loadVariazioni();
     }
 }
Exemplo n.º 4
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.º 5
0
 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();
     }
 }
Exemplo n.º 6
0
        private int showClienti = 3; // 3 -> tutti,1 -> attivi,2 -> non attivi,

        public MainWindow()
        {
            bool start = false;

            //string testAbi = Helper.readRegistryKey("SN");
            //string testDsk = Helper.readRegistryKey("DSK");

            //if (!testAbi.Equals("null") && Helper.diskSerial().Equals(testDsk)){
            //    start = true;
            //}else
            //{
            //    WindowAbi dialog = new WindowAbi();
            //    dialog.ShowDialog();

            //    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
            //    {
            //        start = true;
            //    }
            //}

            if (DateTime.Now < Helper.scadenza)
            {
                start = true;
                if ((Helper.scadenza - DateTime.Now).TotalDays < 7)
                {
                    System.Windows.MessageBox.Show("Il programma scadrà tra meno di una settimana");
                }
                else if ((Helper.scadenza - DateTime.Now).TotalDays < 30)
                {
                    System.Windows.MessageBox.Show("Il programma scadrà tra meno di un mese");
                }
            }
            else
            {
                System.Windows.MessageBox.Show("Programma scaduto");
            }


            if (start)
            {
                InitializeComponent();

                //DBHelper.initDBConnection();
                listVariazioni = DBSqlLite.readVariazioni();
                datePickerVariazione.SelectedDate = DateTime.Now;
                loadVariazioni();
            }
            else
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
Exemplo n.º 7
0
 private void btnModificaStorico_Click(object sender, RoutedEventArgs e)
 {
     if (utenteCorrente != null && gridStoricoUtente.SelectedItem != null)
     {
         Storico    stor       = (Storico)gridStoricoUtente.SelectedItem;
         WindowEdit windowEdit = new WindowEdit(stor);
         windowEdit.ShowDialog();
         utenteCorrente.ListStorico = DBSqlLite.readStorico(utenteCorrente.Identifier);
         loadStoricoTabella();
         listVariazioni = DBSqlLite.readVariazioni();
         loadVariazioni();
     }
 }
Exemplo n.º 8
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();
         }
     }
 }
Exemplo n.º 9
0
        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();
        }
Exemplo n.º 10
0
 private void btnIngresso_Click(object sender, RoutedEventArgs e)
 {
     if (utenteCorrente != null)
     {
         Presenza pres = new Presenza();
         pres.Data        = DateTime.Now;
         pres.OraIngresso = new TimeSpan(DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, DateTime.Now.TimeOfDay.Seconds);
         utenteCorrente.ListPresenze.Add(pres.Data, pres);
         btnIngresso.IsEnabled = false;
         btnUscita.IsEnabled   = true;
         DBSqlLite.aggiungiPresenza(pres, utenteCorrente.Identifier);
         loadPresenzeTabella();
     }
 }
Exemplo n.º 11
0
        private void btnEliminaVar_Click(object sender, RoutedEventArgs e)
        {
            VariazioneEconomica varSelected = (VariazioneEconomica)dataGridVariazioni.SelectedItem;

            if (varSelected != null)
            {
                MessageBoxResult res = System.Windows.MessageBox.Show("Eliminare riga: " + varSelected.Data + "," + (varSelected.isDare() ? varSelected.DescrizioneDare + "," + varSelected.ImportoDare : varSelected.DescrizioneAvere + "," + varSelected.ImportoAvere), "", MessageBoxButton.YesNo);
                if (res == MessageBoxResult.Yes)
                {
                    DBSqlLite.eliminaVariazione(varSelected);
                    listVariazioni = DBSqlLite.readVariazioni();
                    loadVariazioni();
                }
            }
        }
Exemplo n.º 12
0
 private void btnEliminaStorico_Click(object sender, RoutedEventArgs e)
 {
     if (utenteCorrente != null && gridStoricoUtente.SelectedItem != null)
     {
         Storico stor = (Storico)gridStoricoUtente.SelectedItem;
         if (stor != null)
         {
             MessageBoxResult res = System.Windows.MessageBox.Show("Eliminare riga: " + stor.Data + "," + stor.Descr + "," + stor.Fattura, "", MessageBoxButton.YesNo);
             if (res == MessageBoxResult.Yes)
             {
                 DBSqlLite.eliminaStorico(stor);
                 utenteCorrente.ListStorico = DBSqlLite.readStorico(utenteCorrente.Identifier);
                 loadStoricoTabella();
             }
         }
     }
 }
Exemplo n.º 13
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     this.WindowState = WindowState.Maximized;
     DBSqlLite.readProvince();
     //listaUtenti = Helper.readUsers();
     listaUtenti = DBSqlLite.readClienti();
     foreach (Utente user in listaUtenti.Values)
     {
         user.ListStorico = DBSqlLite.readStorico(user.Identifier);
     }
     //DBSqlLite.aggiungiCliente(listaUtenti["1"]);
     reloadUtenti();
     if (cbClient.SelectedItem != null)
     {
         trovaUtente(cbClient.SelectedItem.ToString());
     }
     startup = false;
 }
Exemplo n.º 14
0
        private void btnInserisciStorico_Click(object sender, RoutedEventArgs e)
        {
            double  importo = Double.Parse(txtImportoStorico.Text);
            Storico stor    = new Storico();

            stor.Data      = datePickerStorico.SelectedDate.Value;
            stor.Descr     = txtDescrStorico.Text;
            stor.Fattura   = txtFattura.Text;
            stor.Importo   = importo;
            stor.Idcliente = utenteCorrente.Identifier;

            VariazioneEconomica varEco = new VariazioneEconomica(stor.Data, stor.Descr + " Fattura " + stor.Fattura, importo, true);


            DBSqlLite.aggiungiVariazione(varEco);
            stor.Idvariazione = varEco.IdVariazione;
            DBSqlLite.aggiungiStorico(stor);
            utenteCorrente.ListStorico = DBSqlLite.readStorico(utenteCorrente.Identifier);
            loadStoricoTabella();
            listVariazioni = DBSqlLite.readVariazioni();
            loadVariazioni();
        }
Exemplo n.º 15
0
        public static SortedList <string, Provincia> getProvince(bool forceRead = false)
        {
            if (province.Count == 0 || forceRead)
            {
                DBSqlLite.readProvince();
                //province.Clear();
                //try
                //{
                //    //Logger(pathBin);
                //    if (File.Exists(pathBin + "province.csv"))
                //    {
                //        string line;

                //        // Read the file and display it line by line.
                //        System.IO.StreamReader file = new System.IO.StreamReader(pathBin + "province.csv");
                //        while ((line = file.ReadLine()) != null)
                //        {
                //            string[] split = line.Split(',');
                //            if(split.Length > 2)
                //            {
                //                Provincia provincia = new Provincia(split[1], split[2], split[0]);
                //                province.Add(provincia.Abbr,provincia);
                //            }
                //        }

                //        file.Close();

                //    }
                //}
                //catch (Exception ex)
                //{
                //    Logger(ex.Message);
                //}
            }

            return(province);
        }