Ejemplo n.º 1
0
 public static void addNoRightsCustomObject(ArrayList assDocFascRuoli, OggettoCustom oggettoCustom)
 {
     DocsPaWR.AssDocFascRuoli[] assDocFascRuoliArray = (DocsPaWR.AssDocFascRuoli[])assDocFascRuoli.ToArray(typeof(AssDocFascRuoli));
     DocsPaWR.AssDocFascRuoli   assDocFascRuolo      = assDocFascRuoliArray.Where(asRuolo => asRuolo.ID_OGGETTO_CUSTOM.Equals(oggettoCustom.SYSTEM_ID.ToString())).FirstOrDefault();
     if (assDocFascRuolo == null)
     {
         DocsPaWR.AssDocFascRuoli newAssDocFascRuoli = new AssDocFascRuoli();
         newAssDocFascRuoli.ID_OGGETTO_CUSTOM  = oggettoCustom.SYSTEM_ID.ToString();
         newAssDocFascRuoli.INS_MOD_OGG_CUSTOM = "0";
         newAssDocFascRuoli.VIS_OGG_CUSTOM     = "0";
         assDocFascRuoli.Add(newAssDocFascRuoli);
     }
 }
Ejemplo n.º 2
0
 public static void addNoRightsCustomObject(List <AssDocFascRuoli> assDocFascRuoli, OggettoCustom oggettoCustom)
 {
     try
     {
         DocsPaWR.AssDocFascRuoli assDocFascRuolo = assDocFascRuoli.Where(asRuolo => asRuolo.ID_OGGETTO_CUSTOM.Equals(oggettoCustom.SYSTEM_ID.ToString())).FirstOrDefault();
         if (assDocFascRuolo == null)
         {
             DocsPaWR.AssDocFascRuoli newAssDocFascRuoli = new AssDocFascRuoli();
             newAssDocFascRuoli.ID_OGGETTO_CUSTOM  = oggettoCustom.SYSTEM_ID.ToString();
             newAssDocFascRuoli.INS_MOD_OGG_CUSTOM = "0";
             newAssDocFascRuoli.VIS_OGG_CUSTOM     = "0";
             assDocFascRuoli.Add(newAssDocFascRuoli);
         }
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
     }
 }
Ejemplo n.º 3
0
        public bool ManageAttachXML(DocsPaVO.documento.SchedaDocumento schedaDocOriginale, DocsPaVO.documento.SchedaDocumento schedaDocCopiato, string IdRuoloMittenteFisico, DocsPaVO.utente.InfoUtente infoUtenteInterop)
        {
            //****************************************************************************************************************//
            // Modifica Evolutiva di Giordano Iacozzilli Data: 27/04/2012
            //
            // La presidenza del Consiflio dei Ministri richiede la possibilità di inviare via Interoperabilità interna,
            // al Registro dell'Ufficio UBRRAC un file Xml contenente un insieme di dati integrativi associati ad alcune tipologie
            // di documenti prodotti dai centri di spesa per una successiva elaboraizone dal sistema OpenDGov.
            //
            //Workflow:
            // 1) Controllo presenza su db del codice FE_ATTACH_XML nella Config Globali
            // 2) Se il controllo è ok, verifico che il tipo doc sia compreso nella lista dei tipi ammessi(GET DEI TIPI DOC COL PIPE DAL DB).
            // 3) Verifico che il mio Ruolo abbia la visibilità su tutti i campi, altrimenti nada.
            // 4) Creo L'xml e lo allego alla scheda Doc
            //
            //****************************************************************************************************************//

            //Doppio controllo, interop Semplificata e Xml Attach.
            if (System.Configuration.ConfigurationManager.AppSettings["INTEROP_INT_NO_MAIL"] != null &&
                System.Configuration.ConfigurationManager.AppSettings["INTEROP_INT_NO_MAIL"].ToString() != "0")
            {
                //1) Controllo presenza su db del codice FE_ATTACH_XML nella Config Globali
                if (GET_XML_ATTACH())
                {
                    //Get Template.
                    DocsPaVO.ProfilazioneDinamica.Templates template = (schedaDocOriginale.template);
                    string err = string.Empty;
                    //verifico che il tipo doc sia compreso nella lista dei tipi ammessi
                    if (template != null && GET_TIPI_ATTI_CUSTOM().Contains(ClearString(GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione))))
                    {
                        DocsPaVO.ProfilazioneDinamica.AssDocFascRuoli _ass = new AssDocFascRuoli();
                        //Verifico che il mio Ruolo abbia la visibilità su tutti i campi, altrimenti nada.
                        int _totCampi  = template.ELENCO_OGGETTI.Count;
                        int _ContCampi = 0;

                        for (int i = 0; i < template.ELENCO_OGGETTI.Count; i++)
                        {
                            OggettoCustom oggettoCustom = (OggettoCustom)template.ELENCO_OGGETTI[i];
                            // visibilità.
                            _ass = ProfilazioneDinamica.ProfilazioneDocumenti.getDirittiCampoTipologiaDoc(IdRuoloMittenteFisico, template.SYSTEM_ID.ToString(), oggettoCustom.SYSTEM_ID.ToString());
                            if (_ass.VIS_OGG_CUSTOM == "1")
                            {
                                _ContCampi = _ContCampi + 1;
                            }
                        }

                        //Verifico che il mio Ruolo abbia la visibilità su tutti i campi
                        if (_ContCampi == _totCampi)
                        {
                            if (schedaDocCopiato.documenti != null && schedaDocCopiato.documenti[0] != null)
                            {
                                try
                                {
                                    Dictionary <string, string> _dict = new Dictionary <string, string>();
                                    foreach (OggettoCustom oggettoCustom in template.ELENCO_OGGETTI)
                                    {
                                        _dict.Add(oggettoCustom.DESCRIZIONE, oggettoCustom.VALORE_DATABASE);
                                    }
                                    //Creo L'xml e lo allego alla scheda Doc
                                    XmlDocument xDocDaAllegare = new XmlDocument();
                                    xDocDaAllegare = CreateXmlToAttach(_dict, schedaDocCopiato, GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione));

                                    DocsPaVO.documento.Allegato allegato = null;

                                    //Add Allegato:
                                    allegato              = new DocsPaVO.documento.Allegato();
                                    allegato.descrizione  = GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione) + "_XML";
                                    allegato.numeroPagine = 1;
                                    allegato.docNumber    = schedaDocCopiato.docNumber;
                                    allegato.version      = "0";
                                    allegato.position     = (schedaDocOriginale.allegati.Count + 1);

                                    allegato = BusinessLogic.Documenti.AllegatiManager.aggiungiAllegato(infoUtenteInterop, allegato);

                                    //Add del File xml come filedocumento:
                                    DocsPaVO.documento.FileDocumento fdAllNew = new DocsPaVO.documento.FileDocumento();
                                    fdAllNew.content     = Encoding.UTF8.GetBytes(xDocDaAllegare.OuterXml);
                                    fdAllNew.length      = Encoding.UTF8.GetBytes(xDocDaAllegare.OuterXml).Length;
                                    fdAllNew.name        = GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione) + "_XML" + ".xml";
                                    fdAllNew.fullName    = fdAllNew.name;
                                    fdAllNew.contentType = "text/xml";
                                    DocsPaVO.documento.FileRequest fr = (DocsPaVO.documento.FileRequest)allegato;
                                    if (!BusinessLogic.Documenti.FileManager.putFile(ref fr, fdAllNew, infoUtenteInterop, out err))
                                    {
                                        throw new Exception(err);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    err = ex.Message;
                                    throw ex;
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        protected void addTemplateFields(string system_id)
        {
            // Dettagli del template da aggiungere
            Templates template;

            // Lista dei diritti del ruolo suoi campi
            AssDocFascRuoli[] right;

            // Lista dei campi presenti nella griglia
            List <Field> fields;


            // Creazione della lista dei campi presenti nella griglia
            fields = new List <Field>(this.TemporaryGrid.Fields);

            // Caricamento del template
            if (this.TemporaryGrid.GridType == GridTypeEnumeration.Project)
            {
                template = ProfilazioneFascManager.getTemplateFascById(system_id, this);
                right    = (AssDocFascRuoli[])ProfilazioneFascManager.getDirittiCampiTipologiaFasc(UserManager.getRuolo().idGruppo, system_id, this).ToArray(typeof(AssDocFascRuoli));
            }
            else
            {
                template = ProfilazioneDocManager.getTemplateById(system_id, this);
                right    = (AssDocFascRuoli[])ProfilazioneDocManager.getDirittiCampiTipologiaDoc(UserManager.getRuolo().idGruppo, system_id, this).ToArray(typeof(AssDocFascRuoli));
            }

            // Ricalcolo degli indici posizionali dei campi
            int nextPosition = 0;

            for (nextPosition = 0; nextPosition < fields.Count; nextPosition++)
            {
                fields[nextPosition].Position = nextPosition;
            }

            foreach (OggettoCustom obj in template.ELENCO_OGGETTI)
            {
                AssDocFascRuoli ro     = right.Where(o => o.ID_OGGETTO_CUSTOM == obj.SYSTEM_ID.ToString() && o.VIS_OGG_CUSTOM == "1").FirstOrDefault();
                bool            number = false;
                // Se la griglia non contiene già un campo con system id pari a quello
                // che si sta tentando di inserire, viene inserito
                if (fields.Where(f => f.CustomObjectId == obj.SYSTEM_ID).Count() == 0 && ro != null)
                {
                    if (obj.TIPO.DESCRIZIONE_TIPO.ToUpper() == "CONTATORE")
                    {
                        number = true;
                    }
                    fields.Add(new Field()
                    {
                        FieldId                = String.Format("T{0}", obj.SYSTEM_ID),
                        Label                  = obj.DESCRIZIONE,
                        OriginalLabel          = obj.DESCRIZIONE,
                        Visible                = false,
                        CanAssumeMultiValues   = obj.TIPO.DESCRIZIONE_TIPO.ToUpper().Equals("CASELLADISELEZIONE"),
                        IsTruncable            = true,
                        CustomObjectId         = obj.SYSTEM_ID,
                        AssociatedTemplateName = template.DESCRIZIONE,
                        AssociatedTemplateId   = template.SYSTEM_ID.ToString(),
                        //MaxLength = 100,
                        // Default a 100
                        MaxLength             = -1,
                        Width                 = 100,
                        Position              = nextPosition++,
                        OracleDbColumnName    = obj.SYSTEM_ID.ToString(),
                        SqlServerDbColumnName = obj.SYSTEM_ID.ToString(),
                        IsCommonField         = !String.IsNullOrEmpty(obj.CAMPO_COMUNE) && obj.CAMPO_COMUNE == "1",
                        IsNumber              = number
                    });
                }
            }

            // Impostazione della nuova lista dei campi per la griglia attuale
            this.TemporaryGrid.Fields = fields.ToArray();
            List <String> idTemplates = new List <String>();

            if (this.TemporaryGrid.TemplatesId != null)
            {
                idTemplates.AddRange(this.TemporaryGrid.TemplatesId);
            }
            idTemplates.Add(template.SYSTEM_ID.ToString());
            this.TemporaryGrid.TemplatesId = idTemplates.ToArray();

            this.box_fields.Update();
        }
Ejemplo n.º 5
0
        public static List <String> CompileProfilationField(OggettoCustom customObject, AssDocFascRuoli rights, String[] fieldValues, Ruolo role, InfoUtente userInfo, string RFCode, string administrationId, string registryCode, bool isEnabledSmistamento)
        {
            #region Dichiarazione variabili

            // Il registro
            Registro registry;

            // Il system id dell'RF
            string rfSyd = String.Empty;

            // Il system id del registro
            string registrySyd = String.Empty;

            // Tipologia di utente da ricercare
            TipoUtente userType;

            // La lista dei problemi emersi durante la compilazione del campo
            List <String> toReturn;

            // Oggetto in cui depositare le informazioni sul campo da selezionare
            ValoreOggetto objectValue;

            #endregion

            // Creazione della lista da restituire
            toReturn = new List <string>();

            // ...a seconda del tipo di oggetto bisogna intraprendere
            // operazioni diverse per quanto riguarda l'assegnazione dei valori
            switch (customObject.TIPO.DESCRIZIONE_TIPO.ToUpper())
            {
            case "CASELLADISELEZIONE":
                // Nel caso della casella di selezione è possibile che sia selezionato
                // più di un valore
                // Se il ruolo può modificare il campo...
                if (rights.INS_MOD_OGG_CUSTOM == "1")
                {
                    // ...vengono impostati i valori
                    // Per ogni stringa contenuta all'interno dei valori selezionati,
                    // bisogna ricercare l'oggetto con le informazioni sull'opzione da selezionare
                    // ricavandone la posizione ed inserendo tale descrizione nella stessa posizione
                    // ma nell'array VALORI_SELEZIONATI
                    foreach (string selectedValue in fieldValues)
                    {
                        objectValue = ((ValoreOggetto[])customObject.ELENCO_VALORI.ToArray(typeof(ValoreOggetto))).Where(
                            e => e.VALORE.ToUpper().Equals(selectedValue.ToUpper())).FirstOrDefault();

                        // Se il valore non è stato reperito correttamente, viene lanciata una eccezione
                        if (objectValue == null)
                        {
                            throw new Exception(String.Format("Valore '{0}' non valido", selectedValue));
                        }

                        customObject.VALORI_SELEZIONATI[customObject.ELENCO_VALORI.IndexOf(objectValue)] = selectedValue;
                    }
                }
                else
                {
                    // ...altrimenti non si può impostare il valore. Si procede quindi
                    // all'aggiunta di un messaggio di avviso alla lista dei "warnings"
                    toReturn.Add(String.Format("Non è possible valorizzare il campo '{0}' in quanto il ruolo non possiede diritto di modifica su tale campo",
                                               customObject.DESCRIZIONE));
                }
                break;

            case "CORRISPONDENTE":
                // Se il ruolo possiede i diritti di modifica sul campo...
                if (rights.INS_MOD_OGG_CUSTOM == "1")
                {
                    Corrispondente corr = FindCorrispondente(fieldValues[0], customObject, userInfo, role, RFCode, registryCode, administrationId, isEnabledSmistamento);
                    customObject.VALORE_DATABASE = corr.systemId;
                }
                else
                {
                    // Altrimenti si aggiunge un messaggio alla lista dei warnings
                    toReturn.Add(String.Format("Non è possible valorizzare il campo '{0}' in quanto il ruolo non possiede diritto di modifica su tale campo",
                                               customObject.DESCRIZIONE));
                }
                break;

            case "CONTATORE":
            case "CONTATORESOTTOCONTATORE":
                try
                {
                    // Reperimento dei dati sul registro
                    registry = RegistriManager.getRegistroByCodAOO(
                        fieldValues[0].ToUpper(), administrationId);
                }
                catch (Exception e)
                {
                    throw new Exception(
                              String.Format("Errore durante il reperimento delle informazioni sul Registro/RF {0}",
                                            fieldValues[0]));
                }

                switch (customObject.TIPO_CONTATORE.ToUpper())
                {
                case "A":           // Contatore di AOO
                    customObject.ID_AOO_RF = registry.systemId;
                    break;

                case "R":           // Contatore di RF
                    // Se il registro non è un registro di RF, eccezione
                    if (!(registry.chaRF == "1"))
                    {
                        throw new Exception(String.Format(
                                                "Il registro {0} non è un RF",
                                                fieldValues[0]));
                    }

                    // Impostazione dell'id registro
                    customObject.ID_AOO_RF = registry.systemId;

                    break;
                }

                // Se il contatore è abilitato allo scatto differito...
                if (customObject.CONTA_DOPO == "0")
                {
                    // Se il ruolo ha diritti di modifica sul contatore...
                    if (rights.INS_MOD_OGG_CUSTOM == "1")
                    {
                        // Il contatore deve scattare
                        customObject.CONTATORE_DA_FAR_SCATTARE = true;
                    }
                }

                break;

            case "LINK":
                if (fieldValues.Length < 2)
                {
                    throw new Exception("Per costruire un oggetto link sono necessari due valori");
                }
                if ("INTERNO".Equals(customObject.TIPO_LINK))
                {
                    if ("DOCUMENTO".Equals(customObject.TIPO_OBJ_LINK))
                    {
                        InfoDocumento infoDoc = null;
                        try
                        {
                            infoDoc = DocManager.GetInfoDocumento(userInfo, fieldValues[1], null, true);
                        }
                        catch (Exception e)
                        {
                            throw new Exception(String.Format("Errore nel reperimento del documento con id {0}", fieldValues[1]));
                        }
                        if (infoDoc == null)
                        {
                            throw new Exception(String.Format("Il documento con id {0} non è presente", fieldValues[1]));
                        }
                        string errorMessage = "";
                        int    result       = DocManager.VerificaACL("D", infoDoc.idProfile, userInfo, out errorMessage);
                        if (result != 2)
                        {
                            throw new Exception(String.Format("Non si possiedono i diritti per reperire il documento con id {0}", fieldValues[1]));
                        }
                    }
                    else
                    {
                        Fascicolo fasc = null;
                        try
                        {
                            // fasc = FascicoloManager.getFascicoloById(fieldValues[1], userInfo);
                            fasc = FascicoloManager.getFascicoloDaCodice(userInfo, fieldValues[1], null, false, true);
                        }
                        catch (Exception e)
                        {
                            throw new Exception(String.Format("Errore nel reperimento del fascicolo con id {0}", fieldValues[1]));
                        }
                        if (fasc == null)
                        {
                            throw new Exception(String.Format("Il fascicolo con id {0} non è presente", fieldValues[1]));
                        }
                        string errorMessage = "";
                        int    result       = DocManager.VerificaACL("F", fasc.systemID, userInfo, out errorMessage);
                        if (result != 2)
                        {
                            throw new Exception(String.Format("Non si possiedono i diritti per reperire il fascicolo con id {0}", fieldValues[1]));
                        }
                    }
                }
                customObject.VALORE_DATABASE = fieldValues[0] + "||||" + fieldValues[1];
                break;

            case "OGGETTOESTERNO":
                if (fieldValues.Length < 2)
                {
                    throw new Exception("Per costruire un oggetto esterno sono necessari due valori");
                }
                customObject.MANUAL_INSERT   = true;
                customObject.CODICE_DB       = fieldValues[0];
                customObject.VALORE_DATABASE = fieldValues[1];
                break;

            default:
                // In tutti gli altri casi il valore è uno solo
                // Se il ruolo ha diritti di modofica, viene impostato
                // il valore altrimenti viene inserito un messaggio nella
                // lista dei warning
                if (rights.INS_MOD_OGG_CUSTOM == "1")
                {
                    customObject.VALORE_DATABASE = fieldValues[0];
                }
                else
                {
                    // ...altrimenti non si può impostare il valore. Si procede quindi
                    // all'aggiunta di un messaggio di avviso alla lista dei "warnings"
                    toReturn.Add(String.Format("Non è possible valorizzare il campo '{0}' in quanto il ruolo non possiede diritto di modifica su tale campo",
                                               customObject.DESCRIZIONE));
                }
                break;
            }

            // Restituzione della lista delle eventuali segnalazioni
            return(toReturn);
        }