Esempio n. 1
0
        /// <summary>
        /// Reperimento delle opzioni tipizzate per una regola dell'avvocatura
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        /// <remarks>
        /// La sovrascrittura è un'estensione del reperimento delle opzioni per la singola
        /// regola. Necessaria per alcuni eventi in cui, staticamente, non è possibile
        /// determinare la decorrenza dei giorni / mesi per il calcolo della scadenza,
        /// ma tale decorrenza può essere stabilita solamente tramite la
        /// scelta dell'utente su altri campi dipendenti
        /// </remarks>
        protected override AvvocaturaBaseRuleOptions GetAvvocaturaOptions(BaseRuleInfo rule)
        {
            AvvocaturaBaseRuleOptions opts = base.GetAvvocaturaOptions(rule);

            string name = string.Empty;

            // Reperimento del nome della regola / sottoregola
            if (rule.GetType() == typeof(SubRuleInfo))
            {
                name = ((SubRuleInfo)rule).SubRuleName;
            }
            else
            {
                name = rule.RuleName;
            }

            if (this.AreEquals(name, SUBRULE_NAME_SCADENZA_PRESENTAZIONE_APPELLO))
            {
                // Regola "Scadenza presentazione appello":
                // La decorrenza dei termini è stabilita, a partire dal valore del campo
                // "Data pubblicazione sentenza", in base alla scelta del campo radio button "Termine per l'appello"

                Property pTerminePerAppello = this.FindProperty(FIELD_TERMINE_APPELLO);

                if (pTerminePerAppello != null && pTerminePerAppello.Value != null)
                {
                    const string VALUE_6_MESI  = "6 mesi";
                    const string VALUE_12_MESI = "12 mesi";

                    if (this.AreEquals(pTerminePerAppello.Value.ToString(), VALUE_6_MESI.ToString()))
                    {
                        opts.Decorrenza     = 6;
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                    }
                    else if (this.AreEquals(pTerminePerAppello.Value.ToString(), VALUE_12_MESI.ToString()))
                    {
                        opts.Decorrenza     = 12;
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                    }
                    else
                    {
                        // Valore non valido per il campo
                        throw new Subscriber.SubscriberException(ErrorCodes.INVALID_FIELD_VALUE, string.Format(ErrorDescriptions.INVALID_FIELD_VALUE, FIELD_TERMINE_APPELLO));
                    }
                }
                else
                {
                    // Campo non presente nel profilo
                    throw new Subscriber.SubscriberException(ErrorCodes.MISSING_FIELD_VALUE, string.Format(ErrorDescriptions.MISSING_FIELD_VALUE, FIELD_TERMINE_APPELLO));
                }
            }
            else if (name == SUBRULE_NAME_REMINDER_SCADENZA_PRESENTAZIONE_APPELLO)
            {
                // Regola "Reminder scadenza presentazione appello"

                Property pTerminePerAppello = this.FindProperty(FIELD_TERMINE_APPELLO);

                if (pTerminePerAppello != null && pTerminePerAppello.Value != null)
                {
                    const string VALUE_6_MESI  = "6 mesi";
                    const string VALUE_12_MESI = "12 mesi";

                    if (this.AreEquals(pTerminePerAppello.Value.ToString(), VALUE_6_MESI.ToString()))
                    {
                        opts.Decorrenza     = 5; // Appuntamento 30 gg prima
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                    }
                    else if (this.AreEquals(pTerminePerAppello.Value.ToString(), VALUE_12_MESI.ToString()))
                    {
                        opts.Decorrenza     = 11; // Appuntamento 30 gg prima
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                    }
                    else
                    {
                        // Valore non valido per il campo
                        throw new Subscriber.SubscriberException(ErrorCodes.INVALID_FIELD_VALUE, string.Format(ErrorDescriptions.INVALID_FIELD_VALUE, FIELD_TERMINE_APPELLO));
                    }
                }
                else
                {
                    // Campo non presente nel profilo
                    throw new Subscriber.SubscriberException(ErrorCodes.MISSING_FIELD_VALUE, string.Format(ErrorDescriptions.MISSING_FIELD_VALUE, FIELD_TERMINE_APPELLO));
                }
            }
            else if (name == SUBRULE_NAME_SCADENZA_PRESENTAZIONE_APPELLO_CON_DECADIMENTO)
            {
                // Regola "Scadenza presentazione appello (con decadimento termine lungo precedente)":
                // La decorrenza dei termini è stabilita, a partire dal valore del campo
                // "Data notifica sentenza", in base alla scelta del campo radio button "Termine per l'impugnazione"

                Property pTerminePerImpugnazione = this.FindProperty(FIELD_TERMINE_IMPUGNAZIONE);

                if (pTerminePerImpugnazione != null && pTerminePerImpugnazione.Value != null)
                {
                    const string VALUE_APPELLO    = "Appello";
                    const string VALUE_CASSAZIONE = "Cassazione";

                    if (this.AreEquals(pTerminePerImpugnazione.Value.ToString(), VALUE_APPELLO.ToString()))
                    {
                        opts.Decorrenza     = 30;
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Giorni;
                    }
                    else if (this.AreEquals(pTerminePerImpugnazione.Value.ToString(), VALUE_CASSAZIONE.ToString()))
                    {
                        opts.Decorrenza     = 60;
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Giorni;
                    }
                    else
                    {
                        // Valore non valido per il campo
                        throw new Subscriber.SubscriberException(ErrorCodes.INVALID_FIELD_VALUE, string.Format(ErrorDescriptions.INVALID_FIELD_VALUE, pTerminePerImpugnazione.Value.ToString(), FIELD_TERMINE_IMPUGNAZIONE));
                    }
                }
                else
                {
                    // Campo non presente nel profilo
                    throw new Subscriber.SubscriberException(ErrorCodes.MISSING_FIELD_VALUE, string.Format(ErrorDescriptions.MISSING_FIELD_VALUE, FIELD_TERMINE_IMPUGNAZIONE));
                }
            }
            else if (name == SUBRULE_NAME_REMINDER_SCADENZA_PRESENTAZIONE_APPELLO_CON_DECADIMENTO)
            {
                // Regola "Reminder scadenza presentazione appello (con decadimento termine lungo precedente)"

                Property pTerminePerImpugnazione = this.FindProperty(FIELD_TERMINE_IMPUGNAZIONE);

                if (pTerminePerImpugnazione != null && pTerminePerImpugnazione.Value != null)
                {
                    const string VALUE_APPELLO    = "Appello";
                    const string VALUE_CASSAZIONE = "Cassazione";

                    if (this.AreEquals(pTerminePerImpugnazione.Value.ToString(), VALUE_APPELLO.ToString()))
                    {
                        opts.Decorrenza     = 20; // Appuntamento 10gg prima
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Giorni;
                    }
                    else if (this.AreEquals(pTerminePerImpugnazione.Value.ToString(), VALUE_CASSAZIONE.ToString()))
                    {
                        opts.Decorrenza     = 50; // Appuntamento 10gg prima
                        opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Giorni;
                    }
                    else
                    {
                        // Valore non valido per il campo
                        throw new Subscriber.SubscriberException(ErrorCodes.INVALID_FIELD_VALUE, string.Format(ErrorDescriptions.INVALID_FIELD_VALUE, pTerminePerImpugnazione.Value.ToString(), FIELD_TERMINE_IMPUGNAZIONE));
                    }
                }
                else
                {
                    // Campo non presente nel profilo
                    throw new Subscriber.SubscriberException(ErrorCodes.MISSING_FIELD_VALUE, string.Format(ErrorDescriptions.MISSING_FIELD_VALUE, FIELD_TERMINE_IMPUGNAZIONE));
                }
            }

            return(opts);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        protected override AvvocaturaBaseRuleOptions GetAvvocaturaOptions(BaseRuleInfo rule)
        {
            AvvocaturaBaseRuleOptions opts = base.GetAvvocaturaOptions(rule);

            string name = string.Empty;

            // Reperimento del nome della regola / sottoregola
            if (rule.GetType() == typeof(SubRuleInfo))
            {
                name = ((SubRuleInfo)rule).SubRuleName;
            }
            else
            {
                name = rule.RuleName;
            }

            if (this.AreEquals(name, SubRulesPubblicazioneSentenza.SCADENZA_NOTIFICA_APPELLO) ||
                this.AreEquals(name, SubRulesPubblicazioneSentenza.REMINDER_SCADENZA_NOTIFICA_APPELLO))
            {
                bool reminder = this.AreEquals(name, SubRulesPubblicazioneSentenza.REMINDER_SCADENZA_NOTIFICA_APPELLO);

                // Regola "Scadenza notifica appello":
                // La decorrenza dei termini è stabilita in base alla scelta del campo radio button "Termine per l'appello"

                Property pTerminePerAppello = this.FindProperty(Fields.TERMINE_PER_APPELLO);

                if (pTerminePerAppello != null && pTerminePerAppello.Value != null)
                {
                    const string VALUE_6_MESI  = "6 mesi";
                    const string VALUE_12_MESI = "12 mesi";

                    if (this.AreEquals(pTerminePerAppello.Value.ToString(), VALUE_6_MESI.ToString()))
                    {
                        if (reminder)
                        {
                            // Il promemoria scatta 30gg prima
                            opts.Decorrenza     = 5;
                            opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                        }
                        else
                        {
                            opts.Decorrenza     = 6;
                            opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                        }
                    }
                    else if (this.AreEquals(pTerminePerAppello.Value.ToString(), VALUE_12_MESI.ToString()))
                    {
                        if (reminder)
                        {
                            // Il promemoria scatta 30gg prima
                            opts.Decorrenza     = 11;
                            opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                        }
                        else
                        {
                            opts.Decorrenza     = 12;
                            opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Mesi;
                        }
                    }
                    else
                    {
                        // Valore non valido per il campo
                        throw new Subscriber.SubscriberException(ErrorCodes.INVALID_FIELD_VALUE, string.Format(ErrorDescriptions.INVALID_FIELD_VALUE, Fields.TERMINE_PER_APPELLO));
                    }
                }
                else
                {
                    // Campo non presente nel profilo
                    throw new Subscriber.SubscriberException(ErrorCodes.MISSING_FIELD_VALUE, string.Format(ErrorDescriptions.MISSING_FIELD_VALUE, Fields.TERMINE_PER_APPELLO));
                }
            }

            return(opts);
        }