Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private AddressStringWithNames getDefaultCustomerAddress()
        {
            AddressStringWithNames customerAddress = null;
            Customer customerUser = getCustomerOfUser();

            if (!customerUser.DefaultBillAddress.IsNull())
            {
                customerAddress = customerUser.DefaultBillAddress.ToAddressComplex();
            }

            return(customerAddress);
        }
Exemplo n.º 3
0
        public ShopVM Setup_Shop_For_Edit_Get(string returnUrl, string productId)
        {
            productId.IsNullOrWhiteSpaceThrowException("productId");
            returnUrl.IsNullOrWhiteSpaceThrowException("returnUrl");

            //locate the shop
            Product product = ProductBiz.Find(productId);

            product.IsNullThrowException("product");

            //now we have the shop...
            MenuPathMain menuPathMain = product.MenuPathMains_Fixed.FirstOrDefault();

            menuPathMain.IsNullThrowException("menuPathMain");
            string menuPathMainId = menuPathMain.Id;

            menuPathMainId.IsNullOrWhiteSpaceThrowException("menuPathMainId");


            List <string> shopNames    = getShopNamesForCurrUser();
            int           noOfMonths   = 1;
            decimal       ratePerMonth = getShopRatePerMonth();
            decimal       totalAmount  = ratePerMonth * noOfMonths;

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

            AddressStringWithNames customerAddress = getDefaultCustomerAddress();

            ShopVM shopCreate = new ShopVM(
                product.Id,
                product.Name,
                explaintion,
                noOfMonths,
                ratePerMonth,
                returnUrl,
                shopNames,
                menuPathMain,
                customerAddress,
                product.MiscFiles_Fixed);

            shopCreate.Id = product.Id;

            return(shopCreate);
        }