Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        protected virtual Subscriber.Proxy.Property MapProperty(DocsPaVO.ProfilazioneDinamica.OggettoCustom field)
        {
            Subscriber.Proxy.Property p = null;

            if (field.TIPO.DESCRIZIONE_TIPO.ToUpperInvariant() == "CORRISPONDENTE")
            {
                // Id del corrispondente come campo nascosto
                p = new Subscriber.Proxy.Property
                {
                    Name = string.Format("ID:{0}", field.DESCRIZIONE),
                    Type = this.GetType(field),
                    IsTemplateProperty = true,
                    Hidden             = true,
                    Value = field.VALORE_DATABASE
                };

                // Reperimento dei metadati del corrispondente
                DocsPaVO.utente.Corrispondente corrispondente = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemID(field.VALORE_DATABASE);

                if (corrispondente != null)
                {
                    // Descrizione del corrispondente
                    p = new Subscriber.Proxy.Property
                    {
                        Name = field.DESCRIZIONE,
                        Type = this.GetType(field),
                        IsTemplateProperty = true,
                        Value = string.Format("{0} - {1}", corrispondente.codiceRubrica, corrispondente.descrizione)
                    };

                    // Mail del corrispondente
                    p = new Subscriber.Proxy.Property
                    {
                        Name = string.Format("MAIL:{0}", field.DESCRIZIONE),
                        Type = this.GetType(field),
                        IsTemplateProperty = true,
                        Hidden             = true,
                        //Value = "*****@*****.**"
                        Value = corrispondente.email
                    };
                }
            }
            else
            {
                p = new Subscriber.Proxy.Property
                {
                    Name = field.DESCRIZIONE,
                    Type = this.GetType(field),
                    IsTemplateProperty = true,
                    Value = field.VALORE_DATABASE
                };
            }

            return(p);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="field"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        protected virtual void AddProperty(DocsPaVO.ProfilazioneDinamica.OggettoCustom field, List <Subscriber.Proxy.Property> properties)
        {
            if (field.TIPO.DESCRIZIONE_TIPO.ToUpperInvariant() == "CORRISPONDENTE")
            {
                // Id del corrispondente come campo nascosto
                properties.Add(new Subscriber.Proxy.Property
                {
                    Name = string.Format("ID:{0}", field.DESCRIZIONE),
                    Type = this.GetType(field),
                    IsTemplateProperty = true,
                    Hidden             = true,
                    Value = field.VALORE_DATABASE
                });

                // Reperimento dei metadati del corrispondente
                DocsPaVO.utente.Corrispondente corrispondente = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemID(field.VALORE_DATABASE);

                if (corrispondente != null)
                {
                    // Descrizione del corrispondente
                    properties.Add(new Subscriber.Proxy.Property
                    {
                        Name = field.DESCRIZIONE,
                        Type = this.GetType(field),
                        IsTemplateProperty = true,
                        Value = string.Format("{0} - {1}", corrispondente.codiceRubrica, corrispondente.descrizione)
                    });

                    // Mail del corrispondente
                    properties.Add(new Subscriber.Proxy.Property
                    {
                        Name = string.Format("MAIL:{0}", field.DESCRIZIONE),
                        Type = this.GetType(field),
                        IsTemplateProperty = true,
                        Hidden             = true,
                        Value = corrispondente.email
                    });
                }
            }
            else
            {
                string value = string.Empty;

                Subscriber.Proxy.Property p = new Subscriber.Proxy.Property
                {
                    Name = field.DESCRIZIONE,
                    Type = this.GetType(field),
                    IsTemplateProperty = true
                };

                if (field.TIPO.DESCRIZIONE_TIPO == "CasellaDiSelezione")
                {
                    if (field.VALORI_SELEZIONATI != null && field.VALORI_SELEZIONATI.Count > 0)
                    {
                        foreach (string val in field.VALORI_SELEZIONATI)
                        {
                            if (!string.IsNullOrEmpty(value))
                            {
                                value += "|";
                            }

                            value += val;
                        }
                    }
                }
                else if (field.TIPO.DESCRIZIONE_TIPO == "Contatore")
                {
                    value = field.FORMATO_CONTATORE;

                    if (!string.IsNullOrEmpty(field.VALORE_DATABASE))
                    {
                        value = value.Replace("ANNO", field.ANNO);
                        value = value.Replace("CONTATORE", field.VALORE_DATABASE);

                        value = value.Replace("COD_AMM", BusinessLogic.Amministrazione.AmministraManager.AmmGetInfoAmmCorrente(this._infoUtente.idAmministrazione).Codice);
                        value = value.Replace("COD_UO", field.CODICE_DB);

                        if (!string.IsNullOrEmpty(field.DATA_INSERIMENTO))
                        {
                            int fine = field.DATA_INSERIMENTO.LastIndexOf(".");

                            if (fine > -1)
                            {
                                value = value.Replace("gg/mm/aaaa hh:mm", field.DATA_INSERIMENTO.Substring(0, fine));
                            }

                            value = value.Replace("gg/mm/aaaa", field.DATA_INSERIMENTO.Substring(0, 10));
                        }

                        if (!string.IsNullOrEmpty(field.ID_AOO_RF) && field.ID_AOO_RF != "0")
                        {
                            DocsPaVO.utente.Registro registro = BusinessLogic.Utenti.RegistriManager.getRegistro(field.ID_AOO_RF);

                            if (registro != null)
                            {
                                value = value.Replace("RF", registro.codRegistro);
                                value = value.Replace("AOO", registro.codRegistro);
                            }
                        }
                    }
                }
                else
                {
                    value = field.VALORE_DATABASE;
                }

                p.Value = value;

                properties.Add(p);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Mapping dell'oggetto
        /// </summary>
        /// <param name="logInfo">
        /// Dati del log nel sistema documentale
        /// </param>
        /// <param name="ev">
        /// Dati dell'evento generato
        /// </param>
        /// <returns>
        /// Oggetto dal pubblicare
        /// </returns>
        public virtual Subscriber.Proxy.PublishedObject Map(VtDocs.LogInfo logInfo, EventInfo ev)
        {
            try
            {
                Subscriber.Proxy.PublishedObject retValue = null;

                // Reperimento dati del documento
                DocsPaVO.documento.SchedaDocumento document = this.GetDocument(logInfo);

                if (document != null)
                {
                    // Mapping dei dati del fascicolo
                    List <Subscriber.Proxy.Property> list = new List <Subscriber.Proxy.Property>();

                    if (document.template != null)
                    {
                        foreach (DocsPaVO.ProfilazioneDinamica.OggettoCustom field in document.template.ELENCO_OGGETTI)
                        {
                            Subscriber.Proxy.Property p = this.MapProperty(field);

                            if (p != null)
                            {
                                list.Add(p);
                            }
                        }
                    }

                    // Reperimento dello stato del fascicolo
                    DocsPaVO.DiagrammaStato.Stato objectState = BusinessLogic.DiagrammiStato.DiagrammiStato.getStatoDoc(document.systemId);

                    if (objectState != null)
                    {
                        list.Add(
                            new Subscriber.Proxy.Property
                        {
                            Name   = "IDStato",
                            Type   = Subscriber.Proxy.PropertyTypesEnum.Numeric,
                            Value  = objectState.SYSTEM_ID,
                            Hidden = true
                        }
                            );

                        list.Add(
                            new Subscriber.Proxy.Property
                        {
                            Name   = "Stato",
                            Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                            Value  = objectState.DESCRIZIONE,
                            Hidden = true
                        }
                            );
                    }

                    if (ev.LoadFileIfDocumentType)
                    {
                        // Caricamento ultima versione del documento
                        DocsPaVO.documento.FileRequest fr = (DocsPaVO.documento.FileRequest)document.documenti[0];
                        if (fr.subVersion != "!")
                        {
                            DocsPaVO.documento.FileDocumento file = BusinessLogic.Documenti.FileManager.getFile(fr, Security.ImpersonateUser(logInfo));

                            if (file != null)
                            {
                                list.Add(new Subscriber.Proxy.Property
                                {
                                    Name   = "FileName",
                                    Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                                    Value  = file.name,
                                    Hidden = true
                                });

                                list.Add(new Subscriber.Proxy.Property
                                {
                                    Name        = "File",
                                    Type        = Subscriber.Proxy.PropertyTypesEnum.BinaryContent,
                                    BinaryValue = file.content,
                                    Hidden      = true
                                });

                                list.Add(new Subscriber.Proxy.Property
                                {
                                    Name   = "FilePrintThumb",
                                    Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                                    Value  = DocsPaUtils.Security.CryptographyManager.CalcolaImpronta(file.content),
                                    Hidden = true
                                });
                            }
                        }
                        //Gestione Allegati
                        if (document.allegati != null)
                        {
                            int attNumber = 0;
                            foreach (DocsPaVO.documento.Allegato allegato in document.allegati)
                            {
                                if (allegato.subVersion != "!")
                                {
                                    DocsPaVO.documento.FileDocumento file = BusinessLogic.Documenti.FileManager.getFile((DocsPaVO.documento.FileRequest)allegato, Security.ImpersonateUser(logInfo));
                                    list.Add(new Subscriber.Proxy.Property
                                    {
                                        Name   = String.Format("AttachmentName_{0}", attNumber),
                                        Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                                        Value  = file.name,
                                        Hidden = true
                                    });

                                    list.Add(new Subscriber.Proxy.Property
                                    {
                                        Name        = String.Format("Attachment_{0}", attNumber),
                                        Type        = Subscriber.Proxy.PropertyTypesEnum.BinaryContent,
                                        BinaryValue = file.content,
                                        Hidden      = true
                                    });

                                    list.Add(new Subscriber.Proxy.Property
                                    {
                                        Name   = String.Format("AttachmentPrintThumb_{0}", attNumber),
                                        Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                                        Value  = DocsPaUtils.Security.CryptographyManager.CalcolaImpronta(file.content),
                                        Hidden = true
                                    });
                                    attNumber++;
                                }
                            }
                        }
                    }

                    /* user information that generated the event */
                    list.Add(new Subscriber.Proxy.Property
                    {
                        Name   = "UserName", //UserName utente che ha generato la pubblicazione
                        Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                        Value  = logInfo.UserName,
                        Hidden = true
                    });
                    list.Add(new Subscriber.Proxy.Property
                    {
                        Name   = "CodeAdm", // codice amministrazione
                        Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                        Value  = BusinessLogic.Amministrazione.AmministraManager.AmmGetInfoAmmCorrente(logInfo.IdAdmin.ToString()).Codice,
                        Hidden = true
                    });
                    list.Add(new Subscriber.Proxy.Property
                    {
                        Name   = "RoleCode", //codice ruolo
                        Type   = Subscriber.Proxy.PropertyTypesEnum.String,
                        Value  = logInfo.RoleCode,
                        Hidden = true
                    });

                    /* end user information*/

                    string docName = string.Empty;

                    if (document.tipoProto == "G")
                    {
                        docName = string.Format("ID: {0}", document.docNumber);
                    }
                    else if (document.protocollo != null)
                    {
                        docName = string.Format("Segnatura: {0}", document.protocollo.segnatura);
                    }

                    //document.protocollo.segnatura
                    retValue = new Subscriber.Proxy.PublishedObject
                    {
                        IdObject     = document.systemId,
                        Description  = docName,
                        ObjectType   = "Documento",
                        TemplateName = document.template.DESCRIZIONE,
                        Properties   = list.ToArray()
                    };
                }

                return(retValue);
            }
            catch (Exception ex)
            {
                throw new PublisherException(ErrorCodes.UNHANDLED_ERROR, ex.Message);
            }
        }