Point offset = new Point(0, 0); //记录动了多少距离 public Shopping_Basket_Form(Order order) { InitializeComponent(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; int totalprice = 0; foreach (OrderItem orderItem1 in order.OrderItems) { totalprice += orderItem1.Amount * orderItem1.Cuisine.UnitPrice; } lblTotalPrice.Text = totalprice.ToString(); int i = 0; foreach (OrderItem orderItem in order.OrderItems) { Image image = ImageToByte.BytesToImage(orderItem.Cuisine.Picture); Shopping_Control control = new Shopping_Control(image); control.CuisineName = orderItem.Cuisine.Name; control.Detail = orderItem.Cuisine.Description; control.Amount = orderItem.Amount; pnlOrderItemShow.Controls.Add(control); control.SetBounds(0, i * 75, 300, 75); control.Location = new Point(10, i * 80 + 10); i++; } }
public Cuisine_Form(CuisineType cuisineType, Order order) { InitializeComponent(); int i = 0; foreach (Cuisine cuisine in cuisineType.Cuisines) { Image image = ImageToByte.BytesToImage(cuisine.Picture); Cuisine_Control control = new Cuisine_Control(image); control.order = order; control.cuisine = cuisine; control.Price = cuisine.UnitPrice; pnlShowCuisine.Controls.Add(control); control.Location = new Point(10, i * 95 + 10); i++; }//显示所有的商家图片并进行动态绑定; }
Point offset = new Point(0, 0); //记录动了多少距离 public ShoppingBasket(Order order) { InitializeComponent(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; lblOrder_Id.Text = order.Id.ToString(); lblOrder_State.Text = order.OrderState; lblTotal_Price.Text = order.TotalPrice.ToString(); int i = 0; foreach (OrderItem orderItem in order.OrderItems) { Image image = ImageToByte.BytesToImage(orderItem.Cuisine.Picture); Shopping_Control control = new Shopping_Control(image); control.CuisineName = orderItem.Cuisine.Name; control.Detail = orderItem.Cuisine.Description; control.Amount = orderItem.Amount; pnlOrderItems.Controls.Add(control); control.SetBounds(0, i * 75, 300, 75); i++; } }
public Select_Merchant_Form(Customer customer, Form form, Form mainForm) { InitializeComponent(); this.customer = customer; /*Merchant merchant1 = new Merchant(); * merchant1.Name = "KFC"; * merchant1.Info = "嫩牛五方限时折扣"; * * Cuisine cuisine = new Cuisine(); * cuisine.Id = 1; * cuisine.Name = "香辣鸡腿堡"; * cuisine.UnitPrice=7; * * Cuisine cuisine1 = new Cuisine(); * cuisine1.Id = 2; * cuisine1.Name = "新奥尔良鸡腿堡"; * cuisine1.UnitPrice = 8; * * Cuisine cuisine2 = new Cuisine(); * cuisine1.Id = 3; * cuisine1.Name = "牛肉堡"; * cuisine1.UnitPrice = 7; * * Cuisine cuisine3 = new Cuisine(); * cuisine1.Id = 4; * cuisine1.Name = "双层牛肉堡"; * cuisine1.UnitPrice = 10; * * Cuisine cuisine4 = new Cuisine(); * cuisine1.Id = 5; * cuisine1.Name = "双层鸡腿堡"; * cuisine1.UnitPrice = 11; * * Cuisine cuisine5 = new Cuisine(); * cuisine1.Id = 6; * cuisine1.Name = "菌菇堡"; * cuisine1.UnitPrice = 6; * * CuisineType cuisineType=new CuisineType(); * cuisineType.TypeName = "汉堡"; * cuisineType.Cuisines.Add(cuisine1); * cuisineType.Cuisines.Add(cuisine); * * merchant1.CuisineTypes.Add(cuisineType); * * CuisineType cuisineType1 = new CuisineType(); * cuisineType.TypeName = "鸡肉卷"; * * CuisineType cuisineType2 = new CuisineType(); * cuisineType.TypeName = "薯条"; * CuisineType cuisineType3 = new CuisineType(); * cuisineType.TypeName = "饮料"; * CuisineType cuisineType4 = new CuisineType(); * cuisineType.TypeName = "小吃"; * merchant1.CuisineTypes.Add(cuisineType1); * merchant1.CuisineTypes.Add(cuisineType2); * merchant1.CuisineTypes.Add(cuisineType3); * merchant1.CuisineTypes.Add(cuisineType4); * * * * * Merchant merchant2 = new Merchant(); * merchant2.Name = "沙县小吃"; * merchant2.Info = "风味独特、经济实惠"; * * * Merchant merchant3 = new Merchant(); * merchant3.Name = "星巴克"; * merchant3.Info = "全球著名的咖啡连锁店"; * * Merchant merchant4 = new Merchant(); * merchant3.Name = "撤硕"; * merchant3.Info = "老八蜜汁"; * * Merchant merchant5 = new Merchant(); * merchant3.Name = "汉堡王"; * merchant3.Info = "最正宗的美式汉堡"; * * Merchant merchant6 = new Merchant(); * merchant3.Name = "烤肉之家"; * merchant3.Info = "尽情享受烤肉之旅"; * * Merchant merchant7 = new Merchant(); * merchant3.Name = "农家餐厅"; * merchant3.Info = "农家炒菜"; * * merchants.Add(merchant1); * merchants.Add(merchant2); * merchants.Add(merchant3); * merchants.Add(merchant4); * merchants.Add(merchant5); * merchants.Add(merchant6); * merchants.Add(merchant7);*/ merchants = Customer_Service.GetAllMerchants(); int i = 0; foreach (Merchant merchant in merchants) { Image image = ImageToByte.BytesToImage(merchant.Picture); Merchant_Control control = new Merchant_Control(form, mainForm, image); control.Merchant_Name = merchant.Name; control.Detail = merchant.Info; control.merchant = merchant; control.customer = customer; control.Location = new Point(20, 90 * i + 10); pnlMerchant.Controls.Add(control); i++; } }
private void Customer_OrderList_Form_Load(object sender, EventArgs e) { this.BackgroundImage = Image.FromFile(@"素材\灰背景.jpg"); pnlOrders.BackgroundImage = Image.FromFile(@"素材\白背景.jpg"); //获取顾客的所有订单 orders = Customer_Service.GetAllOrders(customer.Id); /*Order order1 = new Order(); order1.Id = 1; order1.OrderState = "等待"; order1.OrderTime = "14:30"; order1.TotalPrice = 80; * Cuisine cuisine = new Cuisine(); cuisine.Name = "233"; cuisine.UnitPrice = 20; * OrderItem orderItem = new OrderItem(); orderItem.Cuisine = cuisine; * order1.OrderItems.Add(orderItem); * orders = new List<Order>(); * orders.Add(order1);*/ int i = 0; foreach (Order order in orders) { Image image = ImageToByte.BytesToImage(order.OrderItems[0].Cuisine.Picture); //设置按钮 RadioButton radioButton = new RadioButton(); radioButton.Appearance = Appearance.Button; radioButton.Size = new Size(780, 100); radioButton.FlatStyle = FlatStyle.Flat; radioButton.BackgroundImage = Image.FromFile(@"素材\白背景.jpg"); radioButton.Name = order.Id.ToString(); //设置图片 PictureBox pictureBox = new PictureBox(); pictureBox.BackgroundImageLayout = ImageLayout.Zoom; pictureBox.Image = ImageToByte.BytesToImage(order.OrderItems[0].Cuisine.Picture); pictureBox.Location = new Point(10, 10); pictureBox.Size = new Size(120, 80); //设置下单时间 Label label1 = new Label(); label1.Size = new Size(500, 27); label1.Text = "下单时间:" + order.OrderTime; label1.Location = new Point(170, 10); label1.Font = new Font("微软雅黑 Light", 10, FontStyle.Regular); //设置总价 Label label2 = new Label(); label2.Size = new Size(200, 27); label2.Text = "总价:" + order.OrderState; label2.Location = new Point(170, 60); label2.Font = new Font("微软雅黑 Light", 10, FontStyle.Regular); //设置状态 Label label3 = new Label(); label3.Size = new Size(300, 27); label3.Text = "订单状态:" + order.OrderState; label3.Location = new Point(460, 60); label3.Font = new Font("微软雅黑 Light", 10, FontStyle.Regular); radioButton.Controls.Add(pictureBox); radioButton.Controls.Add(label1); radioButton.Controls.Add(label2); radioButton.Controls.Add(label3); radioButton.Location = new Point(20, i * 110 + 10); pnlOrders.Controls.Add(radioButton); radioButtons.Add(radioButton); i++; } }