Example #1
0
        public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras)
        {
            int typecode;

            if (int.TryParse(paras["typecode"], out typecode))
            {
                typecode = 0;
            }

            OrderProduct op = OrderProducts.Find(c => c.ProductID == productId && c.TypeCode == typecode);

            if (op == null)
            {
                op                   = OrderProductFactory.Instance().CreateOrderProduct(productId, quantity, opType, paras);
                op.Key               = this.Key + "_op" + this.GetSerial();
                op.Container         = this;
                this.ContinueShopUrl = op.ProductUrl;

                if (op != null)
                {
                    OrderProducts.Add(op);
                }
            }
            else
            {
                op.SetQuantiy(op.Quantity + quantity);
            }
            return(op);
        }
        public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras)
        {
            SuitId = productId;
            int typecode;

            if (int.TryParse(paras["typecode"], out typecode))
            {
                typecode = 0;
            }

            NoName.NetShop.Solution.BLL.SuiteBll sbll = new SuiteBll();
            SolutionProductBll spbll = new SolutionProductBll();

            SuiteModel smodel = sbll.GetModel(SuitId);

            List <SolutionProductModel> list = spbll.GetModelList(SuitId);

            this.OrderProducts.Clear();
            foreach (SolutionProductModel model in list)
            {
                OrderProduct op = OrderProductFactory.Instance().CreateOrderProduct(model.ProductId, model.Quantity, opType, paras);
                op.Key       = this.Key + "_op" + this.GetSerial();
                op.Container = this;
                if (op != null)
                {
                    OrderProducts.Add(op);
                }
            }
            this.DerateFee = this.ProductSum - smodel.Price;
            _score         = smodel.Score;

            return(null);
        }
Example #3
0
        public Order AddProduct(OrderProduct product)
        {
            OrderProducts.Add(product);
            TotalPrice        += product.Price * product.Quantity;
            TotalPriceWithVat += product.PriceWithVat * product.Quantity;
            TotalVat          += product.Vat * product.Quantity;

            return(this);
        }
Example #4
0
        public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras)
        {
            int typecode;

            if (!int.TryParse(paras["typecode"], out typecode))
            {
                typecode = 0;
            }

            ShopIdentity user   = HttpContext.Current.User.Identity as ShopIdentity;
            MemberInfo   member = MemberInfo.GetBaseInfo(user.UserId);

            OrderProduct op = OrderProducts.Find(c => c.ProductID == productId && c.TypeCode == typecode);

            if (op == null)
            {
                op                   = OrderProductFactory.Instance().CreateOrderProduct(productId, quantity, opType, paras);
                op.Key               = this.Key + "_op" + this.GetSerial();
                op.Container         = this;
                this.ContinueShopUrl = op.ProductUrl;


                if (op != null)
                {
                    if (this.TotalScore + op.TotalScore <= member.CurScore)
                    {
                        OrderProducts.Add(op);
                    }
                    else
                    {
                        op = null;
                    }
                }
            }
            else
            {
                int oldQuantity = op.Quantity;
                op.SetQuantiy(op.Quantity + quantity);
                if (this.TotalScore > member.CurScore)
                {
                    op.SetQuantiy(oldQuantity);
                }
            }
            return(op);
        }
Example #5
0
        private void MakeOrderCommand()
        {
            var orderanimal = new OrderProductanimal();

            orderanimal.OrderSpecialization = ParameterProduct.Specialization;
            orderanimal.OrderBreed          = ParameterProduct.Breed;
            orderanimal.OrderGender         = ParameterProduct.Gender;
            orderanimal.OrderNumber         = ParameterProduct.Number;
            orderanimal.OrderPrice          = ParameterProduct.Price;
            orderanimal.CustomerSurname     = MainClient.Surname;
            orderanimal.CustomerName        = MainClient.Name;
            orderanimal.CustomerMiddlename  = MainClient.Middlename;
            orderanimal.CustomerLogin       = MainClient.Login;

            orderanimal.Status = null;

            OrderProducts.Add(orderanimal);
            LogAddOrder();
            RaisePropertyChangedEvent(nameof(OrderFillter));
        }
        public void AddProductToOrder(object parameter)
        {
            if (!(parameter is int))
            {
                return;
            }

            using (var context = new KursachDBContext())
            {
                int id = Convert.ToInt32(parameter);

                Product currProduct = context.Products.FirstOrDefault(p => p.Id == id);
                if (currProduct == null)
                {
                    return;
                }

                OrderProducts.Add(currProduct);
                OnProperyChanged("OrderProducts");
            }
        }
Example #7
0
 private void InsertOrderProduct(int tankId, int quantity)
 {
     OrderProducts.Add(OrderProduct.Create(tankId, quantity));
 }