Beispiel #1
0
        //飲料編輯的ViewModel
        public static DrinkDetails GetEditDrinkDetail_UseSizePID(int SizePID)
        {
            NewDrinkDB db    = new NewDrinkDB();
            SizeTable  query = db.SizeTables.Find(SizePID);

            //取出飲料種類.名稱
            MenuDrink drinkNameT = db.MenuDrinks.Find(query.DrinkID);

            //分別取出尺寸,甜度,冰度,加料
            var size    = ManagerModels.mySize(query.MenuID);
            var sweet   = ManagerModels.AllreadyMySweet(SizePID);
            var ice     = ManagerModels.AllreadyMyIce(SizePID);
            var additem = ManagerModels.AllreadyMyAddItem(SizePID);

            DrinkDetails result = new DrinkDetails()
            {
                ID         = SizePID,
                DrinkType  = drinkNameT.DrinkType,
                DrinkName  = drinkNameT.DrinkName,
                DrinkPrice = query.Price,
                SizeType   = size,
                SizeTypeM  = query.SizeID.ToString(),
                Sweet      = sweet,
                IceHot     = ice,
                AddItem    = additem
            };

            db.Dispose();
            return(result);
        }
Beispiel #2
0
        //依照MenuID.DrinkType.DrinkName取出飲料ID
        public static int PickDrinkID_UseModel(DrinkDetails detail, int MenuID)
        {
            NewDrinkDB db      = new NewDrinkDB();
            int        DrinkID = 0;
            var        query   = db.MenuDrinks.Where(m => m.MenuID == MenuID && m.DrinkType == detail.DrinkType && m.DrinkName == detail.DrinkName).Select(m => new { ID = m.ID });

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

            db.Dispose();
            return(DrinkID);
        }
Beispiel #3
0
        //依照DrinkID,再用DrinkID.SizeID.Price取SizePID
        public static int PickSizePID_UseDidSidPrice(DrinkDetails 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);
        }
Beispiel #4
0
        //將甜度,冰度,尺寸加入陣列(飲料編輯用)
        public static List <int> CheckEditbox(DrinkDetails EditD, string type)
        {
            var addItem = new List <int>();

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

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

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

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

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

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

            default:
                break;
            }

            return(addItem);
        }
Beispiel #5
0
        //將甜度,冰度,加料加入陣列(新增飲品用)
        public static List <int> AddDrink_CheckboxNotEmpty(DrinkDetails 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);
        }