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(); }
public MenuItemButton(ItemLayout item_layout) { InitializeComponent(); mItemLayout = item_layout; setWidget(); setColor(); setPosition(); }
private void setTestItemLayoutData() { ItemLayout item_layout01 = new ItemLayout(01, 01, 0, 0, MetrialColor.Name.Amber); ItemLayout item_layout02 = new ItemLayout(02, 02, 1, 0, MetrialColor.Name.Amber); ItemLayout item_layout03 = new ItemLayout(03, 03, 0, 1, MetrialColor.Name.Amber); ItemLayout item_layout04 = new ItemLayout(04, 04, 1, 1, MetrialColor.Name.Amber); ItemLayout item_layout05 = new ItemLayout(05, 05, 2, 0, MetrialColor.Name.Blue); ItemLayout item_layout06 = new ItemLayout(06, 06, 3, 0, MetrialColor.Name.Blue); ItemLayout item_layout07 = new ItemLayout(07, 07, 4, 0, MetrialColor.Name.Blue); ItemLayout item_layout08 = new ItemLayout(08, 08, 5, 0, MetrialColor.Name.Blue); ItemLayout item_layout09 = new ItemLayout(09, 09, 2, 1, MetrialColor.Name.Blue); ItemLayout item_layout10 = new ItemLayout(10, 10, 3, 1, MetrialColor.Name.Blue); ItemLayout item_layout11 = new ItemLayout(11, 11, 4, 1, MetrialColor.Name.Blue); ItemLayout item_layout12 = new ItemLayout(12, 12, 5, 1, MetrialColor.Name.Blue); ItemLayout item_layout13 = new ItemLayout(13, 13, 2, 2, MetrialColor.Name.Amber); ItemLayout item_layout14 = new ItemLayout(14, 14, 3, 2, MetrialColor.Name.Amber); ItemLayout item_layout15 = new ItemLayout(15, 15, 4, 2, MetrialColor.Name.Amber); ItemLayout item_layout16 = new ItemLayout(16, 16, 6, 0, MetrialColor.Name.Amber); ItemLayout item_layout17 = new ItemLayout(17, 17, 7, 0, MetrialColor.Name.Amber); ItemLayout item_layout18 = new ItemLayout(18, 18, 6, 1, MetrialColor.Name.Amber); ItemLayout item_layout19 = new ItemLayout(19, 19, 7, 1, MetrialColor.Name.Amber); ItemLayout item_layout20 = new ItemLayout(20, 20, 6, 2, MetrialColor.Name.Amber); ItemLayout item_layout21 = new ItemLayout(21, 21, 7, 2, MetrialColor.Name.Amber); mItemLayoutList.Add(item_layout01); mItemLayoutList.Add(item_layout02); mItemLayoutList.Add(item_layout03); mItemLayoutList.Add(item_layout04); mItemLayoutList.Add(item_layout05); mItemLayoutList.Add(item_layout06); mItemLayoutList.Add(item_layout07); mItemLayoutList.Add(item_layout08); mItemLayoutList.Add(item_layout09); mItemLayoutList.Add(item_layout10); mItemLayoutList.Add(item_layout11); mItemLayoutList.Add(item_layout12); mItemLayoutList.Add(item_layout13); mItemLayoutList.Add(item_layout14); mItemLayoutList.Add(item_layout15); mItemLayoutList.Add(item_layout16); mItemLayoutList.Add(item_layout17); mItemLayoutList.Add(item_layout18); mItemLayoutList.Add(item_layout19); mItemLayoutList.Add(item_layout20); mItemLayoutList.Add(item_layout21); }
public void deleteItemLayout(ItemLayout item_layout) { Dictionary<string, string> set_data = new Dictionary<string, string>(); set_data.Add("enable", "0"); set_data.Add("delete_time", DateTime.Now.Ticks.ToString()); Dictionary<string, string> where_data = new Dictionary<string, string>(); where_data.Add("id", item_layout.getId().ToString()); update("item_layout", set_data, where_data); }
public void addItemLayout(ItemLayout item_layout) { Dictionary<string, string> set_data = new Dictionary<string, string>(); set_data.Add("enable", "0"); set_data.Add("delete_time", DateTime.Now.Ticks.ToString()); Dictionary<string, string> where_data = new Dictionary<string, string>(); where_data.Add("position_x", item_layout.getPositionX().ToString()); where_data.Add("position_y", item_layout.getPositionY().ToString()); where_data.Add("enable", "1"); update("item_layout", set_data, where_data); Dictionary<string, string> insert_data = new Dictionary<string, string>(); insert_data.Add("category_id", item_layout.getItemId().ToString()); insert_data.Add("position_x", item_layout.getPositionX().ToString()); insert_data.Add("position_y", item_layout.getPositionY().ToString()); insert_data.Add("color", Convert.ToInt32(item_layout.getColorName()).ToString()); insert_data.Add("create_time", DateTime.Now.Ticks.ToString()); insert("item_layout", insert_data); updateItemLayoutList(); }
public void updateItemLayoutList() { mItemLayoutList.Clear(); string query = @"SELECT * FROM item WHERE enable=1"; SQLiteCommand cmd = new SQLiteCommand(query, mConnection); SQLiteDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { ItemLayout item_layout = new ItemLayout(); item_layout.setItemId((uint)(dr["item_id"])); item_layout.setId((uint)(dr["id"])); item_layout.setPositionX((uint)(dr["position_x"])); item_layout.setPositionY((uint)(dr["position_y"])); item_layout.setColorName(MetrialColor.getName((uint)(dr["color"]))); mItemLayoutList.Add(item_layout); } }