Example #1
0
        static OrderModel()
        {

            quantityRule = new SimpleRule("DataValue", "Quantity can not be < 0",
                      (Object domainObject)=>
                      {
                          DataWrapper<Int32> obj = (DataWrapper<Int32>)domainObject;
                          return obj.DataValue <= 0;
                      });
        }
 /// <summary>
 /// Static Constructor that defines the validation rules
 /// </summary>
 static LoginViewViewModel()
 {
     UserNameCannnotBeEmptyRule = new SimpleRule("DataValue", "Username cannot be blank",
                                                 (Object domainObject) =>
                                                 {
                                                     DataWrapper<String> obj =
                                                         (DataWrapper<String>)domainObject;
                                                     return String.IsNullOrEmpty(obj.DataValue);
                                                 });
     PasswordCannotBeEmptyRule = new SimpleRule("DataValue", "Password cannot be blank",
                                                (Object domainObject) =>
                                                {
                                                    DataWrapper<String> obj =
                                                        (DataWrapper<String>)domainObject;
                                                    return String.IsNullOrEmpty(obj.DataValue);
                                                });
     SelectedBusinessUnitCannotBeEmpty = new SimpleRule("DataValue", "Please select a BU",
                                                        (Object domainObject) =>
                                                        {
                                                            DataWrapper<Int32> obj =
                                                                (DataWrapper<Int32>)domainObject;
                                                            return obj.DataValue.CompareTo(null) != 0;
                                                        });
 }
Example #3
0
        static CustomerModel()
        {

            firstNameRule = new SimpleRule("DataValue", "Firstname can not be empty",
                      (Object domainObject)=>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });
            lastNameRule = new SimpleRule("DataValue", "Lastname can not be empty",
                      (Object domainObject) =>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });
            emailRule = new SimpleRule("DataValue", "Email can not be empty",
                      (Object domainObject) =>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });
            homePhoneNumberRule = new SimpleRule("DataValue", "HomePhoneNumber can not be empty",
                      (Object domainObject) =>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });
            address1Rule = new SimpleRule("DataValue", "Address1 can not be empty",
                      (Object domainObject) =>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });
            address2Rule = new SimpleRule("DataValue", "Address2 can not be empty",
                      (Object domainObject) =>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });
            address3Rule = new SimpleRule("DataValue", "Address3 can not be empty",
                      (Object domainObject) =>
                      {
                          DataWrapper<String> obj = (DataWrapper<String>)domainObject;
                          return String.IsNullOrEmpty(obj.DataValue);
                      });

        }