Пример #1
0
		public void addOrderItem(ItemLayout item_layoutm)
		{
			bool is_already_added = false;

			foreach (Order order in mOrderList)
			{
				if (order.item.getItem().getId() == item_layoutm.getId())
				{
					order.item.increaseQuantity();
					is_already_added = true;
					order.button.refreshOrder(order.item);
					break;
				}
			}

			if (is_already_added == false)
			{
				OrderItem order_item = new OrderItem(item_layoutm.getItem());

				OrderItemButton order_item_button = new OrderItemButton(order_item);
				order_item_button.Width = OrderItemButton.WIDTH;
				order_item_button.Height = OrderItemButton.HEIGHT;
				order_item_button.ClickIncrease += increaseQuantity;
				order_item_button.ClickDecrease += decreaseQuantity;
				order_item_button.ClickDelete += deleteOrderItem;

				mOrderList.Add(new Order(order_item, order_item_button));

				mOrderItemButtonStackPanel.Children.Add(order_item_button);
				Debug.Write("Add : " + item_layoutm.getItem().getName());
			}

			onOrderChange();
		}
Пример #2
0
		public Discount(OrderItem.DiscountType discount_type)
		{
			InitializeComponent();

			mDiscountType = discount_type;
			//mDiscountType = OrderItem.DiscountType.Percent;
			mValue = 0;

			setLabel();
			setButton();

		}
Пример #3
0
		private void showDiscountCanvas(OrderItem.DiscountType discount_type)
		{
			switch(discount_type)
			{
				case OrderItem.DiscountType.Percent:
				{
					mDiscount = new Discount(OrderItem.DiscountType.Percent);
					mDiscount.DonePressed += mOrderItemCanvas.setDiscount;

					mDiscount.ShowDialog();
					break;
				}
				case OrderItem.DiscountType.Price:
				{
					mDiscount = new Discount(OrderItem.DiscountType.Price);
					mDiscount.DonePressed += mOrderItemCanvas.setDiscount;

					mDiscount.ShowDialog();
					break;
				}
				case OrderItem.DiscountType.Pension:
				{
					break;
				}
				case OrderItem.DiscountType.Enuri:
				{
					mDiscount = new Discount(OrderItem.DiscountType.Enuri);
					mDiscount.DonePressed += mOrderItemCanvas.setDiscount;

					mDiscount.ShowDialog();
					break;
				}
				default:
				{
					break;
				}
			}
		}
Пример #4
0
		public OrderItemButton(OrderItem order_item = null)
		{
			InitializeComponent();

			mOrderItem = order_item;

			canvas.Width = WIDTH;
			canvas.Height = HEIGHT;
			canvas.Background = MetrialColor.getBrush(MetrialColor.Name.Grey, 0);

			setName();
			setComment();
			setIncreaseQuantity();
			setQuantity();
			setDecreaseQuantity();
			setSubTotalPrice();
			setDiscountPrice();
			setTotalPrice();
			setDelete();

			setLine();		
		}
Пример #5
0
		public void refreshOrder(OrderItem order_item = null)
		{
			mOrderItem = order_item;
			mQuantity.Content = mOrderItem.getQuantity();
			mSubTotalPrice.Content = string.Format("{0:N0}", mOrderItem.getSubTotalPrice());
			mDiscountPrice.Content = string.Format("{0:N0}", mOrderItem.getDiscountPrice());
			mTotalPrice.Content = string.Format("{0:N0}", mOrderItem.getTotalPrice());
		}
Пример #6
0
		public void setDiscount(OrderItem.DiscountType discount_type, uint value)
		{
			if(discount_type == OrderItem.DiscountType.Price)
			{
				setDiscountPrice(value);
			}
			else if(discount_type == OrderItem.DiscountType.Percent)
			{
				setDiscountPercent(value);
			}
			else if (discount_type == OrderItem.DiscountType.Enuri)
			{
				setEnuriPrice(value);
			}
		}
Пример #7
0
			public Order(OrderItem item, OrderItemButton button)
			{
				this.item = item;
				this.button = button;
			}
Пример #8
0
		private void onDiscountSelected(OrderItem.DiscountType discount_type)
		{
			if (DiscountSelected != null)
			{
				DiscountSelected(discount_type);
			}
		}