// // Class: ValidationAttribute // Current CLR: 4.0.30319.34209 // System: Microsoft Visual Studio 10.0 // Author: dani // Created: 9/7/2015 8:32:30 AM // // Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved. using System; using System.Collections.Generic; namespace bsmd.database { #region ValidationCode public enum ValidationCode { NONE, NOT_NULL, LOCODE, LOCODE_GER, GISIS, INT_GT_ZERO, DOUBLE_GT_ZERO, FLAG_CODE, TWO_DIGIT, STRING_MAXLEN, STRING_EXACT_LEN, STRING_UNNUMBER = 23, STRING_IMOCLASS = 24, DRAUGHT_IMPLAUSIBLE = 25, TIME_IMPLAUSIBLE = 26, E121 = 121, E122 = 122, E123 = 123, E124 = 124, E125 = 125, V701 = 701, V702 = 702, V703 = 703, V704 = 704, V721 = 721, V741 = 741, V761 = 761, V762 = 762, V763 = 763, V764 = 764, V765 = 765, V766 = 766, V767 = 767, V768 = 768, V781 = 781, V782 = 782, V783 = 783, V801 = 801, V802 = 802, V803 = 803, V804 = 804, V805 = 805, V806 = 806, V807 = 807, V808 = 808, V821 = 821, } #endregion #region allg. ValidationAttribute (wird immer geprüft) [AttributeUsage(AttributeTargets.Property)] public class ValidationAttribute : Attribute { private ValidationCode validationCode; private int maxlen; public ValidationAttribute(ValidationCode code) { this.validationCode = code; } public ValidationAttribute(ValidationCode code, int maxlen) { this.maxlen = maxlen; this.validationCode = code; } public int MaxLen { get { return this.maxlen; } set { this.maxlen = value; } } public ValidationCode Code { get { return this.validationCode; } set { this.validationCode = value; } } } #endregion #region Block 1 (entweder-oder Sektion) Attribut wird nur im Fall Block 1 geprüft [AttributeUsage(AttributeTargets.Property)] public class Validation1Attribute : Attribute { private ValidationCode validationCode; public Validation1Attribute(ValidationCode code) { this.validationCode = code; } public ValidationCode Code { get { return this.validationCode; } set { this.validationCode = value; } } } #endregion #region Block 2 (entweder-oder Sektion) Attribut wird nur im Fall Block 2 geprüft [AttributeUsage(AttributeTargets.Property)] public class Validation2Attribute : Attribute { private ValidationCode validationCode; public Validation2Attribute(ValidationCode code) { this.validationCode = code; } public ValidationCode Code { get { return this.validationCode; } set { this.validationCode = value; } } } #endregion }