public ShopVM Setup_To_Create_Shop_Get(string returnUrl, string menuPathMainId) { menuPathMainId.IsNullOrWhiteSpaceThrowException("No Menu Path"); UserId.IsNullOrWhiteSpaceThrowException("You must be logged in to continue."); decimal ratePerMonth = getShopRatePerMonth(); int noOfMonths = 1; decimal totalAmount = ratePerMonth * noOfMonths; AddressStringWithNames customerAddress = getDefaultCustomerAddress(); MenuPathMain mpm = MenuPathMainBiz.Find(menuPathMainId); mpm.IsNullThrowException("Menu Path not found"); CashDistributionEngine cashDistributionEnginge = get_CashDistributionEngineAndCheckBalance(totalAmount, true); string explaintion = string.Format("{0}. All your products will be collected and will be shown in your shop. Note, every shop must have a unique name and will be created in its own area. This shop will be created in: ", cashDistributionEnginge.Message); List <string> shopNames = getShopNamesForCurrUser(); string shopName = getAUniqueNameForShop(); ShopVM shopCreate = new ShopVM("", shopName, explaintion, noOfMonths, ratePerMonth, returnUrl, shopNames, mpm, customerAddress); return(shopCreate); }
private MenuPathMain getMainMenuPath(ShopVM shopCreate) { MenuPathMain mpm = MenuPathMainBiz.Find(shopCreate.MenuPathMainId); mpm.IsNullThrowException("Menu Path Not Found."); return(mpm); }
//private ICollection<OwnersChildProductsWithLink> loadOwnersChildProductsWithLinks(HashSet<ProductChild> childProductsBelongingToUserFrom) //{ // if (childProductsBelongingToUserFrom.IsNullOrEmpty()) // return null; // List<OwnersChildProductsWithLink> ownersChildProductsWithLinkLst = new List<OwnersChildProductsWithLink>(); // foreach (ProductChild productChild in childProductsBelongingToUserFrom) // { // string saleLink = createLandingPageLinkForProductChild(productChild); // OwnersChildProductsWithLink ownersChildProductsWithLink = new OwnersChildProductsWithLink(productChild, saleLink); // } // return ownersChildProductsWithLinkLst; //} //private string createLandingPageLinkForProductChild(ProductChild productChild) //{ // //Url.Action("ProductChildLandingPage", "ProductChilds", new { productChildId = menuVar.IdForEdit, menuEnum = Model.MenuManager.MenuState.NextMenu, returnUrl = returnUrl }); //} private MenuPathMain getMpm(string menuPathMainId) { menuPathMainId.IsNullOrWhiteSpaceThrowArgumentException("menuPathMainId"); MenuPathMain mpm = MenuPathMainBiz.Find(menuPathMainId); mpm.IsNullThrowException("mpm"); return(mpm); }
public override void BusinessRulesFor(ControllerCreateEditParameter parm) { if (IsCreate) { Product product = Product.Unbox(parm.Entity); product.IsUnApproved = false; Owner owner = OwnerBiz.GetPlayerFor(UserId); owner.IsNullThrowException("You must first become a seller. Go to ' I Want To...' to become a seller."); product.OwnerId = owner.Id; if (owner.Shops.IsNull()) { owner.Shops = new List <Product>(); } owner.Shops.Add(product); product.MainMenuIdForShop.IsNullOrWhiteSpaceThrowException(); MenuPathMain mpm = MenuPathMainBiz.Find(product.MainMenuIdForShop); mpm.IsNullThrowException(); if (mpm.Products.IsNull()) { mpm.Products = new List <Product>(); } if (product.MenuPathMains.IsNull()) { product.MenuPathMains = new List <MenuPathMain>(); } mpm.Products.Add(product); product.MenuPathMains.Add(mpm); } base.BusinessRulesFor(parm); }