public void ConfiguraMaschera(string IDCliente)
        {
            stpSessioni1.Children.Clear();

            MasterFile mf = MasterFile.Create();

            alIncarichi = mf.GetIncarichi(IDCliente);

            foreach (Hashtable hthere in alIncarichi)
            {
                RadioButton chkSessione = new RadioButton();
                chkSessione.Tag     = hthere["ID"].ToString();
                chkSessione.Content = hthere["DataNomina"].ToString();
                stpSessioni1.Children.Add(chkSessione);
            }
        }
Exemple #2
0
        private void cmbClienti_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string IDCliente = htClienti[((ComboBox)sender).SelectedIndex].ToString();

            stpSessioni1.Children.Clear();

            MasterFile mf = MasterFile.Create();

            alIncarichi   = mf.GetIncarichi(IDCliente);
            alISQCs       = mf.GetISQCs(IDCliente);
            alRevisioni   = mf.GetRevisioni(IDCliente);
            alBilanci     = mf.GetBilanci(IDCliente);
            alConclusioni = mf.GetConclusioni(IDCliente);

            //INCARICHI
            TextBlock txt1 = new TextBlock();

            txt1.FontWeight          = FontWeights.Bold;
            txt1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txt1.Text   = "Incarichi";
            txt1.Margin = new Thickness(0, 0, 0, 5);
            stpSessioni1.Children.Add(txt1);

            foreach (Hashtable hthere in alIncarichi)
            {
                CheckBox chkSessione = new CheckBox();
                chkSessione.Tag     = hthere["ID"].ToString();
                chkSessione.Content = hthere["DataNomina"].ToString();
                stpSessioni1.Children.Add(chkSessione);
            }

            //ISQCs
            TextBlock txtISQC = new TextBlock();

            txtISQC.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txtISQC.Text       = "ISQC";
            txtISQC.FontWeight = FontWeights.Bold;
            txtISQC.Margin     = new Thickness(0, 10, 0, 5);
            stpSessioni1.Children.Add(txtISQC);

            foreach (Hashtable hthere in alISQCs)
            {
                CheckBox chkSessione = new CheckBox();
                chkSessione.Width   = 150;
                chkSessione.Tag     = hthere["ID"].ToString();
                chkSessione.Content = hthere["DataNomina"].ToString();
                stpSessioni1.Children.Add(chkSessione);
            }

            //REVISIONI - BILANCI - CONCLUSIONI
            try
            {
                OldSelectedCmbClienti = Convert.ToInt32(IDCliente);

                int index = 0;
                htDate.Clear();
                cmbData.Items.Clear();
                stpSessioni239.Visibility = Visibility.Collapsed;

                List <KeyValuePair <string, string> > myList = new List <KeyValuePair <string, string> >();

                ArrayList alreadydone = new ArrayList();

                foreach (Hashtable item in mf.GetBilanci(IDCliente))
                {
                    myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
                    alreadydone.Add(ConvertDataToEsercizio(item["Data"].ToString()));
                }

                foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                {
                    if (!alreadydone.Contains(ConvertDataToEsercizio(item["Data"].ToString())))
                    {
                        myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
                        alreadydone.Add(ConvertDataToEsercizio(item["Data"].ToString()));
                    }
                }

                foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                {
                    if (!alreadydone.Contains(ConvertDataToEsercizio(item["Data"].ToString())))
                    {
                        myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
                    }
                }

                myList.Sort
                (
                    delegate(KeyValuePair <string, string> firstPair, KeyValuePair <string, string> nextPair)
                {
                    try
                    {
                        return(nextPair.Value.ToString().CompareTo(firstPair.Value.ToString()));
                    }
                    catch (Exception ex)
                    {
                        cBusinessObjects.logger.Error(ex, "wStampaFascicolo.cmbClienti_SelectionChanged1 exception");
                        string log = ex.Message;
                        return(1);
                    }
                }
                );

                foreach (KeyValuePair <string, string> item in myList)
                {
                    cmbData.Items.Add(item.Value);
                    htDate.Add(index, item.Key);
                    index++;
                    stpSessioni239.Visibility = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wStampaFascicolo.cmbClienti_SelectionChanged2 exception");
                string log = ex.Message;
                cmbData.IsEnabled = false;
            }
        }
Exemple #3
0
        //----------------------------------------------------------------------------+
        //                                   accedi                                   |
        //----------------------------------------------------------------------------+
        public void accedi(string ID, bool ReadOnly)
        {
            MasterFile mf         = MasterFile.Create();
            Hashtable  htSelected = mf.GetIncarico(ID);

            if (htSelected.Count == 0)
            {
                //MessageBox.Show("wSchedaIncarico.xaml.cs, accedi(): incarico non trovato");
                return;
            }
            WindowWorkAreaTree wWorkArea = new WindowWorkAreaTree();

            //Prisc
            try
            {
                wWorkArea.Owner = this;
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wSchedaIncarico.accedi exception");
                string log = ex.Message;
            }
            wWorkArea.SelectedTreeSource = App.AppDataDataFolder + "\\" + htSelected["File"].ToString();
            wWorkArea.SelectedDataSource = App.AppDataDataFolder + "\\" + htSelected["FileData"].ToString();
            if (htSelected["Sigillo"] != null && htSelected["Sigillo"].ToString() != "")
            {
                wWorkArea.ReadOnly = true;
            }
            else
            {
                wWorkArea.ReadOnly = ReadOnly;
            }
            foreach (var Window in App.Current.Windows)
            {
                if (Window.GetType().Name == "MainWindow")
                {
                    if (((RevisoftApplication.MainWindow)Window).Area1CS.IsChecked == true)
                    {
                        wWorkArea.TipoAttivita = App.TipoAttivita.IncaricoCS;
                    }
                    if (((RevisoftApplication.MainWindow)Window).Area1SU.IsChecked == true)
                    {
                        wWorkArea.TipoAttivita = App.TipoAttivita.IncaricoSU;
                    }
                    if (((RevisoftApplication.MainWindow)Window).Area1REV.IsChecked == true)
                    {
                        wWorkArea.TipoAttivita = App.TipoAttivita.IncaricoREV;
                    }
                }
            }


            wWorkArea.Cliente                 = (((Hashtable)(mf.GetAnagrafica(Convert.ToInt32(htSelected["Cliente"].ToString()))))["RagioneSociale"].ToString()) + " (C.F. " + (((Hashtable)(mf.GetAnagrafica(Convert.ToInt32(htSelected["Cliente"].ToString()))))["CodiceFiscale"].ToString()) + ")";
            wWorkArea.SessioneAlias           = "";
            wWorkArea.SessioneFile            = "";
            wWorkArea.SessioneSigillo         = null;
            wWorkArea.SessioneSigilloData     = null;
            wWorkArea.SessioneSigilloPassword = null;
            if (area1 == "CS")
            {
                wWorkArea.IDTree = (Convert.ToInt32(App.TipoFile.IncaricoCS)).ToString();
            }
            if (area1 == "SU")
            {
                wWorkArea.IDTree = (Convert.ToInt32(App.TipoFile.IncaricoSU)).ToString();
            }
            if (area1 == "REV")
            {
                wWorkArea.IDTree = (Convert.ToInt32(App.TipoFile.IncaricoREV)).ToString();
            }


            wWorkArea.IDCliente  = htSelected["Cliente"].ToString();
            wWorkArea.IDSessione = ID;
            foreach (Hashtable item in ((ArrayList)(mf.GetIncarichi(htSelected["Cliente"].ToString(), area1))))
            {
                wWorkArea.SessioneFile += ((wWorkArea.SessioneFile == "") ? "" : "|") + App.AppDataDataFolder + "\\" + item["FileData"].ToString();
                switch ((App.TipoIncaricoAttivita)(Convert.ToInt32(item["Attivita"].ToString())))
                {
                case App.TipoIncaricoAttivita.Nomina:
                    wWorkArea.SessioneAliasAdditivo += ((wWorkArea.SessioneAliasAdditivo == "") ? "" : "|") + "Incarico";
                    break;

                case App.TipoIncaricoAttivita.Riesame:
                    wWorkArea.SessioneAliasAdditivo += ((wWorkArea.SessioneAliasAdditivo == "") ? "" : "|") + "Riesame";
                    break;

                case App.TipoIncaricoAttivita.Sconosciuto:
                default:
                    wWorkArea.SessioneAliasAdditivo += ((wWorkArea.SessioneAliasAdditivo == "") ? "" : "|") + "";
                    break;
                }
                //wWorkArea.SessioneAlias += ((wWorkArea.SessioneAlias == "") ? "" : "|") + ((item["DataNomina"].ToString().Split('/')[2].Length == 2) ? item["DataNomina"].ToString().Split('/')[0] + "/" + item["DataNomina"].ToString().Split('/')[1] + "/20" + item["DataNomina"].ToString().Split('/')[2] : item["DataNomina"].ToString());
                wWorkArea.SessioneAlias           += ((wWorkArea.SessioneAlias == "") ? "" : "|") + item["DataNomina"].ToString();
                wWorkArea.SessioneID              += ((wWorkArea.SessioneID == "") ? "" : "|") + item["ID"].ToString();
                wWorkArea.SessioneSigillo         += ((wWorkArea.SessioneSigillo == null) ? "" : "|") + ((item["Sigillo"] != null) ? item["Sigillo"].ToString() : "");
                wWorkArea.SessioneSigilloData     += ((wWorkArea.SessioneSigilloData == null) ? "" : "|") + ((item["Sigillo_Data"] != null) ? item["Sigillo_Data"].ToString() : "");
                wWorkArea.SessioneSigilloPassword += ((wWorkArea.SessioneSigilloPassword == null) ? "" : "|") + ((item["Sigillo_Password"] != null) ? item["Sigillo_Password"].ToString() : "");
            }
            //aperto in sola lettura
            wWorkArea.ApertoInSolaLettura = TipologiaAttivita == App.TipoAttivitaScheda.View;
            wWorkArea.LoadTreeSource();
            Hide();
            cBusinessObjects.hide_workinprogress();
            wWorkArea.ShowDialog();
            if (TipologiaAttivita != App.TipoAttivitaScheda.View)
            {
                int IDCliente = Convert.ToInt32(htClienti[cmbClienti.SelectedIndex].ToString());
                mf.SetAnafraficaStato(Convert.ToInt32(IDCliente), App.TipoAnagraficaStato.Disponibile);
            }

            Close(); // new LC
        }
Exemple #4
0
        //----------------------------------------------------------------------------+
        //                         functionCmbClientiChanged                          |
        //----------------------------------------------------------------------------+
        private void functionCmbClientiChanged(ComboBox cmb)
        {
            if (_cmbInCaricamento)
            {
                return;
            }
            if (oldTipologiaAttivita != App.TipoAttivitaScheda.View)
            {
                TipologiaAttivita = oldTipologiaAttivita;
            }
            _InCaricamento                  = true;
            cmbData.SelectedIndex           = -1;
            dtpDataNomina.Text              = "";
            rdbAttivitaNomina.IsChecked     = false;
            rdbAttivitaRiesame.IsChecked    = false;
            rdbCollegioSindacale.IsChecked  = false;
            rdbRevisoreSincoUnico.IsChecked = false;
            txtNota.Text = "";
            if (cmb.SelectedIndex != -1)
            {
                try
                {
                    string IDCliente = htClienti[cmb.SelectedIndex].ToString();
                    OldSelectedCmbClienti = Convert.ToInt32(IDCliente);
                    MasterFile mf    = MasterFile.Create();
                    int        index = 0;
                    htDate.Clear();
                    cmbData.Items.Clear();
                    Hashtable attivita = new Hashtable();
                    List <KeyValuePair <string, string> > myList = new List <KeyValuePair <string, string> >();
                    foreach (Hashtable item in mf.GetIncarichi(IDCliente, area1))
                    {
                        switch ((App.TipoIncaricoAttivita)(Convert.ToInt32(item["Attivita"].ToString())))
                        {
                        case App.TipoIncaricoAttivita.Nomina:
                            attivita.Add(item["ID"].ToString(), " (Incarico)");
                            break;

                        case App.TipoIncaricoAttivita.Riesame:
                            attivita.Add(item["ID"].ToString(), " (Riesame___Incarico)");
                            break;

                        case App.TipoIncaricoAttivita.Sconosciuto:
                        default:
                            attivita.Add(item["ID"].ToString(), "");
                            break;
                        }
                        myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), item["DataNomina"].ToString()));
                    }
                    myList.Sort
                    (
                        delegate(KeyValuePair <string, string> firstPair, KeyValuePair <string, string> nextPair)
                    {
                        return(Convert.ToDateTime(nextPair.Value).CompareTo(Convert.ToDateTime(firstPair.Value)));
                    }
                    );
                    foreach (KeyValuePair <string, string> item in myList)
                    {
                        cmbData.Items.Add(item.Value + attivita[item.Key].ToString());
                        htDate.Add(index, item.Key);
                        index++;
                    }
                    //stato
                    if (IDClienteImport == "-1")
                    {
                        App.TipoAnagraficaStato anaStato = mf.GetAnafraficaStato(Convert.ToInt32(IDCliente));
                        //non disponibile: configuro interfaccia
                        if (anaStato != App.TipoAnagraficaStato.Disponibile)
                        {
                            oldTipologiaAttivita = TipologiaAttivita;
                            TipologiaAttivita    = App.TipoAttivitaScheda.View;
                        }
                    }
                    if (TipologiaAttivita != App.TipoAttivitaScheda.New)
                    {
                        cmbData.IsEnabled               = true;
                        dtpDataNomina.IsEnabled         = false;
                        rdbAttivitaNomina.IsEnabled     = false;
                        rdbAttivitaRiesame.IsEnabled    = false;
                        rdbCollegioSindacale.IsEnabled  = false;
                        rdbRevisoreSincoUnico.IsEnabled = false;
                        txtNota.IsEnabled               = false;
                    }
                    else
                    {
                        cmbData.IsEnabled               = false;
                        dtpDataNomina.IsEnabled         = true;
                        rdbAttivitaNomina.IsEnabled     = true;
                        rdbAttivitaRiesame.IsEnabled    = true;
                        rdbCollegioSindacale.IsEnabled  = true;
                        rdbRevisoreSincoUnico.IsEnabled = true;
                        txtNota.IsEnabled               = true;
                    }
                }
                catch (Exception ex)
                {
                    cBusinessObjects.logger.Error(ex, "wSchedaIncarico.functionCmbClientiChanged exception");
                    string log = ex.Message;
                    cmbData.IsEnabled               = false;
                    dtpDataNomina.IsEnabled         = false;
                    rdbAttivitaNomina.IsEnabled     = false;
                    rdbAttivitaRiesame.IsEnabled    = false;
                    rdbCollegioSindacale.IsEnabled  = false;
                    rdbRevisoreSincoUnico.IsEnabled = false;
                    txtNota.IsEnabled               = false;
                }
            }
        }
Exemple #5
0
        //------------------------------------------------------------------------+
        //                      cmbClienti_SelectionChanged                       |
        //------------------------------------------------------------------------+
        private void cmbClienti_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int    counter;
            string IDCliente, str;

            IDCliente = htClienti[((ComboBox)sender).SelectedIndex].ToString();
            stpSessioni1.Children.Clear();
            stpSessioniISQC.Children.Clear();
            stpSessioni2.Children.Clear();
            stpSessioni3.Children.Clear();
            stpSessioni9.Children.Clear();

            MasterFile mf = MasterFile.Create();

            alIncarichi   = mf.GetIncarichi(IDCliente);
            alISQCs       = mf.GetISQCs(IDCliente);
            alRevisioni   = mf.GetRevisioni(IDCliente);
            alBilanci     = mf.GetBilanci(IDCliente);
            alConclusioni = mf.GetConclusioni(IDCliente);

            str = string.Format(
                "select * from dbo.ArchivioDocumenti where (ID_CLIENTE={0})", IDCliente);
            _dtDox = StaticUtilities.DataTableFromQuery(str);

            #region INCARICHI
            //----------------------------------------------------------------------+
            //                              INCARICHI                               |
            //----------------------------------------------------------------------+
            TextBlock txt1 = new TextBlock();
            txt1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txt1.Text       = "Area 1";
            txt1.FontWeight = FontWeights.Bold;
            txt1.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioni1.Children.Add(txt1);

            CheckBox chkSessioneTutto1 = new CheckBox();
            chkSessioneTutto1.Tag        = "-1";
            chkSessioneTutto1.Content    = "Tutte";
            chkSessioneTutto1.Margin     = new Thickness(0, 0, 0, 5);
            chkSessioneTutto1.Checked   += chkSessioneTutto1_Checked;
            chkSessioneTutto1.Unchecked += chkSessioneTutto1_Unchecked;
            stpSessioni1.Children.Add(chkSessioneTutto1);

            foreach (Hashtable hthere in alIncarichi)
            {
                counter = 0;
                str     = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                        Convert.ToInt32(App.TipoFile.Incarico), hthere["ID"].ToString());
                foreach (DataRow dr in _dtDox.Select(str))
                {
                    str = App.AppDocumentiFolder + "\\" + dr["File"].ToString();
                    if (File.Exists(str))
                    {
                        counter++;
                    }
                }
                if (counter > 0)
                {
                    CheckBox chkSessione = new CheckBox();
                    chkSessione.Tag     = hthere["ID"].ToString();
                    chkSessione.Content = hthere["DataNomina"].ToString() + " (" + counter.ToString() + ")";
                    stpSessioni1.Children.Add(chkSessione);
                }
            }
            #endregion

            #region ISQC
            //----------------------------------------------------------------------+
            //                                 ISQC                                 |
            //----------------------------------------------------------------------+
            TextBlock txtISQC = new TextBlock();
            txtISQC.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txtISQC.Text       = "ISQC";
            txtISQC.FontWeight = FontWeights.Bold;
            txtISQC.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioniISQC.Children.Add(txtISQC);

            CheckBox chkSessioneTuttoISQC = new CheckBox();
            chkSessioneTuttoISQC.Tag        = "-1";
            chkSessioneTuttoISQC.Content    = "Tutte";
            chkSessioneTuttoISQC.Margin     = new Thickness(0, 0, 0, 5);
            chkSessioneTuttoISQC.Checked   += chkSessioneTuttoISQC_Checked;
            chkSessioneTuttoISQC.Unchecked += chkSessioneTuttoISQC_Unchecked;
            stpSessioniISQC.Children.Add(chkSessioneTuttoISQC);

            foreach (Hashtable hthere in alISQCs)
            {
                counter = 0;
                str     = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                        Convert.ToInt32(App.TipoFile.ISQC), hthere["ID"].ToString());
                foreach (DataRow dr in _dtDox.Select(str))
                {
                    str = App.AppDocumentiFolder + "\\" + dr["File"].ToString();
                    if (File.Exists(str))
                    {
                        counter++;
                    }
                }
                if (counter > 0)
                {
                    CheckBox chkSessione = new CheckBox();
                    chkSessione.Tag     = hthere["ID"].ToString();
                    chkSessione.Content = hthere["DataNomina"].ToString() + " (" + counter.ToString() + ")";
                    stpSessioniISQC.Children.Add(chkSessione);
                }
            }
            #endregion

            #region REVISIONI
            //----------------------------------------------------------------------+
            //                              REVISIONI                               |
            //----------------------------------------------------------------------+
            txt1 = new TextBlock();
            txt1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txt1.Text       = "Area 2";
            txt1.FontWeight = FontWeights.Bold;
            txt1.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioni2.Children.Add(txt1);

            chkSessioneTutto1            = new CheckBox();
            chkSessioneTutto1.Tag        = "-1";
            chkSessioneTutto1.Content    = "Tutte";
            chkSessioneTutto1.Margin     = new Thickness(0, 0, 0, 5);
            chkSessioneTutto1.Checked   += chkSessioneTutto2_Checked;
            chkSessioneTutto1.Unchecked += chkSessioneTutto2_Unchecked;
            stpSessioni2.Children.Add(chkSessioneTutto1);

            foreach (Hashtable hthere in alRevisioni)
            {
                counter = 0;
                str     = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                        Convert.ToInt32(App.TipoFile.Revisione), hthere["ID"].ToString());
                foreach (DataRow dr in _dtDox.Select(str))
                {
                    str = App.AppDocumentiFolder + "\\" + dr["File"].ToString();
                    if (File.Exists(str))
                    {
                        counter++;
                    }
                }
                if (counter > 0)
                {
                    CheckBox chkSessione = new CheckBox();
                    chkSessione.Tag     = hthere["ID"].ToString();
                    chkSessione.Content = hthere["Data"].ToString().Replace("01/01/", "").Replace("31/12/", "")
                                          + " (" + counter.ToString() + ")";
                    stpSessioni2.Children.Add(chkSessione);
                }
            }
            #endregion

            #region BILANCI
            //----------------------------------------------------------------------+
            //                               BILANCI                                |
            //----------------------------------------------------------------------+
            txt1 = new TextBlock();
            txt1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txt1.Text       = "Area 3";
            txt1.FontWeight = FontWeights.Bold;
            txt1.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioni3.Children.Add(txt1);

            chkSessioneTutto1            = new CheckBox();
            chkSessioneTutto1.Tag        = "-1";
            chkSessioneTutto1.Content    = "Tutte";
            chkSessioneTutto1.Margin     = new Thickness(0, 0, 0, 5);
            chkSessioneTutto1.Checked   += chkSessioneTutto3_Checked;
            chkSessioneTutto1.Unchecked += chkSessioneTutto3_Unchecked;
            stpSessioni3.Children.Add(chkSessioneTutto1);

            foreach (Hashtable hthere in alBilanci)
            {
                counter = 0;
                str     = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                        Convert.ToInt32(App.TipoFile.Bilancio), hthere["ID"].ToString());
                foreach (DataRow dr in _dtDox.Select(str))
                {
                    str = App.AppDocumentiFolder + "\\" + dr["File"].ToString();
                    if (File.Exists(str))
                    {
                        counter++;
                    }
                }
                if (counter > 0)
                {
                    CheckBox chkSessione = new CheckBox();
                    chkSessione.Tag     = hthere["ID"].ToString();
                    chkSessione.Content = hthere["Data"].ToString().Replace("01/01/", "").Replace("31/12/", "")
                                          + " (" + counter.ToString() + ")";
                    stpSessioni3.Children.Add(chkSessione);
                }
            }
            #endregion

            #region CONCLUSIONI
            //----------------------------------------------------------------------+
            //                             CONCLUSIONI                              |
            //----------------------------------------------------------------------+
            txt1 = new TextBlock();
            txt1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txt1.Text       = "Area 9";
            txt1.FontWeight = FontWeights.Bold;
            txt1.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioni9.Children.Add(txt1);

            chkSessioneTutto1            = new CheckBox();
            chkSessioneTutto1.Tag        = "-1";
            chkSessioneTutto1.Content    = "Tutte";
            chkSessioneTutto1.Margin     = new Thickness(0, 0, 0, 5);
            chkSessioneTutto1.Checked   += chkSessioneTutto9_Checked;
            chkSessioneTutto1.Unchecked += chkSessioneTutto9_Unchecked;
            stpSessioni9.Children.Add(chkSessioneTutto1);

            foreach (Hashtable hthere in alConclusioni)
            {
                counter = 0;
                str     = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                        Convert.ToInt32(App.TipoFile.Conclusione), hthere["ID"].ToString());
                foreach (DataRow dr in _dtDox.Select(str))
                {
                    str = App.AppDocumentiFolder + "\\" + dr["File"].ToString();
                    if (File.Exists(str))
                    {
                        counter++;
                    }
                }
                if (counter > 0)
                {
                    CheckBox chkSessione = new CheckBox();
                    chkSessione.Tag     = hthere["ID"].ToString();
                    chkSessione.Content = hthere["Data"].ToString().Replace("01/01/", "").Replace("31/12/", "")
                                          + " (" + counter.ToString() + ")";
                    stpSessioni9.Children.Add(chkSessione);
                }
            }
            #endregion
        }
Exemple #6
0
        public void ConfiguraMaschera()
        {
            MasterFile mf = MasterFile.Create();

            int index = 0;

            int selectedIndex = -1;

            if (cmbClienti.Items.Count != 0)
            {
                selectedIndex = cmbClienti.SelectedIndex;
                cmbClienti.Items.Clear();
                htClienti.Clear();
            }

            List <KeyValuePair <string, string> > myList = new List <KeyValuePair <string, string> >();

            foreach (Hashtable item in mf.GetAnagrafiche())
            {
                if (mf.GetBilanci(item["ID"].ToString()).Count == 0 && mf.GetRevisioni(item["ID"].ToString()).Count == 0 && mf.GetISQCs(item["ID"].ToString()).Count == 0 && mf.GetIncarichi(item["ID"].ToString()).Count == 0 && mf.GetConclusioni(item["ID"].ToString()).Count == 0 && mf.GetVerifiche(item["ID"].ToString()).Count == 0)
                {
                    continue;
                }

                string cliente = item["RagioneSociale"].ToString();

                myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), cliente));
            }

            myList.Sort
            (
                delegate(KeyValuePair <string, string> firstPair, KeyValuePair <string, string> nextPair)
            {
                return(firstPair.Value.CompareTo(nextPair.Value));
            }
            );

            foreach (KeyValuePair <string, string> item in myList)
            {
                cmbClienti.Items.Add(item.Value);
                htClienti.Add(index, item.Key);
                index++;
            }

            cmbClienti.SelectedIndex = selectedIndex;

            string IDCliente = mf.GetClienteFissato();

            foreach (DictionaryEntry item in htClienti)
            {
                if (item.Value.ToString() == IDCliente)
                {
                    cmbClienti.SelectedIndex = Convert.ToInt32(item.Key.ToString());
                    return;
                }
            }
        }
        //----------------------------------------------------------------------------+
        //                                    Load                                    |
        //----------------------------------------------------------------------------+
        public void Load()
        {
            MasterFile mf    = MasterFile.Create();
            int        index = 0;
            ArrayList  al    = new ArrayList();
            List <KeyValuePair <string, string> > myList =
                new List <KeyValuePair <string, string> >();

            switch ((App.TipoFile)(System.Convert.ToInt32(Tree)))
            {
            case App.TipoFile.Revisione:
                al = mf.GetRevisioni(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["Data"].ToString().Replace("01/01/", "")));
                    }
                }
                break;

            case App.TipoFile.PianificazioniVerifica:
                al = mf.GetPianificazioniVerifiche(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataInizio"].ToString() + " - " +
                                       item["DataFine"].ToString()));
                    }
                }
                break;

            case App.TipoFile.PianificazioniVigilanza:
                al = mf.GetPianificazioniVigilanze(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataInizio"].ToString() + " - " +
                                       item["DataFine"].ToString()));
                    }
                }
                break;

            case App.TipoFile.Verifica:
                al = mf.GetVerifiche(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["Data"].ToString()));
                    }
                }
                break;

            case App.TipoFile.Vigilanza:
                al = mf.GetVigilanze(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["Data"].ToString()));
                    }
                }
                break;

            case App.TipoFile.Incarico:
                al = mf.GetIncarichi(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataNomina"].ToString()));
                    }
                }
                break;

            case App.TipoFile.IncaricoCS:
                al = mf.GetIncarichi(Cliente, "CS");
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataNomina"].ToString()));
                    }
                }
                break;

            case App.TipoFile.IncaricoSU:
                al = mf.GetIncarichi(Cliente, "SU");
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataNomina"].ToString()));
                    }
                }
                break;

            case App.TipoFile.IncaricoREV:
                al = mf.GetIncarichi(Cliente, "REV");
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataNomina"].ToString()));
                    }
                }
                break;

            case App.TipoFile.ISQC:
                al = mf.GetISQCs(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["DataNomina"].ToString()));
                    }
                }
                break;

            case App.TipoFile.Bilancio:
                al = mf.GetBilanci(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["Data"].ToString().Replace("01/01/", "")));
                    }
                }
                break;

            case App.TipoFile.Conclusione:
                al = mf.GetConclusioni(Cliente);
                foreach (Hashtable item in al)
                {
                    if (item["ID"].ToString() != Sessione)
                    {
                        myList.Add(new KeyValuePair <string, string>(
                                       item["ID"].ToString(), item["Data"].ToString().Replace("01/01/", "")));
                    }
                }
                break;

            case App.TipoFile.Licenza:
            case App.TipoFile.Master:
            case App.TipoFile.Info:
            case App.TipoFile.Messagi:
            case App.TipoFile.ImportExport:
            case App.TipoFile.ImportTemplate:
            case App.TipoFile.BackUp:
            case App.TipoFile.Formulario:
            case App.TipoFile.ModellPredefiniti:
            case App.TipoFile.DocumentiAssociati:
            default:
                base.Close();
                break;
            } // switch

            myList.Sort(
                delegate(KeyValuePair <string, string> firstPair,
                         KeyValuePair <string, string> nextPair)
            {
                return(Convert.ToDateTime(((firstPair.Value.Contains(' ')) ?
                                           firstPair.Value.Split(' ')[0] : ((firstPair.Value.Length == 4) ?
                                                                            "01/01/" + firstPair.Value : firstPair.Value))).CompareTo(
                           Convert.ToDateTime(((firstPair.Value.Contains(' ')) ?
                                               firstPair.Value.Split(' ')[0] :((nextPair.Value.Length == 4) ?
                                                                               "01/01/" + nextPair.Value : nextPair.Value)))));
            });

            foreach (KeyValuePair <string, string> item in myList)
            {
                ht.Add(index++, item.Key);
                lstSessioni.Items.Add(item.Value);
            }
        }
 //----------------------------------------------------------------------------+
 //                            buttonApplica_Click                             |
 //----------------------------------------------------------------------------+
 private void buttonApplica_Click_old(object sender, RoutedEventArgs e)
 {
   if (MessageBox.Show(
     "Si ricorda che il Sigillo viene applicato contemporaneamente ai " +
     "nodi 1) 2) 3) e 9) del cliente e dell'anno selezionato. La Rimozione " +
     "di questo sigillo equivale a rimuovere il Sigillo in toto. Procedere?",
     "ATTENZIONE", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
   {
     return;
   }
   GestioneLicenza gl = new GestioneLicenza();
   string intestatario = gl.Utente; // UtenteSigillo;
   if (Nodo.Attributes["Revisore"] != null
     && intestatario == Nodo.Attributes["Revisore"].Value)
   {
     if (Nodo.Attributes["Password"] != null
       && txtPassword.Password == Nodo.Attributes["Password"].Value)
     {
       MasterFile mf = MasterFile.Create();
       foreach (Hashtable item in mf.GetIncarichi(IDCliente))
       {
         if (ConvertDataToEsercizio(AliasSessione) == ConvertDataToEsercizio(item["DataNomina"].ToString()))
         {
           mf.RemoveSigilloIncarico(Convert.ToInt32(item["ID"].ToString()));
         }
       }
       foreach (Hashtable item in mf.GetISQCs(IDCliente))
       {
         if (ConvertDataToEsercizio(AliasSessione) == ConvertDataToEsercizio(item["DataNomina"].ToString()))
         {
           mf.RemoveSigilloISQC(Convert.ToInt32(item["ID"].ToString()));
         }
       }
       foreach (Hashtable item in mf.GetBilanci(IDCliente))
       {
         if (ConvertDataToEsercizio(AliasSessione) == ConvertDataToEsercizio(item["Data"].ToString()))
         {
           mf.RemoveSigilloBilancio(Convert.ToInt32(item["ID"].ToString()));
         }
       }
       foreach (Hashtable item in mf.GetConclusioni(IDCliente))
       {
         if (ConvertDataToEsercizio(AliasSessione) == ConvertDataToEsercizio(item["Data"].ToString()))
         {
           mf.RemoveSigilloConclusione(Convert.ToInt32(item["ID"].ToString()));
         }
       }
       foreach (Hashtable item in mf.GetRevisioni(IDCliente))
       {
         if (ConvertDataToEsercizio(AliasSessione) == ConvertDataToEsercizio(item["Data"].ToString()))
         {
           mf.RemoveSigilloRevisione(Convert.ToInt32(item["ID"].ToString()));
         }
       }
       Nodo.Attributes["Stato"].Value = (Convert.ToInt32(App.TipoTreeNodeStato.SigilloRotto)).ToString();
       ((WindowWorkAreaTree)Owner).ReadOnly = false;
     }
     else
     {
       MessageBox.Show("Attenzione! Password Errata");
     }
   }
   else
   {
     MessageBox.Show("Attenzione! Questo utente non è autorizzato a interagire con il Sigillo");
   }
   base.Close();
 }
        //----------------------------------------------------------------------------+
        //                               LoadTreeSource                               |
        //----------------------------------------------------------------------------+

        public void LoadTreeSource()
        {
            if (Data == "")
            {
                Data = DateTime.Now.ToShortDateString();
            }
            ArrayList pianificatehere = new ArrayList();

            txtData.Text = Data;
            RevisoftApplication.XmlManager x = new XmlManager();
            x.TipoCodifica = RevisoftApplication.XmlManager.TipologiaCodifica.Normale;
            MasterFile mf    = MasterFile.Create();
            ArrayList  files = new ArrayList();

            switch (TipoAttivita)
            {
            case App.TipoAttivita.Incarico:
                SelectedTreeSource = App.AppTemplateTreeIncarico;
                files = mf.GetIncarichi(IDCliente);
                break;

            case App.TipoAttivita.ISQC:
                SelectedTreeSource = App.AppTemplateTreeISQC;
                files = mf.GetISQCs(IDCliente);
                break;

            case App.TipoAttivita.Revisione:
                SelectedTreeSource = App.AppTemplateTreeRevisione;
                files = mf.GetRevisioni(IDCliente);
                break;

            case App.TipoAttivita.Bilancio:
                SelectedTreeSource = App.AppTemplateTreeBilancio;
                files = mf.GetBilanci(IDCliente);
                break;

            case App.TipoAttivita.Conclusione:
                SelectedTreeSource = App.AppTemplateTreeConclusione;
                files = mf.GetConclusioni(IDCliente);
                break;

            case App.TipoAttivita.Verifica:
                files = mf.GetVerifiche(IDCliente);
                SelectedTreeSource = App.AppTemplateTreeVerifica;
                ArrayList al = mf.GetPianificazioniVerifiche(IDCliente);
                foreach (Hashtable itemHT in al)
                {
                    ALXTPP.Add(itemHT["ID"].ToString());
                }
                break;

            case App.TipoAttivita.Vigilanza:
                files = mf.GetVigilanze(IDCliente);
                SelectedTreeSource = App.AppTemplateTreeVigilanza;
                ArrayList al2 = mf.GetPianificazioniVigilanze(IDCliente);
                foreach (Hashtable itemHT in al2)
                {
                    ALXTPP.Add(itemHT["ID"].ToString());
                }
                break;

            default:
                return;
            }
            if (files.Count > 0)
            {
                string   maxID = "0", id;
                DateTime lastdate = Convert.ToDateTime("01/01/1900");
                string   tobeused = "";
                foreach (Hashtable itemHT in files)
                {
                    if (itemHT.Contains("ID"))
                    {
                        id = itemHT["ID"].ToString();
                        if (Convert.ToInt32(id) > Convert.ToInt32(maxID))
                        {
                            maxID = id; tobeused = itemHT["File"].ToString();
                        }
                    }
                }
                _xTXP = new XmlDataProviderManager(tobeused);
                TreeXmlProvider.Document = x.LoadEncodedFile(tobeused);
            }
            else
            {
                _xTXP = new XmlDataProviderManager(SelectedTreeSource);
                TreeXmlProvider.Document = x.LoadEncodedFile(SelectedTreeSource);
            }
            if (firsttime)
            {
                firsttime = false;
                foreach (XmlNode item in _xTXP.Document.SelectNodes("//Node"))
                {
                    if (item.Attributes["WidthNota"] == null)
                    {
                        XmlAttribute attr = _xTXP.Document.CreateAttribute("WidthNota");
                        item.Attributes.Append(attr);
                    }
                    if (item.SelectNodes("Node").Count > 0)
                    {
                        item.Attributes["WidthNota"].Value = "0";
                    }
                    else
                    {
                        item.Attributes["WidthNota"].Value = "Auto";
                    }
                    if (item.Attributes["Checked"] == null)
                    {
                        XmlAttribute attr = _xTXP.Document.CreateAttribute("Checked");
                        item.Attributes.Append(attr);
                        item.Attributes["Checked"].Value = "False";
                    }
                    if (item.Attributes["NotaTDL"] == null)
                    {
                        XmlAttribute attr = _xTXP.Document.CreateAttribute("NotaTDL");
                        item.Attributes.Append(attr);
                        item.Attributes["NotaTDL"].Value = "";
                    }
                    item.Attributes["Expanded"].Value = "True";
                    item.Attributes["Selected"].Value = "False";
                    if (item.Attributes["Pianificato"] == null)
                    {
                        XmlAttribute attr = item.OwnerDocument.CreateAttribute("Pianificato");
                        attr.Value = "";
                        item.Attributes.Append(attr);
                    }
                    DataTable pianificazione        = null;
                    DataTable pianificazioneTestata = null;
                    foreach (string ALitemXTPP in ALXTPP)
                    {
                        bool   donehere = false;
                        string IDPHERE  = "";
                        string datac    = "";

                        if (TipoAttivita == App.TipoAttivita.Verifica)
                        {
                            IDPHERE = "100013";
                            pianificazioneTestata = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerificheTestata), int.Parse(IDCliente), int.Parse(ALitemXTPP), 26);
                            pianificazione        = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerifiche), int.Parse(IDCliente), int.Parse(ALitemXTPP), 26);
                        }
                        else
                        {
                            IDPHERE = "100003";
                            pianificazioneTestata = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerificheTestata), int.Parse(IDCliente), int.Parse(ALitemXTPP), 27);

                            pianificazione = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerifiche), int.Parse(IDCliente), int.Parse(ALitemXTPP), 27);
                        }
                        foreach (DataRow itemXPP in pianificazione.Rows)
                        {
                            if (itemXPP["NODE_ID"].ToString() != item.Attributes["ID"].Value)
                            {
                                continue;
                            }
                            foreach (DataRow dd in pianificazioneTestata.Rows)
                            {
                                if (dd["ID"].ToString() == itemXPP["PianificazioneID"].ToString())
                                {
                                    datac = dd["Data"].ToString();
                                }
                            }
                            if (datac != Data)
                            {
                                continue;
                            }
                            if (itemXPP["Checked"].ToString() == "True")
                            {
                                item.Attributes["Pianificato"].Value = "P";
                                item.Attributes["Checked"].Value     = "True";
                                StaticUtilities.MarkNodeAsModified(item, App.OBJ_MOD); _isModified = true;
                                pianificatehere.Add(item.Attributes["ID"].Value);
                                break;
                            }
                        }
                        if (donehere)
                        {
                            break;
                        }
                    }
                }
                _xTXP.Save();

                foreach (XmlNode item in TreeXmlProvider.Document.SelectNodes("//Node"))
                {
                    if (item.Attributes["NotaTDL"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("NotaTDL");
                        item.Attributes.Append(attr);
                        item.Attributes["NotaTDL"].Value = "";
                    }
                    if (item.Attributes["Checked"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("Checked");
                        item.Attributes.Append(attr);
                        item.Attributes["Checked"].Value = "False";
                    }
                    if (item.Attributes["Pianificato"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("Pianificato");
                        item.Attributes.Append(attr);
                        item.Attributes["Pianificato"].Value = "";
                    }
                    if (pianificatehere.Contains(item.Attributes["ID"].Value))
                    {
                        item.Attributes["Pianificato"].Value = "P";
                    }
                    if (item.Attributes["WidthNota"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("WidthNota");
                        item.Attributes.Append(attr);
                    }
                    if (item.SelectNodes("Node").Count > 0)
                    {
                        item.Attributes["WidthNota"].Value = "0";
                    }
                    else
                    {
                        item.Attributes["WidthNota"].Value = "Auto";
                    }
                    if (item.Attributes["Pianificato"].Value == "P")
                    {
                        item.Attributes["Checked"].Value = "True";
                        //item.Attributes["NotaTDL"].Value = "";
                    }
                    StaticUtilities.MarkNodeAsModified(item, App.OBJ_MOD); _isModified = true;
                }
            }
            Utilities u = new Utilities();

            labelAttivita.Content = u.TitoloAttivita(_TipoAttivita);
            TreeXmlProvider.Refresh();
            LoadDataSource();
        }
Exemple #10
0
        private void buttonStampa_Click(object sender, RoutedEventArgs e)
        {
            //controllo selezione clienti
            if (cmbClienti.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un cliente");
                return;
            }

            if (cmbData.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un esercizio");
                return;
            }

            MasterFile mf = MasterFile.Create();

            string IDCliente = htClienti[cmbClienti.SelectedIndex].ToString();

            string anno = cmbData.SelectedValue.ToString().Split(' ')[0];

            Hashtable cliente = mf.GetAnagrafica(Convert.ToInt32(IDCliente));

            ArrayList NodiDaCompletare = new ArrayList();

            foreach (Hashtable item in mf.GetIncarichi(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetISQCs(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetRevisioni(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString() && nodo.Attributes["ID"].Value != "22")
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetBilanci(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetConclusioni(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            if (NodiDaCompletare.Count > 0)
            {
                string daCompletare = "Attenzione, per questo esercizio risultano 'DA COMPLETARE' le seguenti voci: ";
                foreach (string ndc in NodiDaCompletare)
                {
                    daCompletare += ndc + ", ";
                }

                MessageBox.Show(daCompletare);
                return;
            }
            else
            {
                string sigillo = "";

                GestioneLicenza gl           = new GestioneLicenza();
                string          intestatario = gl.Utente;// UtenteSigillo;
                foreach (Hashtable item in mf.GetIncarichi(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetISQCs(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetBilanci(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                if ((cliente["Presidente"] == null || cliente["Presidente"].ToString() != intestatario) &&
                    (cliente["MembroEffettivo"] == null || cliente["MembroEffettivo"].ToString() != intestatario) &&
                    (cliente["MembroEffettivo2"] == null || cliente["MembroEffettivo2"].ToString() != intestatario) &&
                    (cliente["RevisoreAutonomo"] == null || cliente["RevisoreAutonomo"].ToString() != intestatario))
                {
                    MessageBox.Show("ATTENZIONE: l'intestatario di questa licenza non risulta uno dei revisori abilitati per questo cliente");
                    return;
                }

                wSigilloPassword SP = new wSigilloPassword();
                SP.ShowDialog();
                SP.Activate();

                if (!SP.PasswordOK)
                {
                    return;
                }

                string password = SP.Password;

                foreach (Hashtable item in mf.GetIncarichi(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        mf.SetSigilloIncarico(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetISQCs(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        mf.SetSigilloISQC(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        mf.SetSigilloRevisione(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetBilanci(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        mf.SetSigilloBilancio(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        mf.SetSigilloConclusione(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                MessageBox.Show("Sigillo applicato con successo");
                base.Close();
            }
        }
Exemple #11
0
        private void functionCmbClientiChanged(ComboBox cmb)
        {
            cmbData.SelectedIndex = -1;

            if (cmb.SelectedIndex != -1)
            {
                try
                {
                    string IDCliente = htClienti[cmb.SelectedIndex].ToString();

                    OldSelectedCmbClienti = Convert.ToInt32(IDCliente);

                    MasterFile mf = MasterFile.Create();

                    int index = 0;
                    htDate.Clear();
                    cmbData.Items.Clear();

                    List <KeyValuePair <string, string> > myList = new List <KeyValuePair <string, string> >();

                    ArrayList alreadydone = new ArrayList();

                    foreach (Hashtable item in mf.GetIncarichi(IDCliente))
                    {
                        myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["DataNomina"].ToString())));
                        alreadydone.Add(ConvertDataToEsercizio(item["DataNomina"].ToString()));
                    }

                    foreach (Hashtable item in mf.GetISQCs(IDCliente))
                    {
                        myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["DataNomina"].ToString())));
                        alreadydone.Add(ConvertDataToEsercizio(item["DataNomina"].ToString()));
                    }

                    foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                    {
                        if (!alreadydone.Contains(ConvertDataToEsercizio(item["Data"].ToString())))
                        {
                            myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
                        }
                        alreadydone.Add(ConvertDataToEsercizio(item["Data"].ToString()));
                    }

                    foreach (Hashtable item in mf.GetBilanci(IDCliente))
                    {
                        if (!alreadydone.Contains(ConvertDataToEsercizio(item["Data"].ToString())))
                        {
                            myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
                        }
                        alreadydone.Add(ConvertDataToEsercizio(item["Data"].ToString()));
                    }

                    foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                    {
                        if (!alreadydone.Contains(ConvertDataToEsercizio(item["Data"].ToString())))
                        {
                            myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
                        }
                    }

                    myList.Sort
                    (
                        delegate(KeyValuePair <string, string> firstPair, KeyValuePair <string, string> nextPair)
                    {
                        try
                        {
                            return(nextPair.Value.ToString().CompareTo(firstPair.Value.ToString()));
                        }
                        catch (Exception ex)
                        {
                            cBusinessObjects.logger.Error(ex, "wSigillo.functionCmbClientiChanged1 exception");
                            string log = ex.Message;
                            return(1);
                        }
                    }
                    );

                    foreach (KeyValuePair <string, string> item in myList)
                    {
                        cmbData.Items.Add(item.Value);
                        htDate.Add(index, item.Key);
                        index++;
                    }
                }
                catch (Exception ex)
                {
                    cBusinessObjects.logger.Error(ex, "wSigillo.functionCmbClientiChanged2 exception");
                    string log = ex.Message;
                    cmbData.IsEnabled = false;
                }
            }
        }