예제 #1
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
        }
예제 #2
0
        //------------------------------------------------------------------------+
        //                      cmbClienti_SelectionChanged                       |
        //------------------------------------------------------------------------+
        private void cmbClienti_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            FileInfo fi;
            int      counter;
            string   file, IDCliente, str, xpath;
            XmlDataProviderManager _x;

            IDCliente = htClienti[((ComboBox)sender).SelectedIndex].ToString();
            stpSessioniVerifiche.Children.Clear();
            stpSessioniVigilanze.Children.Clear();
            MasterFile mf = MasterFile.Create();

            alVerifiche = mf.GetVerifiche(IDCliente);
            alVigilanze = mf.GetVigilanze(IDCliente);

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

            // VERIFICHE
            TextBlock txtVerifiche = new TextBlock();

            txtVerifiche.HorizontalAlignment =
                System.Windows.HorizontalAlignment.Center;
            txtVerifiche.Text       = "Controllo Contabile";
            txtVerifiche.FontWeight = FontWeights.Bold;
            txtVerifiche.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioniVerifiche.Children.Add(txtVerifiche);

            CheckBox chkSessioneTuttoVerifiche = new CheckBox();

            chkSessioneTuttoVerifiche.Tag        = "-1";
            chkSessioneTuttoVerifiche.Content    = "Tutte";
            chkSessioneTuttoVerifiche.Margin     = new Thickness(0, 0, 0, 5);
            chkSessioneTuttoVerifiche.Checked   += chkSessioneTuttoVerifiche_Checked;
            chkSessioneTuttoVerifiche.Unchecked += chkSessioneTuttoVerifiche_Unchecked;
            stpSessioniVerifiche.Children.Add(chkSessioneTuttoVerifiche);

            //_x = new XmlDataProviderManager(App.AppDocumentiDataFile, true);
            foreach (Hashtable htVerifica in alVerifiche)
            {
                counter = 0;
                //xpath = "//DOCUMENTI//DOCUMENTO[@Cliente='" + IDCliente + "']";
                //xpath += "[@Tree='" + (Convert.ToInt32(App.TipoFile.Verifica)).ToString() + "']";
                //xpath += "[@Sessione='" + htVerifica["ID"].ToString() + "']";
                //foreach (XmlNode item in _x.Document.SelectNodes(xpath))
                //{
                //  file = App.AppDocumentiFolder + "\\" + item.Attributes["File"].Value;
                //  fi = new FileInfo(file);
                //  if (fi.Exists) counter++;
                //}
                str = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                    Convert.ToInt32(App.TipoFile.Verifica), htVerifica["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     = htVerifica["ID"].ToString();
                    chkSessione.Content = htVerifica["Data"].ToString()
                                          + " (" + counter.ToString() + ")";
                    stpSessioniVerifiche.Children.Add(chkSessione);
                }
            }

            // VIGILANZE
            TextBlock txtVigilanze = new TextBlock();

            txtVigilanze.HorizontalAlignment =
                System.Windows.HorizontalAlignment.Center;
            txtVigilanze.Text       = "Vigilanza";
            txtVigilanze.FontWeight = FontWeights.Bold;
            txtVigilanze.Margin     = new Thickness(0, 0, 0, 5);
            stpSessioniVigilanze.Children.Add(txtVigilanze);

            CheckBox chkSessioneTuttoVigilanze = new CheckBox();

            chkSessioneTuttoVigilanze.Tag        = "-1";
            chkSessioneTuttoVigilanze.Content    = "Tutte";
            chkSessioneTuttoVigilanze.Margin     = new Thickness(0, 0, 0, 10);
            chkSessioneTuttoVigilanze.Checked   += chkSessioneTuttoVigilanze_Checked;
            chkSessioneTuttoVigilanze.Unchecked += chkSessioneTuttoVigilanze_Unchecked;
            stpSessioniVigilanze.Children.Add(chkSessioneTuttoVigilanze);

            foreach (Hashtable htVigilanza in alVigilanze)
            {
                counter = 0;
                //xpath = "//DOCUMENTI//DOCUMENTO[@Cliente='" + IDCliente + "']";
                //xpath += "[@Tree='" + (Convert.ToInt32(App.TipoFile.Vigilanza)).ToString() + "']";
                //xpath += "[@Sessione='" + htVigilanza["ID"].ToString() + "']";
                //foreach (XmlNode item in _x.Document.SelectNodes(xpath))
                //{
                //  file = App.AppDocumentiFolder + "\\" + item.Attributes["File"].Value;
                //  fi = new FileInfo(file);
                //  if (fi.Exists) counter++;
                //}
                str = string.Format("(Tree='{0}') and (ID_SESSIONE={1})",
                                    Convert.ToInt32(App.TipoFile.Vigilanza), htVigilanza["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     = htVigilanza["ID"].ToString();
                    chkSessione.Content = htVigilanza["Data"].ToString()
                                          + " (" + counter.ToString() + ")";
                    stpSessioniVigilanze.Children.Add(chkSessione);
                }
            }
        }