/// <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.RuleHasTerminiDimezzati(rule)) { // La regola prevede il dimezzamento dei termini if (opts.Decorrenza != 0) { // Eccezioni if (this.AreEquals(name, SubRulesPubblicazioneSentenza.REMINDER_SCADENZA_PRESENTAZIONE_APPELLO)) { // La regola "REMINDER_SCADENZA_PRESENTAZIONE_APPELLO" normalmente prevede il // termine di 5 mesi (1 mese dopo il termine presentazione appello, ovvero 6 mesi). // In caso di rito abbreviato, il termine presentazione appello sarà 3 mesi, // il reminder va calcolato a 2 mesi piuttosto che 3 (con l'arrotondamento per eccesso) opts.Decorrenza = 2; } else { if ((opts.Decorrenza % 2) != 0) { if (opts.Decorrenza < 0) { // Arrotondamento per eccesso opts.Decorrenza = (opts.Decorrenza / 2) - 1; } else if (opts.Decorrenza > 0) { // Arrotondamento per eccesso opts.Decorrenza = (opts.Decorrenza / 2) + 1; } } else { opts.Decorrenza = (opts.Decorrenza / 2); } } } } return(opts); }
/// <summary> /// /// </summary> /// <param name="rule"></param> /// <returns></returns> protected override AvvocaturaBaseRuleOptions GetAvvocaturaOptions(BaseRuleInfo rule) { string ruleName = string.Empty; if (rule.GetType() == typeof(BaseRuleInfo)) { ruleName = rule.RuleName; } else if (rule.GetType() == typeof(SubRuleInfo)) { ruleName = ((SubRuleInfo)rule).SubRuleName; } if (this.AreEquals(ruleName, SubRulesTermineAppello.SCADENZA_PRESENTAZIONE_APPELLO)) { // Per l'appuntamento "Termine presentazione appello", la decorrenza dei termini // deve essere calcolata dinamicamente. Ovvero al campo data del profilo // vanno sommati il numero di giorni scelto nel campo "Termine per l'appello" Property pTermineAppello = this.FindProperty(Fields.TERMINE_APPELLO); if (pTermineAppello != null && !pTermineAppello.IsEmpty) { const string VALUE_15GG = "15 gg"; const string VALUE_30GG = "30 gg"; const string VALUE_45GG = "45 gg"; AvvocaturaBaseRuleOptions opts = new AvvocaturaBaseRuleOptions(rule); opts.TipoDecorrenza = AvvocaturaBaseRuleOptions.TipoDecorrenzaEnum.Giorni; if (this.AreEquals(pTermineAppello.Value.ToString(), VALUE_15GG)) { // Imposta il numero di giorni di decorrenza opts.Decorrenza = 15; } else if (this.AreEquals(pTermineAppello.Value.ToString(), VALUE_30GG)) { // Imposta il numero di giorni di decorrenza opts.Decorrenza = 30; } else if (this.AreEquals(pTermineAppello.Value.ToString(), VALUE_45GG)) { // Imposta il numero di giorni di decorrenza opts.Decorrenza = 45; } else { // Valore del campo non ammesso throw new SubscriberException(ErrorCodes.INVALID_FIELD_VALUE, string.Format(ErrorDescriptions.INVALID_FIELD_VALUE, Fields.TERMINE_APPELLO)); } return(opts); } else { // Campo obbligatorio throw new SubscriberException(ErrorCodes.MISSING_FIELD_VALUE, string.Format(ErrorDescriptions.MISSING_FIELD_VALUE, Fields.TERMINE_APPELLO)); } } else { return(base.GetAvvocaturaOptions(rule)); } }
/// <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); }
/// <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); }