public static List <ModelConfiguration> GetModelConfigurationData() { List <ModelConfiguration> dataList = new List <ModelConfiguration>(); Dictionary <string, PropertyConfiguration> properties = new Dictionary <string, PropertyConfiguration>(); //Property Configuration List <ValidationBase> validators1 = new List <ValidationBase>(); validators1.Add(new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "LoginInputView_UserName_Required" } })); PropertyConfiguration usernameProperty = new PropertyConfiguration("UserName", validators1, accessPolicyCode: "UN_ACCESS_POLICY"); List <ValidationBase> validators2 = new List <ValidationBase>(); validators2.Add(new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "LoginInputView_Password_Required" } })); PropertyConfiguration passwordProperty = new PropertyConfiguration("Password", validators2, accessPolicyCode: "PWD_ACCESS_POLICY"); List <ValidationBase> validators3 = new List <ValidationBase>(); validators3.Add(new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PostalCode_Required" } })); properties.Add(usernameProperty.Key, usernameProperty); properties.Add(passwordProperty.Key, passwordProperty); //Model Property Configuration List <IModelPropertyConfiguration> mlist = new List <IModelPropertyConfiguration>(); mlist.Add(new ModelPropertyConfiguration("UserName", "UserName", "LoginInputView_UserName", properties["UserName"])); mlist.Add(new ModelPropertyConfiguration("Password", "Password", "LoginInputView_Password", properties["Password"])); ModelConfiguration mConfig = new ModelConfiguration("LoginInputView", mlist); dataList.Add(mConfig); //**************************************************** Add player Model Configuration ************************************************************************ List <IModelPropertyConfiguration> playerModelPropertyList = new List <IModelPropertyConfiguration>(); Dictionary <string, string> adb = new Dictionary <string, string>() { { "ActionName", "process" }, { "ControllerName", "ControlLibrary_PostalCode_Get" }, { "ActionURL", "ControlLibrary_PostalCode_Get/process" } }; AutoCompleteBehaviourPropertyBag abag = new AutoCompleteBehaviourPropertyBag(adb); Dictionary <string, object> bd = new Dictionary <string, object>() { { "AutoCompleteBehaviourPropertyBag", abag } }; playerModelPropertyList.Add(new ModelPropertyConfiguration("PostalCode", "HomeAddress.PostalCode", "AddPlayerModel_HomeAddress_PostalCode", new PropertyConfiguration("PostalCode", new List <ValidationBase>() { new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PostalCode_Required" } }) }, behaviourDtls: bd))); playerModelPropertyList.Add(new ModelPropertyConfiguration("AccountNumber", "AccountNumber", "AddPlayerModel_AccountNumber", new PropertyConfiguration("AccountNumber", new List <ValidationBase>() { new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_AccountNumber_Required" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("FirstName", "FirstName", "AddPlayerModel_FirstName", new PropertyConfiguration("FirstName", new List <ValidationBase>() { new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_FirstName_Required" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("LastName", "LastName", "AddPlayerModel_LastName", new PropertyConfiguration("LastName", new List <ValidationBase>() { new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_LastName_Required" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("PhoneNumber", "PhoneNumber", "AddPlayerModel_PhoneNumber", new PropertyConfiguration("PhoneNumber", new List <ValidationBase>() { new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PhoneNumber_Required" } }), new CustomValidators(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PhoneNumber_Invalid" }, { "ValidationType", "Phone" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("SSN", "SSN", "AddPlayerModel_SSN", new PropertyConfiguration("SSN", new List <ValidationBase>() { new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_SSN_Required" } }), //new SpecialCharValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_SSN_SpecialCharNotAllowed" },{"Expression",""},{"Restriction","Allow"} }) new CustomValidators(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_SSN_Invalid" }, { "ValidationType", "SSN" } }) }))); ModelConfiguration playerAddConfig = new ModelConfiguration("AddPlayerModel", playerModelPropertyList); dataList.Add(playerAddConfig); //**************************************************** END of Add player Model Configuration ************************************************************************ /*Control Library Controls Test Validators*/ List <ValidationBase> fn_ReqValidator = new List <ValidationBase>(); fn_ReqValidator.Add(new RequiredValidator(new Dictionary <string, string>() { { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_Required" } })); fn_ReqValidator.Add(new LengthValidator(new Dictionary <string, string>() { { "MinLength", "2" }, { "MaxLength", "18" }, { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_Length" } })); fn_ReqValidator.Add(new SpecialCharValidator(new Dictionary <string, string>() { { "Expression", "#$" }, { "Restriction", RestrictionType.Restrict.ToString() }, { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_SpecialChar" } })); //fn_ReqValidator.Add(new RangeValidator(new Dictionary<string, string>() { { "MinLength", "2" }, { "MaxLength", "5" }, { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_Range" } })); //PropertyConfiguration firstNameProperty = new PropertyConfiguration("FirstName", fn_ReqValidator, accessPolicyCode: "UN_ACCESS_POLICY"); //PropertyConfiguration firstNameProperty = new PropertyConfiguration("FirstName", fn_ReqValidator, accessPolicyCode: "UN_ACCESS_POLICY",); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ActionURL", @"ControlLibrary_AutoComplete_load"); AutoCompleteBehaviourPropertyBag autoCompleteBhBag = new AutoCompleteBehaviourPropertyBag(dic); Dictionary <string, object> behaviourDtls = new Dictionary <string, object>(); behaviourDtls.Add("AutoCompleteBehaviourPropertyBag", autoCompleteBhBag); /*Masking Property Configuration*/ Dictionary <string, string> Maskingdic = new Dictionary <string, string>(); Maskingdic.Add("MaskingChar", "X"); Maskingdic.Add("MaskingType", MaskingType.Partial.ToString()); Maskingdic.Add("MaskCharLength", 4.ToString()); Maskingdic.Add("MaskingPosition", MaskingPosition.Last.ToString()); MaskingBehaviourPropertyBag maskingBag = new MaskingBehaviourPropertyBag(Maskingdic); behaviourDtls.Add("MaskingBehaviourPropertyBag", maskingBag); PropertyConfiguration firstNameProperty = new PropertyConfiguration("FirstName", fn_ReqValidator, accessPolicyCode: "FN_ACCESS_POLICY", behaviourDtls: behaviourDtls); properties.Add(firstNameProperty.Key, firstNameProperty); List <IModelPropertyConfiguration> modelList = new List <IModelPropertyConfiguration>(); modelList.Add(new ModelPropertyConfiguration("FirstName", "FirstName", "AllControlModel_FirstName", properties["FirstName"])); ModelConfiguration modelConfig = new ModelConfiguration("AllControlModel", modelList); dataList.Add(modelConfig); return(dataList); }
public static List<ModelConfiguration> GetModelConfigurationData() { List<ModelConfiguration> dataList = new List<ModelConfiguration>(); Dictionary<string, PropertyConfiguration> properties = new Dictionary<string, PropertyConfiguration>(); //Property Configuration List<ValidationBase> validators1 = new List<ValidationBase>(); validators1.Add(new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "LoginInputView_UserName_Required" } })); PropertyConfiguration usernameProperty = new PropertyConfiguration("UserName", validators1, accessPolicyCode: "UN_ACCESS_POLICY"); List<ValidationBase> validators2 = new List<ValidationBase>(); validators2.Add(new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "LoginInputView_Password_Required" } })); PropertyConfiguration passwordProperty = new PropertyConfiguration("Password", validators2, accessPolicyCode: "PWD_ACCESS_POLICY"); List<ValidationBase> validators3 = new List<ValidationBase>(); validators3.Add(new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PostalCode_Required" } })); properties.Add(usernameProperty.Key, usernameProperty); properties.Add(passwordProperty.Key, passwordProperty); //Model Property Configuration List<IModelPropertyConfiguration> mlist = new List<IModelPropertyConfiguration>(); mlist.Add(new ModelPropertyConfiguration("UserName", "UserName", "LoginInputView_UserName", properties["UserName"])); mlist.Add(new ModelPropertyConfiguration("Password", "Password", "LoginInputView_Password", properties["Password"])); ModelConfiguration mConfig = new ModelConfiguration("LoginInputView", mlist); dataList.Add(mConfig); //**************************************************** Add player Model Configuration ************************************************************************ List<IModelPropertyConfiguration> playerModelPropertyList = new List<IModelPropertyConfiguration>(); Dictionary<string, string> adb = new Dictionary<string, string>() { { "ActionName", "process" }, { "ControllerName", "ControlLibrary_PostalCode_Get" }, { "ActionURL", "ControlLibrary_PostalCode_Get/process" } }; AutoCompleteBehaviourPropertyBag abag = new AutoCompleteBehaviourPropertyBag(adb); Dictionary<string, object> bd = new Dictionary<string, object>() { { "AutoCompleteBehaviourPropertyBag", abag } }; playerModelPropertyList.Add(new ModelPropertyConfiguration("PostalCode", "HomeAddress.PostalCode", "AddPlayerModel_HomeAddress_PostalCode", new PropertyConfiguration("PostalCode", new List<ValidationBase>() { new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PostalCode_Required" } }) }, behaviourDtls: bd))); playerModelPropertyList.Add(new ModelPropertyConfiguration("AccountNumber", "AccountNumber", "AddPlayerModel_AccountNumber", new PropertyConfiguration("AccountNumber", new List<ValidationBase>() { new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_AccountNumber_Required" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("FirstName", "FirstName", "AddPlayerModel_FirstName", new PropertyConfiguration("FirstName", new List<ValidationBase>() { new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_FirstName_Required" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("LastName", "LastName", "AddPlayerModel_LastName", new PropertyConfiguration("LastName", new List<ValidationBase>() { new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_LastName_Required" } }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("PhoneNumber", "PhoneNumber", "AddPlayerModel_PhoneNumber", new PropertyConfiguration("PhoneNumber", new List<ValidationBase>() { new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PhoneNumber_Required" } }), new CustomValidators(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_PhoneNumber_Invalid" },{"ValidationType","Phone"} }) }))); playerModelPropertyList.Add(new ModelPropertyConfiguration("SSN", "SSN", "AddPlayerModel_SSN", new PropertyConfiguration("SSN", new List<ValidationBase>() { new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_SSN_Required" } }), //new SpecialCharValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_SSN_SpecialCharNotAllowed" },{"Expression",""},{"Restriction","Allow"} }) new CustomValidators(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AddPlayerModel_SSN_Invalid" },{"ValidationType","SSN"} }) }))); ModelConfiguration playerAddConfig = new ModelConfiguration("AddPlayerModel", playerModelPropertyList); dataList.Add(playerAddConfig); //**************************************************** END of Add player Model Configuration ************************************************************************ /*Control Library Controls Test Validators*/ List<ValidationBase> fn_ReqValidator = new List<ValidationBase>(); fn_ReqValidator.Add(new RequiredValidator(new Dictionary<string, string>() { { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_Required" } })); fn_ReqValidator.Add(new LengthValidator(new Dictionary<string, string>() { { "MinLength", "2" }, { "MaxLength", "18" }, { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_Length" } })); fn_ReqValidator.Add(new SpecialCharValidator(new Dictionary<string, string>() { { "Expression", "#$" }, { "Restriction", RestrictionType.Restrict.ToString() }, { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_SpecialChar" } })); //fn_ReqValidator.Add(new RangeValidator(new Dictionary<string, string>() { { "MinLength", "2" }, { "MaxLength", "5" }, { "Validate", "true" }, { "MessageKey", "AllControlModel_UserName_Range" } })); //PropertyConfiguration firstNameProperty = new PropertyConfiguration("FirstName", fn_ReqValidator, accessPolicyCode: "UN_ACCESS_POLICY"); //PropertyConfiguration firstNameProperty = new PropertyConfiguration("FirstName", fn_ReqValidator, accessPolicyCode: "UN_ACCESS_POLICY",); Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("ActionURL", @"ControlLibrary_AutoComplete_load"); AutoCompleteBehaviourPropertyBag autoCompleteBhBag = new AutoCompleteBehaviourPropertyBag(dic); Dictionary<string, object> behaviourDtls = new Dictionary<string, object>(); behaviourDtls.Add("AutoCompleteBehaviourPropertyBag", autoCompleteBhBag); /*Masking Property Configuration*/ Dictionary<string, string> Maskingdic = new Dictionary<string, string>(); Maskingdic.Add("MaskingChar", "X"); Maskingdic.Add("MaskingType", MaskingType.Partial.ToString()); Maskingdic.Add("MaskCharLength", 4.ToString()); Maskingdic.Add("MaskingPosition", MaskingPosition.Last.ToString()); MaskingBehaviourPropertyBag maskingBag = new MaskingBehaviourPropertyBag(Maskingdic); behaviourDtls.Add("MaskingBehaviourPropertyBag", maskingBag); PropertyConfiguration firstNameProperty = new PropertyConfiguration("FirstName", fn_ReqValidator, accessPolicyCode: "FN_ACCESS_POLICY", behaviourDtls: behaviourDtls); properties.Add(firstNameProperty.Key, firstNameProperty); List<IModelPropertyConfiguration> modelList = new List<IModelPropertyConfiguration>(); modelList.Add(new ModelPropertyConfiguration("FirstName", "FirstName", "AllControlModel_FirstName", properties["FirstName"])); ModelConfiguration modelConfig = new ModelConfiguration("AllControlModel", modelList); dataList.Add(modelConfig); return dataList; }