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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }