public void accedi(string ID, bool ReadOnly, bool tobeclosed)
        {
            if (checkdatecorreto == false)
            {
                return;
            }

            MasterFile mf         = MasterFile.Create();
            Hashtable  htSelected = mf.GetPianificazioniVigilanza(ID);

            if (htSelected.Count == 0)
            {
                return;
            }

            try
            {
                WindowWorkAreaTree wWorkArea = new WindowWorkAreaTree();
                //Prisc
                try
                {
                    wWorkArea.Owner = this;
                }
                catch (Exception ex)
                {
                    cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVigilanza.accedi1 exception");
                }
                wWorkArea.SelectedTreeSource = App.AppDataDataFolder + "\\" + htSelected["File"].ToString();
                wWorkArea.SelectedDataSource = App.AppDataDataFolder + "\\" + htSelected["FileData"].ToString();
                wWorkArea.ReadOnly           = ReadOnly;
                wWorkArea.TipoAttivita       = App.TipoAttivita.PianificazioniVigilanza;
                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.IDTree     = (Convert.ToInt32(App.TipoFile.PianificazioniVigilanza)).ToString();
                wWorkArea.IDCliente  = htSelected["Cliente"].ToString();
                wWorkArea.IDSessione = ID;

                foreach (Hashtable item in ((ArrayList)(mf.GetPianificazioniVigilanze(htSelected["Cliente"].ToString()))))
                {
                    wWorkArea.SessioneAliasAdditivo += ((wWorkArea.SessioneAliasAdditivo == "") ? "" : "|") + item["DataFine"].ToString();
                    wWorkArea.SessioneFile          += ((wWorkArea.SessioneFile == "") ? "" : "|") + App.AppDataDataFolder + "\\" + item["FileData"].ToString();
                    wWorkArea.SessioneAlias         += ((wWorkArea.SessioneAlias == "") ? "" : "|") + item["DataInizio"].ToString();
                    wWorkArea.SessioneID            += ((wWorkArea.SessioneID == "") ? "" : "|") + item["ID"].ToString();
                }


                //aperto in sola lettura
                wWorkArea.ApertoInSolaLettura = TipologiaAttivita == App.TipoAttivitaScheda.View;

                wWorkArea.LoadTreeSource();
                Hide();
                wWorkArea.ShowDialog();

                //setto dati
                Hashtable ht = new Hashtable();
                ht.Add("Cliente", Convert.ToInt32(htSelected["Cliente"].ToString()));


                ht.Add("DataInizio", dtpDataInizio.SelectedDate.Value.ToShortDateString());
                ht.Add("DataFine", dtpDataFine.SelectedDate.Value.ToShortDateString());

                mf.SetPianificazioniVigilanza(ht, Convert.ToInt32(ID), Convert.ToInt32(htSelected["Cliente"].ToString()), false);

                if (TipologiaAttivita != App.TipoAttivitaScheda.View)
                {
                    int IDCliente = Convert.ToInt32(htClienti[cmbClienti.SelectedIndex].ToString());
                    mf.SetAnafraficaStato(Convert.ToInt32(IDCliente), App.TipoAnagraficaStato.Disponibile);
                }

                functionCmbDataChanged(cmbData);

                //if ( tobeclosed == true )
                //{
                //  Close();
                //}
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVigilanza.accedi2 exception");
            }
            Close();
        }
        //----------------------------------------------------------------------------+
        //                                   accedi                                   |
        //----------------------------------------------------------------------------+
        public void accedi(string ID, bool ReadOnly)
        {
            MasterFile mf         = MasterFile.Create();
            Hashtable  htSelected = mf.GetRelazioneBV(ID);

            if (htSelected.Count == 0)
            {
                return;
            }
            WindowWorkAreaTree wWorkArea = new WindowWorkAreaTree();

            //Prisc
            try
            {
                wWorkArea.Owner = this;
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wSchedaRelazioneBV.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;
            }
            wWorkArea.TipoAttivita            = App.TipoAttivita.RelazioneBV;
            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;
            wWorkArea.IDTree     = (Convert.ToInt32(App.TipoFile.RelazioneBV)).ToString();
            wWorkArea.IDCliente  = htSelected["Cliente"].ToString();
            wWorkArea.IDSessione = ID;
            foreach (Hashtable item in ((ArrayList)(mf.GetRelazioniBV(htSelected["Cliente"].ToString()))))
            {
                wWorkArea.SessioneFile            += ((wWorkArea.SessioneFile == "") ? "" : "|") + App.AppDataDataFolder + "\\" + item["FileData"].ToString();
                wWorkArea.SessioneAlias           += ((wWorkArea.SessioneAlias == "") ? "" : "|") + item["Data"].ToString();// ConvertDataToEsercizio(item["Data"].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();
            wWorkArea.ShowDialog();
            if (TipologiaAttivita != App.TipoAttivitaScheda.View)
            {
                int IDCliente = Convert.ToInt32(htClienti[cmbClienti.SelectedIndex].ToString());
                mf.SetAnafraficaStato(Convert.ToInt32(IDCliente), App.TipoAnagraficaStato.Disponibile);
            }
            Close();
        }
Example #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
        }