Beispiel #1
0
        /// Verifica presenza dati obbligatori della qualifica
        private static ValidationResultInfo IsValidRequiredFieldsQualifica(
            DBActionTypeRegistroEnum actionType,
            DocsPaVO.Qualifica.Qualifica qual)
        {
            ValidationResultInfo retValue   = new ValidationResultInfo();
            BrokenRule           brokenRule = null;

            if (actionType == DBActionTypeRegistroEnum.InsertMode ||
                actionType == DBActionTypeRegistroEnum.UpdateMode)
            {
                if (qual.CODICE == null || qual.CODICE == string.Empty)
                {
                    retValue.Value         = false;
                    brokenRule             = new BrokenRule();
                    brokenRule.ID          = "CODICE_QUALIFICA";
                    brokenRule.Description = "Codice qualifica mancante";
                    retValue.BrokenRules.Add(brokenRule);
                }

                if (qual.DESCRIZIONE == null || qual.DESCRIZIONE == string.Empty)
                {
                    retValue.Value         = false;
                    brokenRule             = new BrokenRule();
                    brokenRule.ID          = "DESCRIZIONE_QUALIFICA";
                    brokenRule.Description = "Descrizione qualifica mancante";
                    retValue.BrokenRules.Add(brokenRule);
                }
            }

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

            return(retValue);
        }
Beispiel #2
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);
        }