/// <summary> /// Adds a Price Type /// Level: Data /// </summary> /// <param name="myPriceType">The Price Type to Add</param> public void AddPriceType(UserTypeProduct myPriceType) { try { Entities.AddToUserTypeProducts(myPriceType); Entities.SaveChanges(); } catch (Exception Exception) { throw Exception; } }
/// <summary> /// Adds a new price type /// Level: Logic /// </summary> /// <param name="UserTypeFK">The UserTypeID</param> /// <param name="ProductFK">The Product ID</param> /// <param name="Price">The Price</param> /// <param name="DiscountBegins">Discount Start Date</param> /// <param name="DiscountEnds">Discount End Date</param> /// <param name="DiscountPercent">Discount Percentage</param> public void AddPriceType(int UserTypeFK, Guid ProductFK, double Price, DateTime? DiscountBegins, DateTime? DiscountEnds, double? DiscountPercent) { try { UserTypeProduct myPriceType = new UserTypeProduct(); myPriceType.UserTypeFK = UserTypeFK; myPriceType.ProductFK = ProductFK; myPriceType.Price = Price; myPriceType.DiscountDateFrom = DiscountBegins; myPriceType.DiscountDateTo = DiscountEnds; myPriceType.DiscountPercentage = DiscountPercent; new PriceTypesRepository().AddPriceType(myPriceType); } catch (Exception Exception) { throw Exception; } }
/// <summary> /// Deprecated Method for adding a new object to the UserTypeProducts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserTypeProducts(UserTypeProduct userTypeProduct) { base.AddObject("UserTypeProducts", userTypeProduct); }
/// <summary> /// Create a new UserTypeProduct object. /// </summary> /// <param name="userTypeFK">Initial value of the UserTypeFK property.</param> /// <param name="productFK">Initial value of the ProductFK property.</param> /// <param name="price">Initial value of the Price property.</param> public static UserTypeProduct CreateUserTypeProduct(global::System.Int32 userTypeFK, global::System.Guid productFK, global::System.Double price) { UserTypeProduct userTypeProduct = new UserTypeProduct(); userTypeProduct.UserTypeFK = userTypeFK; userTypeProduct.ProductFK = productFK; userTypeProduct.Price = price; return userTypeProduct; }