public static bool Rule4Validation(SalesView sales)
        {
            Customer customer = new Customer("", sales.CustomerType, sales.AgeRange,sales.Size);

            RulesManagerBase ruleMan = RulesValidationFactory.MakeRulesManager();

            IList<object> list = new List<object>();
            list.Add(customer);
            return ruleMan.Validate(ConfigurationManager.AppSettings["Rule4"], list);
        }
Example #2
0
        /// <summary>
        /// Gold customer.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ValidateButton2_Click(object sender, EventArgs e)
        {
            SalesView rule2 = new SalesView();
            rule2.CustomerType = CustomerTypeList.Text;
            rule2.AgeRange = AgeRangeList.Text;
            bool r = RulesValidationController.Rule2Validation(rule2);

            string message = "The rule " + ConfigurationManager.AppSettings["Rule2"] + " validates: " + r.ToString();
            ClientScript.RegisterStartupScript(Page.GetType(), "Validation", "alert('" + message + "');", true);
        }
        public static bool Rule5Validation(SalesView sales)
        {
            Customer customer = new Customer("", sales.CustomerType, sales.AgeRange);
            Discount discount = new Discount(sales.DiscountMin,sales.DiscountMax, sales.VipDiscount);

            RulesManagerBase ruleMan = RulesValidationFactory.MakeRulesManager();

            IList<object> list = new List<object>();
            list.Add(customer);
            list.Add(discount);
            return ruleMan.Validate(ConfigurationManager.AppSettings["Rule5"], list);
        }
Example #4
0
        protected void ValidateButton5_Click(object sender, EventArgs e)
        {
            SalesView rule5 = new SalesView();
            rule5.AgeRange = AgeRangeList.Text;
            rule5.DiscountMin = decimal.Parse(MinValueTextBox.Text);
            rule5.DiscountMax = decimal.Parse(MaxValueTextBox.Text);

            bool r = RulesValidationController.Rule5Validation(rule5);

            string message = "The rule " + ConfigurationManager.AppSettings["Rule5"] + " validates: " + r.ToString();
            ClientScript.RegisterStartupScript(Page.GetType(), "Validation", "alert('" + message + "');", true);
        }