Exemplo n.º 1
0
        //依照MenuID.DrinkType.DrinkName取出飲料ID
        public static int PickDrinkID_UseModel2(Add2_Drinks_detail detail, int MenuID, string DrinkType)
        {
            NewDrinkDB db      = new NewDrinkDB();
            int        DrinkID = 0;
            var        query   = db.MenuDrinks.Where(m => m.MenuID == MenuID && m.DrinkType == DrinkType && m.DrinkName == detail.DrinkName).Select(m => new { ID = m.ID });

            foreach (var item in query)
            {
                DrinkID = item.ID;
            }

            db.Dispose();
            return(DrinkID);
        }
Exemplo n.º 2
0
        //依照DrinkID,再用DrinkID.SizeID.Price取SizePID
        public static int PickSizePID_UseDidSidPrice2(Add2_Drinks_detail detail, int DrinkID)
        {
            NewDrinkDB db      = new NewDrinkDB();
            int        SizePID = 0;
            int        SizeID  = Int32.Parse(detail.SizeTypeM);
            var        query   = db.SizeTables.Where(m => m.DrinkID == DrinkID && m.SizeID == SizeID && m.Price == detail.DrinkPrice).Select(m => new { ID = m.ID });

            foreach (var item in query)
            {
                SizePID = item.ID;
            }

            db.Dispose();
            return(SizePID);
        }
Exemplo n.º 3
0
        //將甜度,冰度,加料加入陣列(新增飲品用)
        public static List <int> AddDrink_CheckboxNotEmpty2(Add2_Drinks_detail details, string type)
        {
            var addItem = new List <int>();

            switch (type)
            {
            case "sweet":
                foreach (var item in details.Sweet)
                {
                    if (item.Selected)
                    {
                        //加到陣列
                        var DD = Int32.Parse(item.Value);
                        addItem.Add(DD);
                    }
                    else
                    {
                        //跳過
                        continue;
                    }
                }
                break;

            case "ice":
                foreach (var item in details.IceHot)
                {
                    if (item.Selected)
                    {
                        //加到陣列
                        var DD = Int32.Parse(item.Value);
                        addItem.Add(DD);
                    }
                    else
                    {
                        //跳過
                        continue;
                    }
                }
                break;

            case "additem":
                if (details.AddItem != null)
                {
                    foreach (var item in details.AddItem)
                    {
                        if (item.Selected)
                        {
                            //加到陣列
                            var DD = Int32.Parse(item.Value);
                            addItem.Add(DD);
                        }
                        else
                        {
                            //跳過
                            continue;
                        }
                    }
                }
                break;

            default:
                break;
            }

            return(addItem);
        }