Beispiel #1
0
        public void AddInitData_ProductChild()
        {
            //get the data
            List <ProductChildInitializer> dataList = GetDataListForChildProduct;

            if (dataList.IsNullOrEmpty())
            {
                ErrorsGlobal.Add("No data available.", MethodBase.GetCurrentMethod());
                throw new Exception(ErrorsGlobal.ToString());
            }


            foreach (ProductChildInitializer item in dataList)
            {
                ProductChild pc = new ProductChild();

                pc.Name           = item.ProductName;
                pc.Sell.SellPrice = item.SalePrice;
                Product product = FindForName(item.ParentName);
                product.IsNullThrowException();
                pc.ProductId = product.Id;
                pc.Product   = product;
                pc.ShipFromAddressComplex         = AddressComplex.SystemAddress_Complex();
                pc.IsNonRefundablePaymentAccepted = item.IsNonRefundablePaymentAccepted;

                if (product.ProductChildren.IsNull())
                {
                    product.ProductChildren = new List <ProductChild>();
                }

                product.ProductChildren.Add(pc);
                ProductChildBiz.CreateSave_ForInitializeOnly(pc);
            }
        }
        private List <string> getShopPictures(Product product)
        {
            //get all child products
            List <string>       picList     = new List <string>();
            List <ProductChild> allChildren = ProductChildBiz.FindAll().Where(x => x.OwnerId == product.OwnerId).ToList();

            if (allChildren.IsNullOrEmpty())
            {
                //do nothing
            }
            else
            {
                //get all the pictures of productchildren
                foreach (ProductChild pc in allChildren)
                {
                    if (pc.MiscFiles_Fixed.IsNullOrEmpty())
                    {
                        continue;
                    }
                    foreach (UploadedFile upf in pc.MiscFiles_Fixed)
                    {
                        string addy = getImageAddressOf(upf);
                        picList.Add(addy);
                    }
                }
            }

            return(picList);
        }
        private void deleteChildProductsUploadsActually(Product p)
        {
            var childProducts = p.ProductChildren;

            if (childProducts.IsNullOrEmpty())
            {
                return;
            }

            List <string> lstOfIdsToDelete = new List <string>();

            foreach (var child in childProducts)
            {
                deleteUploadsAndPhysicalFiles(child.MiscFiles);
                lstOfIdsToDelete.Add(child.Id);
            }

            lstOfIdsToDelete.IsNullThrowException("Programming error. List of ids cannot be null.");

            foreach (var id in lstOfIdsToDelete)
            {
                ProductChildBiz.DeleteActuallyAndSave(id);
            }

            childProducts.Clear();
        }
        private void getPeopleFromProductChildOwners(string productChildId)
        {
            productChildId.IsNullOrWhiteSpaceThrowArgumentException("productChildId");
            ProductChild productChild = ProductChildBiz.Find(productChildId);

            getPeopleFromProductChildOwners(productChild);
        }
Beispiel #5
0
 public ProductBiz(UserBiz userBiz, IRepositry <Product> entityDal, MyWorkClassesProduct myWorkClassesProduct, ProductChildBiz productChildBiz, BizParameters bizParameters, LikeUnlikeBiz likeUnlikeBiz, OwnerBiz ownerBiz)
     : base(entityDal, bizParameters)
 {
     _myWorkClassesProduct = myWorkClassesProduct;
     _userBiz         = userBiz;
     _productChildBiz = productChildBiz;
     _likeUnlikeBiz   = likeUnlikeBiz;
     _ownerBiz        = ownerBiz;
     _bizParameters   = bizParameters;
 }
Beispiel #6
0
        private List <ProductChild> shopChildren(Product product)
        {
            if (product.IsShopExpired)
            {
                return(null);
            }

            List <ProductChild> children = ProductChildBiz.FindAll().Where(x => x.OwnerId == product.OwnerId && x.Hide == false).ToList();


            return(children);
        }
Beispiel #7
0
 public MenuBiz(MenuPathMainBiz menuPathMainBiz, ProductBiz productBiz, IRepositry <MenuPathMain> entityDal, BizParameters bizParameters, CashTrxBiz cashTrxBiz, BankBiz bankBiz, OwnerBiz ownerBiz, AddressBiz addressBiz)
     : base(entityDal, bizParameters)
 {
     _menuPathMainBiz = menuPathMainBiz;
     _productBiz      = productBiz;
     _productChildBiz = productBiz.ProductChildBiz;
     //_likeUnlikeBiz = likeUnlikeBiz;
     _cashTrxBiz = cashTrxBiz;
     _bankBix    = bankBiz;
     _ownerBiz   = ownerBiz;
     //_addressBiz = addressBiz;
     _addressBiz = addressBiz;
 }
        //this recieves a list of selected product children Ids from MessageParameter and then gets the
        //product children and returns them
        private List <ProductChild> getProductChildrenFromCheckItem(MessageParameter msgParam)
        {
            List <ProductChild> selectedList = new List <ProductChild>();

            if (!msgParam.GetProductChildrenAddyFromCheckItems().IsNullOrEmpty())
            {
                foreach (string pChildAddy in msgParam.GetProductChildrenAddyFromCheckItems())
                {
                    ProductChild productChild = ProductChildBiz.Find(pChildAddy);
                    productChild.IsNullThrowException("productChild");
                    selectedList.Add(productChild);
                }
            }

            return(selectedList);
        }
Beispiel #9
0
        private List <Product> get_Live_Products()
        {
            List <ProductChild> liveChldren = ProductChildBiz.FindAll()
                                              .Where(x => x.Hide == false)
                                              .ToList();

            if (liveChldren.IsNullOrEmpty())
            {
                return(null);
            }

            List <Product> productList = new List <Product>();

            foreach (ProductChild pc in liveChldren)
            {
                if (pc.Product.IsNull())
                {
                    throw new Exception("Product child has no parent");
                }
                productList.Add(pc.Product);
            }
            return(productList);
        }
        //This supplies a dummy MenuPathMain for the Back to List in the Create.
        protected IMenuManager makeMenuManager(ControllerIndexParams parm)
        {
            MenuPathMain mpm = null;
            Product      p   = null;
            ProductChild pc  = null;

            switch (parm.MenuEnum)
            {
            case EnumLibrary.EnumNS.MenuENUM.IndexMenuPath2:
            case EnumLibrary.EnumNS.MenuENUM.IndexMenuPath3:
            case EnumLibrary.EnumNS.MenuENUM.IndexMenuProduct:

                parm.MenuPathMainId.IsNullOrWhiteSpaceThrowException();
                string mpmId = parm.MenuPathMainId;
                mpm = Find(mpmId);
                mpm.IsNullThrowException();
                break;

            case EnumLibrary.EnumNS.MenuENUM.IndexMenuProductChild:

                parm.ProductId.IsNullOrWhiteSpaceThrowException();
                string pId = parm.ProductId;
                p = ProductBiz.Find(pId);
                p.IsNullThrowException();
                break;

            case EnumLibrary.EnumNS.MenuENUM.IndexMenuProductChildLandingPage:

                parm.ProductChildId.IsNullOrWhiteSpaceThrowException();
                string productChildId = parm.ProductChildId;
                pc = ProductChildBiz.Find(productChildId);
                pc.IsNullThrowException();

                //add the features
                pc.AllFeatures = ProductChildBiz.Get_All_ProductChild_Features_For(pc);
                break;

            case EnumLibrary.EnumNS.MenuENUM.IndexMenuPath1:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPath1:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPath2:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPath3:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPathMain:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuProduct:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuProductChild:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPath1:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPath2:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPath3:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPathMenuPathMain:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuProduct:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuProductChild:
            default:
                break;
            }

            MenuManager mm = new MenuManager(mpm, p, pc, parm.MenuEnum, parm.BreadCrumbManager, parm.LikeUnlikeCounter, UserId, parm.ReturnUrl, UserName);

            mm.BreadCrumbManager = parm.BreadCrumbManager;
            //mm.IndexMenuVariables.IsAdmin = UserBiz.IsAdmin(UserId);


            if (!UserId.IsNullOrWhiteSpace())
            {
                Person person = CashTrxBiz.PersonBiz.GetPersonForUserId(UserId);
                if (person.IsNull())
                {
                    //mm.UserMoneyAccount = new UserMoneyAccount();
                }
                else
                {
                    bool isBank = BankBiz.IsBanker_User(UserId);
                    //swithched off to get rid of error. MAY NEED IT BACK!
                    //mm.UserMoneyAccount = MoneyAccountForPerson(person.Id, isBank);
                }
            }


            return(mm as IMenuManager);
        }
        public string AddToSale(string userId, string productChildId, string poNumber, DateTime poDate)
        {
            userId.IsNullOrWhiteSpaceThrowException("No user");

            double totalThisItem = 0;

            //who is the owner:The product Child owner is the owner
            //get the productChild

            productChildId.IsNullOrWhiteSpaceThrowException("No Product");
            ProductChild productChild = ProductChildBiz.Find(productChildId);

            productChild.IsNullThrowException("productChild");



            //get the product child's owner
            Owner ownerProductChild = productChild.Owner;

            ownerProductChild.IsNullThrowException("productChildOwner");

            //get the owner
            //Get the select list for owner
            Person ownerPerson = ownerProductChild.Person;

            ownerPerson.IsNullThrowException("ownerPerson");
            System.Web.Mvc.SelectList ownerSelectList = OwnerBiz.SelectListOnlyWith(ownerProductChild);


            ////the user is the customer user;
            //get the customer
            Customer customerUser = CustomerBiz.GetPlayerFor(userId);

            //Get the select list for Customer
            //remove the owner from the list... owner cannot sell to self.
            System.Web.Mvc.SelectList customerSelectList = CustomerBiz.SelectListWithout(ownerPerson);
            System.Web.Mvc.SelectList selectListOwner    = OwnerBiz.SelectListOnlyWith(ownerProductChild);
            System.Web.Mvc.SelectList selectListCustomer = CustomerBiz.SelectListWithout(ownerPerson);

            //this is the address in the customer
            AddressMain    addressBillTo          = customerUser.DefaultBillAddress;
            AddressMain    addressShipTo          = customerUser.DefaultShipAddress;
            AddressComplex addressShipFromComplex = productChild.ShipFromAddressComplex;

            string addressBillToId = "";
            string addressShipToId = "";

            if (!addressBillTo.IsNull())
            {
                addressBillToId = addressBillTo.Id;
            }

            if (!addressShipTo.IsNull())
            {
                addressShipToId = addressShipTo.Id;
            }


            //Get the select list for AddressInform
            System.Web.Mvc.SelectList selectListBillTo = AddressBiz.SelectListBillAddressCurrentUser();
            //Get the select list for AddressShipTo
            System.Web.Mvc.SelectList selectListShipTo = AddressBiz.SelectListShipAddressCurrentuser();



            //check to see if there is any open sale which belongs to the same buyer and seller
            BuySellDoc sale = BuySellDocBiz.GetOpenSaleWithSameCustomerAndSeller(customerUser.Id, ownerProductChild.Id, productChild);

            //create the itemList.
            List <BuySellItem> buySellItems = new List <BuySellItem>();
            string             shopId       = "";

            if (sale.IsNull())
            {
                //otherwise add a new sale
                sale = CreateSale(
                    productChild,
                    ownerProductChild,
                    1,
                    productChild.Sell.SellPrice,
                    customerUser,
                    selectListOwner,
                    selectListCustomer,
                    addressBillToId,
                    addressShipToId,
                    selectListBillTo,
                    selectListShipTo,
                    BuySellDocStateENUM.RequestUnconfirmed,
                    BuySellDocStateModifierENUM.Unknown,
                    DateTime.Now,
                    DateTime.Now,
                    shopId);

                totalThisItem++;
            }

            else
            {
                //dont really need this, but it is good for consistancy.
                sale.BuySellDocumentTypeEnum = BuySellDocumentTypeENUM.Purchase;
                sale.BuySellDocStateEnum     = BuySellDocStateENUM.RequestUnconfirmed;

                //now check to see if it is the same item... or is it a new item
                //get list of items for the sale
                List <BuySellItem> itemList = sale.BuySellItems.Where(x => x.MetaData.IsDeleted == false).ToList();

                if (itemList.IsNullOrEmpty())
                {
                    BuySellItem buySellItem = new BuySellItem(sale.Id, productChild.Id, 1, productChild.Sell.SellPrice, productChild.FullName());
                    sale.Add(buySellItem);
                }
                else
                {
                    //there are items in the list
                    BuySellItem itemFound = itemList.FirstOrDefault(x => x.ProductChildId == productChild.Id);
                    if (itemFound.IsNull())
                    {
                        BuySellItem buySellItem = new BuySellItem(sale.Id, productChild.Id, 1, productChild.Sell.SellPrice, productChild.FullName());
                        sale.Add(buySellItem);
                    }
                    else
                    {
                        totalThisItem                     = itemFound.Quantity.Order;
                        itemFound.Quantity.Order         += 1;
                        itemFound.Quantity.Order_Original = itemFound.Quantity.Order;
                        //itemFound.Quantity.Ship += 1;
                    }
                }

                totalThisItem++;
                sale.AddressShipFromComplex = addressShipFromComplex;

                BuySellDocBiz.GetDefaultVehicalType(sale);
                sale.AddressShipFromId = productChild.ShipFromAddressId;

                sale.RequestUnconfirmed.SetToTodaysDate(UserName, UserId);

                ControllerCreateEditParameter parm = new ControllerCreateEditParameter();
                parm.Entity       = sale as ICommonWithId;
                parm.GlobalObject = GetGlobalObject();

                BuySellDocBiz.Update(parm);
            }

            BuySellDocBiz.SaveChanges();
            string message = string.Format("Success. You ordered {0:N2} for {1:N2} (X{2:N2})", productChild.FullName(), productChild.Sell.SellPrice, totalThisItem);

            return(message);
        }
Beispiel #12
0
        private ControllerCreateEditParameter setup_Shop_Into_ControllerCreateEditParameter(
            ShopVM shopCreate,
            string button,
            HttpPostedFileBase[] httpMiscUploadedFiles,
            Owner userOwner,
            out CashDistributionEngine cde,
            out int quantity,
            out Product product,
            out MenuPathMain mpm,
            out ControllerCreateEditParameter parm)
        {
            decimal paymentAmount = MenuPathMain.Payment_To_Buy_Shop();
            decimal commissionPct = BuySellDoc.Get_Maximum_Commission_Product_Percent();
            bool    isNonRefundablePaymentAllowed = true;

            cde = get_CashDistributionEngineAndCheckBalance(paymentAmount, isNonRefundablePaymentAllowed);

            //check the name, if it is already used, throw error and return to create screen
            if (isShopNameExists(shopCreate.ShopName))
            {
                string err = string.Format("The shop name '{0}' already exists... sorry. Try again.", shopCreate.ShopName);
                throw new Exception(err);
            }
            //create the shop
            //get the shop Child Product
            ProductChild shop = ProductChildBiz.FindForName(ProductChild.GetShopName());

            shop.IsNullThrowException("Shop not found");

            Owner ownerProductChild = shop.Owner;

            ownerProductChild.IsNullThrowException("No Product Child Owner");

            quantity = shopCreate.NoOfMonths;
            if (quantity == 0)
            {
                throw new Exception("The quantity is zero. This is not allowed");
            }

            Customer customerUser = getCustomerOfUser();

            SelectList selectListOwner      = null;
            SelectList selectListCustomer   = null;
            SelectList selectListBillTo     = null;
            SelectList selectListShipTo     = null;
            string     addressBillToId      = "";
            string     addressShipToId      = "";
            decimal    salePrice            = MenuPathMain.Payment_To_Buy_Shop();
            DateTime   expectedDeliveryDate = DateTime.Now;
            DateTime   guaranteePeriodEnds  = DateTime.Now;

            //MenuPathMain mpm = MenuPathMainBiz.Find(shopCreate.MenuPathMainId);
            //mpm.IsNullThrowException("Menu Path Main is null");

            mpm     = getMainMenuPath(shopCreate);
            product = setup_Product_For_Shop(shopCreate, userOwner);

            string shopId = product.Id;

            BuySellDoc sale = CreateSale(
                shop,
                ownerProductChild,
                quantity,
                salePrice,
                customerUser,
                selectListOwner,
                selectListCustomer,
                addressBillToId,
                addressShipToId,
                selectListBillTo,
                selectListShipTo,
                BuySellDocStateENUM.RequestUnconfirmed,
                BuySellDocStateModifierENUM.Accept,
                expectedDeliveryDate,
                guaranteePeriodEnds,
                shopId);

            product.BuySellDocs.Add(sale);

            parm = new ControllerCreateEditParameter(
                product as ICommonWithId,
                httpMiscUploadedFiles,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                MenuENUM.EditDefault,
                UserName,
                UserId,
                shopCreate.ReturnUrl,
                GetGlobalObject(),
                button);

            return(parm);
        }
Beispiel #13
0
        public async Task <ShopCreatedSuccessfullyVM> Setup_To_Create_Shop_Post_Async(ShopVM shopCreate, string button, HttpPostedFileBase[] httpMiscUploadedFiles)
        {
            UserId.IsNullOrWhiteSpaceThrowException("You are not logged in.");
            shopCreate.MenuPathMainId.IsNullOrWhiteSpaceThrowException("Main Menu Path not received");
            Owner userOwner = OwnerBiz.GetPlayerFor(UserId);

            userOwner.IsNullThrowException("You are not authourized to create a shop. Please become a seller first.");

            if (button == "accept")
            {
                //CashDistributionEngine cde;
                //int quantity;
                //Product product;
                //MenuPathMain mpm;
                //ControllerCreateEditParameter parm = setup_Shop_Into_ControllerCreateEditParameter(shopCreate, button, httpMiscUploadedFiles, userOwner, out cde, out quantity, out product, out mpm, out parm);

                decimal paymentAmount = MenuPathMain.Payment_To_Buy_Shop();
                decimal commissionPct = BuySellDoc.Get_Maximum_Commission_Product_Percent();
                bool    isNonRefundablePaymentAllowed = true;
                CashDistributionEngine cde            = get_CashDistributionEngineAndCheckBalance(paymentAmount, isNonRefundablePaymentAllowed);

                //check the name, if it is already used, throw error and return to create screen
                if (isShopNameExists(shopCreate.ShopName))
                {
                    string err = string.Format("The shop name '{0}' already exists... sorry. Try again.", shopCreate.ShopName);
                    throw new Exception(err);
                }
                //create the shop


                int quantity = shopCreate.NoOfMonths;
                if (quantity == 0)
                {
                    throw new Exception("The quantity is zero. This is not allowed");
                }

                Customer   customerUser         = getCustomerOfUser();
                SelectList selectListOwner      = null;
                SelectList selectListCustomer   = null;
                SelectList selectListBillTo     = null;
                SelectList selectListShipTo     = null;
                string     addressBillToId      = "";
                string     addressShipToId      = "";
                decimal    salePrice            = MenuPathMain.Payment_To_Buy_Shop();
                DateTime   expectedDeliveryDate = DateTime.Now;
                DateTime   guaranteePeriodEnds  = DateTime.Now;

                //MenuPathMain mpm = MenuPathMainBiz.Find(shopCreate.MenuPathMainId);
                //mpm.IsNullThrowException("Menu Path Main is null");

                MenuPathMain mpm     = getMainMenuPath(shopCreate);
                Product      product = setup_Product_For_Shop(shopCreate, userOwner);

                //get the shop Child Product
                ProductChild shopBuySellItem = ProductChildBiz.FindForName(ProductChild.GetShopName());
                shopBuySellItem.IsNullThrowException("Shop not found");

                string shopId = product.Id;
                Owner  ownerOfProductChild = shopBuySellItem.Owner;
                ownerOfProductChild.IsNullThrowException("No Product Child Owner");

                BuySellDoc sale = CreateSale(
                    shopBuySellItem,
                    ownerOfProductChild,
                    quantity,
                    salePrice,
                    customerUser,
                    selectListOwner,
                    selectListCustomer,
                    addressBillToId,
                    addressShipToId,
                    selectListBillTo,
                    selectListShipTo,
                    BuySellDocStateENUM.RequestUnconfirmed,
                    BuySellDocStateModifierENUM.Accept,
                    expectedDeliveryDate,
                    guaranteePeriodEnds,
                    shopId);

                product.BuySellDocs.Add(sale);

                ControllerCreateEditParameter parm = new ControllerCreateEditParameter(
                    product as ICommonWithId,
                    httpMiscUploadedFiles,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    MenuENUM.EditDefault,
                    UserName,
                    UserId,
                    shopCreate.ReturnUrl,
                    GetGlobalObject(),
                    button);

                await ShopBiz.CreateAndSaveAsync(parm);


                decimal  refundable_Spent    = cde.Refundable_Final;
                decimal  nonRefundable_spent = cde.NonRefundable_Final;
                string   shopName            = product.FullName();
                string   mp1Name             = mpm.MenuPath1.FullName();
                string   mp2Name             = mpm.MenuPath2.FullName();
                string   mp3Name             = mpm.MenuPath3.FullName();
                int      numberOfMonths      = quantity;
                DateTime expiryDate          = product.ShopExpiryDate.Date_NotNull_Min;

                ShopCreatedSuccessfullyVM shopCreatedSuccessfully = new ShopCreatedSuccessfullyVM(
                    refundable_Spent,
                    nonRefundable_spent,
                    shopName,
                    mp1Name,
                    mp2Name,
                    mp3Name,
                    numberOfMonths,
                    expiryDate,
                    shopCreate.ReturnUrl);

                //BuySellDocBiz.SaveChanges();
                return(shopCreatedSuccessfully);
            }
            else
            {
                string err = string.Format("You caneled the operation.");
                throw new Exception(err);
            }
        }
Beispiel #14
0
        public async Task <ShopCreatedSuccessfullyVM> Setup_To_Edit_Shop_Post_Async(ShopVM shopVm, string button, HttpPostedFileBase[] httpMiscUploadedFiles)
        {
            UserId.IsNullOrWhiteSpaceThrowException("You are not logged in.");
            shopVm.IsNullThrowExceptionArgument("Shop");
            button.IsNullOrWhiteSpaceThrowArgumentException("button");
            Owner userOwner = OwnerBiz.GetPlayerFor(UserId);

            userOwner.IsNullThrowException("You are not authourized to create a shop. Please become a seller first.");
            if (button == "accept")
            {
                //locate the shop

                if (shopVm.NoOfMonths == 0)
                {
                    throw new Exception("No of months is zero");
                }
                decimal salePrice = MenuPathMain.Payment_To_Buy_Shop();
                int     quantity  = shopVm.NoOfMonths;

                //see if User has the money to do what they want.
                decimal paymentAmount = salePrice * quantity;

                bool isNonRefundablePaymentAllowed = true;
                CashDistributionEngine cde         = get_CashDistributionEngineAndCheckBalance(paymentAmount, isNonRefundablePaymentAllowed);

                //get the shop Child Product
                ProductChild shopBuySellItem = ProductChildBiz.FindForName(ProductChild.GetShopName());
                shopBuySellItem.IsNullThrowException("Shop not found");

                Owner ownerOfProductChild = shopBuySellItem.Owner;
                ownerOfProductChild.IsNullThrowException("No Product Child Owner");

                Customer customerUser = getCustomerOfUser();

                Product product = ProductBiz.Find(shopVm.Id);
                product.IsNullThrowException("product");
                string shopId = product.Id;
                updateTheProductFromTheShopVm(product, shopVm);

                SelectList selectListOwner      = null;
                SelectList selectListCustomer   = null;
                SelectList selectListBillTo     = null;
                SelectList selectListShipTo     = null;
                string     addressBillToId      = "";
                string     addressShipToId      = "";
                DateTime   expectedDeliveryDate = DateTime.Now;
                DateTime   guaranteePeriodEnds  = DateTime.Now;


                BuySellDoc sale = CreateSale(
                    shopBuySellItem,
                    ownerOfProductChild,
                    quantity,
                    salePrice,
                    customerUser,
                    selectListOwner,
                    selectListCustomer,
                    addressBillToId,
                    addressShipToId,
                    selectListBillTo,
                    selectListShipTo,
                    BuySellDocStateENUM.RequestUnconfirmed,
                    BuySellDocStateModifierENUM.Accept,
                    expectedDeliveryDate,
                    guaranteePeriodEnds,
                    shopId);

                product.BuySellDocs.Add(sale);

                ControllerCreateEditParameter parm = new ControllerCreateEditParameter(
                    product as ICommonWithId,
                    httpMiscUploadedFiles,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    MenuENUM.EditDefault,
                    UserName,
                    UserId,
                    shopVm.ReturnUrl,
                    null, //globalObject not required for products
                    button);

                await ProductBiz.UpdateAndSaveAsync(parm);


                MenuPathMain mpm = product.MenuPathMains_Fixed.FirstOrDefault();

                decimal  refundable_Spent    = cde.Refundable_Final;
                decimal  nonRefundable_spent = cde.NonRefundable_Final;
                string   shopName            = product.FullName();
                string   mp1Name             = mpm.MenuPath1.FullName();
                string   mp2Name             = mpm.MenuPath2.FullName();
                string   mp3Name             = mpm.MenuPath3.FullName();
                int      numberOfMonths      = quantity;
                DateTime expiryDate          = product.ShopExpiryDate.Date_NotNull_Min;

                ShopCreatedSuccessfullyVM shopCreatedSuccessfully = new ShopCreatedSuccessfullyVM(
                    refundable_Spent,
                    nonRefundable_spent,
                    shopName,
                    mp1Name,
                    mp2Name,
                    mp3Name,
                    numberOfMonths,
                    expiryDate,
                    shopVm.ReturnUrl);

                return(shopCreatedSuccessfully);
            }

            return(null);
        }