Ejemplo n.º 1
0
        public static OrderDetail MakeOrderDetail(Order myOrder, Product myProduct, decimal unitPrice, Int16 quantity, float discount)
        {
            OrderDetail tmp = OrderDetail.New(myOrder, myProduct, unitPrice, quantity, discount);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 2
0
        public static Territory MakeTerritory(string territoryID, string territoryDescription, Region myRegion)
        {
            Territory tmp = Territory.New(territoryID, territoryDescription, myRegion);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 3
0
        public static Region MakeRegion(int regionID, string regionDescription)
        {
            Region tmp = Region.New(regionID, regionDescription);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 4
0
        public static Supplier MakeSupplier(string companyName, string contactName, string contactTitle, string address, string city, string region, string postalCode, string country, string phone, string fax, string homePage)
        {
            Supplier tmp = Supplier.New(companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax, homePage);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 5
0
        public static EmployeeTerritory MakeEmployeeTerritory(Employee myEmployee, Territory myTerritory)
        {
            EmployeeTerritory tmp = EmployeeTerritory.New(myEmployee, myTerritory);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 6
0
        public static Shipper MakeShipper(string companyName, string phone)
        {
            Shipper tmp = Shipper.New(companyName, phone);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
        public static CustomerCustomerDemo MakeCustomerCustomerDemo(Customer myCustomer, CustomerDemographic myCustomerDemographic)
        {
            CustomerCustomerDemo tmp = CustomerCustomerDemo.New(myCustomer, myCustomerDemographic);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 8
0
        public static CustomerDemographic MakeCustomerDemographic(string customerTypeID, string customerDesc)
        {
            CustomerDemographic tmp = CustomerDemographic.New(customerTypeID, customerDesc);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }
Ejemplo n.º 9
0
        public static Category MakeCategory(string categoryName, string description, byte[] picture)
        {
            Category tmp = Category.New(categoryName, description, picture);

            if (tmp.IsSavable)
            {
                tmp = tmp.Save();
            }
            else
            {
                Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
                tmp._ErrorMessage = "Failed Validation:";
                foreach (Csla.Validation.BrokenRule br in brc)
                {
                    tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
                }
            }
            return(tmp);
        }