コード例 #1
0
        private string GetFormatiDocumento(string id)
        {
            string result = string.Empty;

            DocsPaDB.Query_DocsPAWS.Conservazione c = new DocsPaDB.Query_DocsPAWS.Conservazione();
            List <DocsPaVO.FormatiDocumento.SupportedFileType> lista = new List <DocsPaVO.FormatiDocumento.SupportedFileType>();

            lista = c.GetFormatiDocumentoPolicy(id);

            if (lista != null && lista.Count > 0)
            {
                for (int i = 0; i < lista.Count; i++)
                {
                    DocsPaVO.FormatiDocumento.SupportedFileType file = lista[i];
                    result = result + file.FileExtension.ToUpper();
                    if (i < lista.Count - 1)
                    {
                        result = result + ", ";
                    }
                }
            }
            else
            {
                result = "Tutti";
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Verifica se il formato del file è ammesso per la firma digitale
        /// </summary>
        /// <param name="infoUtente"></param>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        private static bool IsFormatSupportedForSign(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.documento.FileRequest fileRequest)
        {
            bool retValue = false;

            if (!FormatiDocumento.Configurations.SupportedFileTypesEnabled)
            {
                retValue = true;
            }
            else
            {
                string extension = System.IO.Path.GetExtension(fileRequest.fileName);

                if (!string.IsNullOrEmpty(extension))
                {
                    // Rimozione del primo carattere dell'estensione (punto)
                    extension = extension.Substring(1);

                    DocsPaVO.FormatiDocumento.SupportedFileType fileType = BusinessLogic.FormatiDocumento.SupportedFormatsManager.GetFileType(Convert.ToInt32(infoUtente.idAmministrazione), extension);

                    retValue = (fileType != null && fileType.FileTypeUsed && fileType.FileTypeSignature);
                }
            }

            return(retValue);
        }