Exemple #1
0
        public BuySellDoc GetOpenSaleWithSameCustomerAndSeller(string customerId, string ownerProductChildId, ProductChild productChild)
        {
            customerId.IsNullThrowExceptionArgument("customerId");
            ownerProductChildId.IsNullThrowExceptionArgument("ownerProductChildId");
            productChild.IsNullThrowExceptionArgument("productChild");

            BuySellDoc buysSellDoc = FindAll().FirstOrDefault(x =>
                                                              x.CustomerId == customerId &&
                                                              x.OwnerId == ownerProductChildId &&
                                                              x.BuySellDocStateEnum == BuySellDocStateENUM.RequestUnconfirmed);

            //make sure the product addresses are also the same.
            if (buysSellDoc.IsNull())
            {
                return(buysSellDoc);
            }

            if (productChild.ShipFromAddress.IsNull())
            {
                productChild.ShipFromAddressId.IsNullOrWhiteSpaceThrowException();

                productChild.ShipFromAddress = AddressBiz.Find(productChild.ShipFromAddressId);
                productChild.ShipFromAddress.IsNullThrowException();
            }
            productChild.ShipFromAddressComplex = productChild.ShipFromAddress.ToAddressComplex();

            if (buysSellDoc.AddressShipFromComplex.Equals(productChild.ShipFromAddressComplex))
            {
                return(buysSellDoc);
            }

            return(null);
        }
Exemple #2
0
        public List <ProductChildFeature> Get_All_ProductChild_Features_For(ProductChild productChild)
        {
            productChild.IsNullThrowExceptionArgument();

            if (productChild.ProductChildFeatures.IsNullOrEmpty())
            {
                return(null);
            }

            List <ProductChildFeature> productChildFeatures = productChild.ProductChildFeatures.OrderBy(x => x.Name).ToList();

            return(productChildFeatures);
        }
Exemple #3
0
        public void FixProductChildFeatures(ProductChild productChild)
        {
            productChild.IsNullThrowExceptionArgument("productChild");
            productChild.Product.IsNullThrowException("Product");
            IProduct iproduct = productChild.Product;

            //get all the product features.
            List <ProductFeature> list_Of_ProductFeatures =
                get_All_Product_Features_For(iproduct);

            List <ProductChildFeature> list_Of_ProductChild_Features =
                Get_All_ProductChild_Features_For(productChild);

            List <ProductChildFeature> list_Of_Missing_ProductChild_Features_In_ProductChild =
                get_List_Of_Missing_ProductChild_Features_In_ProductChild(list_Of_ProductFeatures, list_Of_ProductChild_Features);

            //add all missing features from the product to the product child.
            productChild = add_Missing_ProductChildFeatures_To_ProductChild(productChild, list_Of_Missing_ProductChild_Features_In_ProductChild);
        }
        private void getPeopleFromProductChildOwners(ProductChild productChild)
        {
            productChild.IsNullThrowExceptionArgument("productChild");
            productChild.Owner.IsNullThrowException("child owner is null");
            productChild.Owner.Person.IsNullThrowException("child owner person is null");

            peopleInProductChildren.Add(productChild.Owner.Person);

            //this is where we get all the child products owned by user in the current subset
            if (!OwnerForUser.IsNull())
            {
                if (productChild.OwnerId == OwnerForUser.Id)
                {
                    productChild.Selected = true;
                    childProductsBelongingToUserFrom.Add(productChild);
                }
            }

            //get the likes/unlike people for the product
            if (!productChild.LikeUnlikes_Fixed.IsNullOrEmpty())
            {
                AddLikes(productChild.LikeUnlikes_Fixed);
            }
        }