示例#1
0
 /// <summary>
 /// Reperimento del path del modello del registro
 /// </summary>
 /// <param name="registro"></param>
 /// <param name="templatePdf"></param>
 /// <returns></returns>
 public static string GetPathModelloStampaRicevuta(DocsPaVO.amministrazione.OrgRegistro registro, string modelExtension)
 {
     return(string.Concat(ModelsRootPath, string.Format(@"\Modelli\{0}\Ricevute\{1}\Ricevuta.{2}", registro.CodiceAmministrazione, registro.Codice, modelExtension)));
 }
示例#2
0
 /// <summary>
 /// Reperimento del path del modello del registro
 /// </summary>
 /// <param name="registro"></param>
 /// <returns></returns>
 public static string GetPathModelloStampaRicevuta(DocsPaVO.amministrazione.OrgRegistro registro)
 {
     return(GetPathModelloStampaRicevuta(registro, "rtf"));
 }
示例#3
0
        /// <summary>
        /// Verifica se il modello per la stampa della ricevuta esiste o meno
        /// </summary>
        /// <param name="registro"></param>
        /// <returns></returns>
        public static bool ContainsModelloStampaRicevuta(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.amministrazione.OrgRegistro registro)
        {
            string    tipo_ricevuta_proto = string.Empty;
            string    extensionFile       = string.Empty;
            ArrayList keyConfig           = DocsPaUtils.Configuration.ChiaviConfigManager.GetChiaviConfig(registro.IDAmministrazione);

            for (int i = 0; i < keyConfig.Count; i++)
            {
                if (((ChiaveConfigurazione)keyConfig[i]).Codice.Equals("FE_RICEVUTA_PROTOCOLLO_PDF"))
                {
                    tipo_ricevuta_proto = ((ChiaveConfigurazione)keyConfig[i]).Valore;
                    break;
                }
            }
            if (!String.IsNullOrEmpty(tipo_ricevuta_proto) && tipo_ricevuta_proto.Equals("1"))
            {
                extensionFile = "pdf";
            }
            else
            {
                extensionFile = "";
            }
            return(File.Exists(GetPathModelloStampaRicevuta(registro, extensionFile)));
        }
示例#4
0
        //public static bool SaveModelloStampaRicevutaPDF(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.amministrazione.OrgRegistro registro, byte[] modelContent)
        //{
        //    bool retValue = true;

        //    try
        //    {
        //        FileInfo fileInfo = new FileInfo(GetPathModelloStampaRicevutaPDF(registro));

        //        if (!fileInfo.Directory.Exists)
        //            fileInfo.Directory.Create();

        //        File.WriteAllBytes(fileInfo.FullName, modelContent);

        //        retValue = true;
        //    }
        //    catch (Exception ex)
        //    {
        //        DocsPaUtils.LogsManagement.logger.Debug(ex);
        //        retValue = false;
        //    }

        //    return retValue;
        //}

        /// <summary>
        /// Rimozione del modello utilizzato per la stampa della ricevuta
        /// </summary>
        /// <param name="infoUtente"></param>
        /// <param name="registro"></param>
        /// <returns></returns>
        public static bool DeleteModelloStampaRicevuta(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.amministrazione.OrgRegistro registro)
        {
            bool retValue = false;

            try
            {
                string path = GetPathModelloStampaRicevuta(registro);

                if (File.Exists(path))
                {
                    File.Delete(path);

                    retValue = true;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                retValue = false;
            }

            return(retValue);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="registro"></param>
        /// <param name="modelContent"></param>
        /// <returns></returns>
        public static bool SaveModelloStampaRicevuta(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.amministrazione.OrgRegistro registro, byte[] modelContent, bool modelPdf)
        {
            bool retValue = true;

            try
            {
                FileInfo fileInfo = new FileInfo(GetPathModelloStampaRicevuta(registro, (modelPdf ? "pdf" : "rtf")));

                if (!fileInfo.Directory.Exists)
                {
                    fileInfo.Directory.Create();
                }

                File.WriteAllBytes(fileInfo.FullName, modelContent);

                retValue = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                retValue = false;
            }

            return(retValue);
        }
示例#6
0
        /// <summary>
        /// Verifica presenza dati obbligatori del registro
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="nodoTitolario"></param>
        /// <param name="errorDescription"></param>
        /// <returns></returns>
        private static ValidationResultInfo IsValidRequiredFieldsRegistro(
            DBActionTypeRegistroEnum actionType,
            DocsPaVO.amministrazione.OrgRegistro registro)
        {
            ValidationResultInfo retValue   = new ValidationResultInfo();
            BrokenRule           brokenRule = null;

            if (actionType != DBActionTypeRegistroEnum.InsertMode &&
                (registro.IDRegistro == null ||
                 registro.IDRegistro == string.Empty ||
                 registro.IDRegistro == "0"))
            {
                retValue.Value = false;
                brokenRule     = new BrokenRule();
                if (registro.chaRF != null && registro.chaRF.Equals("1"))
                {
                    brokenRule.ID          = "ID_RF";
                    brokenRule.Description = "ID raggruppamento funzionale mancante";
                }
                else
                {
                    brokenRule.ID          = "ID_REGISTRO";
                    brokenRule.Description = "ID registro mancante";
                }
                retValue.BrokenRules.Add(brokenRule);
            }

            if (actionType == DBActionTypeRegistroEnum.InsertMode ||
                actionType == DBActionTypeRegistroEnum.UpdateMode)
            {
                if (registro.Codice == null || registro.Codice == string.Empty)
                {
                    retValue.Value = false;
                    brokenRule     = new BrokenRule();

                    if (registro.chaRF != null && registro.chaRF.Equals("1"))
                    {
                        brokenRule.ID          = "CODICE_RF";
                        brokenRule.Description = "Codice raggruppamento funzionale mancante";
                    }
                    else
                    {
                        brokenRule.ID          = "CODICE_REGISTRO";
                        brokenRule.Description = "Codice registro mancante";
                    }
                    retValue.BrokenRules.Add(brokenRule);
                }

                if (registro.Descrizione == null || registro.Descrizione == string.Empty)
                {
                    retValue.Value = false;
                    brokenRule     = new BrokenRule();
                    if (registro.chaRF != null && registro.chaRF.Equals("1"))
                    {
                        brokenRule.ID          = "DESCRIZIONE_RF";
                        brokenRule.Description = "Descrizione raggruppamento funzionale mancante";
                    }
                    else
                    {
                        brokenRule.ID          = "DESCRIZIONE_REGISTRO";
                        brokenRule.Description = "Descrizione registro mancante";
                    }
                    retValue.BrokenRules.Add(brokenRule);
                }

                // se è un RF vedo che sia inserita obbligatoriamente la AOO collegata
                if ((registro.chaRF != null && registro.chaRF == "1") && (registro.idAOOCollegata == null || registro.idAOOCollegata == string.Empty))
                {
                    retValue.Value = false;
                    brokenRule     = new BrokenRule();

                    brokenRule.ID          = "AOO_COLLEGATA_RF";
                    brokenRule.Description = "AOO collegata al raggruppamento funzionale mancante";

                    retValue.BrokenRules.Add(brokenRule);
                }
            }

            // Validazione indirizzo email
            if (actionType != DBActionTypeRegistroEnum.DeleteMode &&
                registro.Mail.Email != null && registro.Mail.Email != string.Empty &&
                !IsValidEmail(registro.Mail.Email))
            {
                retValue.Value = false;
                retValue.BrokenRules.Add(new BrokenRule("MAIL_REGISTRO", "Indirizzo email non valido"));
            }

            retValue.Value = (retValue.BrokenRules.Count == 0);

            return(retValue);
        }