Esempio n. 1
0
        public bool Validate(BusinessObject otherObject)
        {
            String errorMsg = String.Format("{0} validation failed",
                otherObject.GetType().Name);

            this.AddRule(new ValidateCompare(otherObject, ValidationOperator.Equal, errorMsg));

            return Validate();
        }
        public override bool Validate(BusinessObject thisObject)
        {
            try
            {
                switch (Operator)
                {
                    case ValidationOperator.Equal:
                        return thisObject.Equals(OtherObject);
                    case ValidationOperator.NotEqual:
                        return !thisObject.Equals(OtherObject);
                }
            }
            catch
            {
                ;
            }

            return false;
        }
Esempio n. 3
0
 public static BusinessObject Update(BusinessObject obj)
 {
     if (obj is Address)
         return GetAddressInfo((Address)obj);
     else if (obj is Supplier)
         return GetSupplierInfo((Supplier)obj);
     else if (obj is Category)
         return GetCategoryInfo((Category)obj);
     else if (obj is Customer)
         return GetCustomerInfo((Customer)obj);
     else if (obj is Product)
         return GetProductInfo((Product)obj);
     else if (obj is Order)
         return GetOrderInfo((Order)obj);
     else if (obj is OrderDetail)
         return GetOrderDetailInfo((OrderDetail)obj);
     else
         return null;
 }
Esempio n. 4
0
 public bool ValidateOrderDetail(BusinessObject bObject)
 {
     OrderDetail ordDetail = (OrderDetail)bObject;
     return ordDetail.Validate(GetOrderDetail(ordDetail.OrderId, ordDetail.ProductId));
 }
Esempio n. 5
0
 public bool ValidateOrder(BusinessObject bObject)
 {
     Order order = (Order)bObject;
     return order.Validate(GetOrder(order.OrderId));
 }
Esempio n. 6
0
 public bool ValidateProduct(BusinessObject bObject)
 {
     Product product = (Product)bObject;
     return product.Validate(GetProduct(product.ProductId));
 }
Esempio n. 7
0
 public bool ValidateCustomer(BusinessObject bObject)
 {
     Customer customer = (Customer)bObject;
     return customer.Validate(GetCustomer(customer.CustomerId));
 }
Esempio n. 8
0
 public bool ValidateCategory(BusinessObject bObject)
 {
     Category category = (Category)bObject;
     return category.Validate(GetCategory(category.CategoryId));
 }
Esempio n. 9
0
 public bool ValidateSupplier(BusinessObject bObject)
 {
     Supplier supplier = (Supplier)bObject;
     return supplier.Validate(GetSupplier(supplier.SupplierId));
 }
Esempio n. 10
0
 public bool ValidateAddress(BusinessObject bObject)
 {
     Address address = (Address)bObject;
     return address.Validate(GetAddress(address.AddressId));
 }