Ejemplo n.º 1
0
        /// <summary>
        /// 查询食品信息
        /// </summary>
        public void SearchFood()
        {
            List <Food> foodList = foodmanage.GetFoodList(this.txtFoodNameSearch.Text.Trim(), this.cmbFoodTypeSearch.Text.Trim());

            if (foodList.Count == 0)
            {
                MessageBox.Show("没有查到数据", "查询", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.dgvFoodList.DataSource = foodList;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得食品集合
        /// </summary>
        public void GetFoodInfo(string foodType)
        {
            this.imgFoodPhoto.Images.Clear();
            lvFoodList.Items.Clear();
            int         imageIndex = 0;
            List <Food> foodList   = foodmanage.GetFoodList(foodType, -1);

            for (int i = 0; i < foodList.Count; i++)
            {
                this.imgFoodPhoto.Images.Add(Image.FromFile(GetAllURL() + "\\" + foodList[i].FI_FoodPhotoURL1));
                this.imgFoodPhoto.Tag = i;
            }
            for (int i = 0; i < foodList.Count; i++, imageIndex++)
            {
                ListViewItem item = new ListViewItem();
                item.Text       = foodList[i].FI_FoodName1 + "  " + foodList[i].FI_FoodPrice1 + "元";
                item.Tag        = foodList[i].FI_FoodId1;
                item.ImageIndex = imageIndex;
                this.lvFoodList.Items.Add(item);
            }
            this.lvFoodList.LargeImageList = this.imgFoodPhoto;
        }