Beispiel #1
0
        //取出建立飲料細節的ViewModel
        public static Add2_Drinks_detail Add2_NewDrinkDetails(int ID)
        {
            NewDrinkDB db       = new NewDrinkDB();
            Menu       MenuName = db.Menus.Find(ID);

            //取出店家尺寸的ViewModel
            IList <Add2_Drinks_Size> mySize = Add2_NewMenuAbout.Add2mySize(ID);

            //取出店家尺寸的ViewModel (下拉選單)
            List <SelectListItem> mySizeD = ManagerModels.mySize(ID);

            //取出飲料甜度的ViewModel
            IList <SelectListItem> mySweet = ManagerModels.mySweet(ID);

            //取出飲料冰度的ViewModel
            IList <SelectListItem> myIce = ManagerModels.myIce(ID);

            //取出飲料配料的ViewModel
            IList <SelectListItem> myAddItem = ManagerModels.myAddItem(ID);

            db.Dispose();

            return(new Add2_Drinks_detail()
            {
                DrinkName = "",
                Add2_Drinks_Sizes = mySize,
                SizeType = mySizeD,
                Sweet = mySweet,
                IceHot = myIce,
                AddItem = myAddItem,
                Bathus = "",
                DrinkPrice = 0,
                SizeTypeM = ""
            });
        }
Beispiel #2
0
        //解密密碼,判斷使用者
        public static string UserPsd(string UserEMail)
        {
            string     Psd = "";
            NewDrinkDB db  = new NewDrinkDB();

            var queryLinQ = db.Users.Where((m) => m.Email == UserEMail).Select(m => new { Psd = m.Password });

            foreach (var item in queryLinQ)
            {
                Psd = item.Psd;
            }

            if (queryLinQ.FirstOrDefault() == null)
            {
                //如果找不到使用者則回傳
                Psd = null;
                return(Psd);
            }

            //解密密碼
            Psd = PasswordUtility.AESDecryptor(Psd, aes.Key, aes.IV);

            db.Dispose();

            return(Psd);
        }
Beispiel #3
0
        //依照SizePID取出飲料冰度
        public static BuyDMDrinkIce DrinkIce(int SizePID)
        {
            NewDrinkDB            db    = new NewDrinkDB();
            List <SelectListItem> myIce = new List <SelectListItem>();
            var result = db.IceTables.Where(m => m.SizePID == SizePID);

            foreach (var item in result)
            {
                var    IceN   = db.IceTypes.Find(item.IceID);
                var    menuID = db.SizeTables.Find(SizePID);
                var    NameS  = db.MenuIces.Where(m => m.MenuID == menuID.MenuID && m.IceID == item.IceID);
                string NS     = "";
                foreach (var NaSitem in NameS)
                {
                    NS = NaSitem.IceName;
                }
                myIce.Add(new SelectListItem()
                {
                    Text = NS, Value = IceN.ID.ToString()
                });
            }

            db.Dispose();
            return(new BuyDMDrinkIce()
            {
                IceType = myIce
            });
        }
Beispiel #4
0
        //依照SizePID取出飲料甜度
        public static BuyDMDrinkSweet DrinkSweet(int SizePID)
        {
            NewDrinkDB            db      = new NewDrinkDB();
            List <SelectListItem> mySweet = new List <SelectListItem>();
            var result = db.SweetTables.Where(m => m.SizePID == SizePID);

            foreach (var item in result)
            {
                var    SweetN = db.SweetTypes.Find(item.SweetID);
                var    menuID = db.SizeTables.Find(SizePID);
                var    NameS  = db.MenuSweets.Where(m => m.MenuID == menuID.MenuID && m.SweetID == item.SweetID);
                string NS     = "";
                foreach (var NaSitem in NameS)
                {
                    NS = NaSitem.SweetName;
                }
                mySweet.Add(new SelectListItem()
                {
                    Text = NS, Value = SweetN.ID.ToString()
                });
            }

            db.Dispose();
            return(new BuyDMDrinkSweet()
            {
                SweetType = mySweet
            });
        }
Beispiel #5
0
        //依照MenuID, DrinkID取出飲料配料(SizePID == 0)
        public static BuyDMDrinkAdditem DrinkAddItem_UseMenuIDdrinkID(int MenuID, int DrinkID)
        {
            NewDrinkDB            db     = new NewDrinkDB();
            List <SelectListItem> myItem = new List <SelectListItem>();
            var result = db.SizeTables.Where(m => m.MenuID == MenuID && m.DrinkID == DrinkID);

            foreach (var item in result)
            {
                var AdditemPID = db.AddItemTables.Where(m => m.SizePID == item.ID);
                foreach (var additem in AdditemPID)
                {
                    var AdditemP = db.AddItemTypePrices.Find(additem.ItemIDPriceID);
                    var AddN     = db.AddItemTypes.Find(AdditemP.ItemID);
                    myItem.Add(new SelectListItem()
                    {
                        Text = AddN.ItemName + " $" + AdditemP.ItemPrice, Value = AdditemP.ID.ToString()
                    });
                }
                break;
            }

            db.Dispose();
            return(new BuyDMDrinkAdditem()
            {
                AddItem = myItem
            });
        }
Beispiel #6
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 #7
0
        //取出飲料價表
        public static List <DMDrinksDetailView> GetDrinksSizePrice(int MenuID)
        {
            NewDrinkDB db = new NewDrinkDB();
            List <DMDrinksDetailView> result = new List <DMDrinksDetailView>();
            var DrinkName = db.MenuDrinks.Where(m => m.MenuID == MenuID);

            foreach (var item in DrinkName)
            {
                List <DMDrinksPriceSize> price = new List <DMDrinksPriceSize>();
                var sizeP = db.SizeTables.Where(m => m.MenuID == MenuID && m.DrinkID == item.ID);
                foreach (var Pitem in sizeP)
                {
                    var SizeName = db.SizeTypes.Find(Pitem.SizeID);
                    price.Add(new DMDrinksPriceSize()
                    {
                        DrinkPrice = Pitem.Price,
                        DrinkSize  = SizeName.SizeName
                    });
                }
                result.Add(new DMDrinksDetailView()
                {
                    DrinkID           = item.ID,
                    DrinkType         = item.DrinkType,
                    DrinkName         = item.DrinkName,
                    DMDrinksPriceSize = price
                });
            }

            db.Dispose();
            return(result);
        }
Beispiel #8
0
        //取出飲料細節編輯的視圖
        public static BuyDMDrinkView GetDrinkDetail_EditDrink(int DetailID)
        {
            NewDrinkDB db          = new NewDrinkDB();
            var        DrinkDetail = db.CreateBuyOrder_Details.Find(DetailID);
            var        DrinkN      = db.MenuDrinks.Find(DrinkDetail.DrinkID);
            var        SizeNT      = db.SizeTables.Find(DrinkDetail.SizePID);
            var        SizeN       = db.SizeTypes.Find(SizeNT.SizeID);
            var        mySize      = DrinkSize(DrinkDetail.MenuID, DrinkDetail.DrinkID);

            foreach (var item in mySize)
            {
                if (item.Text == SizeN.SizeName && item.Value == DrinkDetail.SizePID.ToString())
                {
                    item.Selected = true;
                }
            }

            var result = new BuyDMDrinkView()
            {
                MenuID    = DrinkDetail.MenuID,
                DrinkID   = DrinkDetail.DrinkID,
                DrinkName = DrinkN.DrinkName,
                Bathus    = DrinkN.Bathus,
                SizeType  = mySize,
                SizeTypeM = DrinkDetail.SizePID.ToString(),
                Quantity  = DrinkDetail.Quantity
            };

            db.Dispose();
            return(result);
        }
Beispiel #9
0
        //檢查有沒有訂單到期了,並將訂單結束
        public static bool HaveEndOrder()
        {
            NewDrinkDB db = new NewDrinkDB();

            //看CreateBuyOrder_LeaderOrder的截止日
            //如果為有效截止日則到CreateBuyOrder_LeaderOrder將此訂單結束
            var NullTime    = Convert.ToDateTime("2000/1/1 12:00:00");
            var NowTime     = DateTime.Now;
            var AllEndOrder = db.CreateBuyOrder_LeaderOrders.Where(m => m.EndThisTime > NullTime && (m.CanOrNotOrder == 0 || m.CanOrNotOrder == 3) && m.CheckEnd == true);

            if (AllEndOrder.FirstOrDefault() != null)
            {
                foreach (var item in AllEndOrder)
                {
                    if (item.EndThisTime < NowTime)
                    {
                        item.CanOrNotOrder = 2;

                        //如果過期了自動寄出通知
                        //寄出結束通知
                        Models.AnyDMorBuy.CheckCanSend_members(item.OrderID, "結束");
                    }
                    db.SaveChanges();
                }
            }

            db.Dispose();
            return(true);
        }
Beispiel #10
0
        //以MenuID取出編輯飲料配料Model
        public static AddItemCreateEdit PickAddItemCreateEdit_UseMenuID(int MenuID)
        {
            NewDrinkDB db       = new NewDrinkDB();
            Menu       menu     = db.Menus.Find(MenuID);
            var        result2  = new List <AddCreateEditOther>();
            var        pickItem = Models.ManagerModels.PickItemDetailPartial(MenuID);

            foreach (var item in pickItem)
            {
                result2.Add(new AddCreateEditOther()
                {
                    ItemID      = item.ID,
                    ItemName    = item.ItemName,
                    LPrice      = item.LPrice,
                    MPrice      = item.MPrice,
                    SPrice      = item.SPrice,
                    deleteOrNot = false
                });
            }

            db.Dispose();
            return(new AddItemCreateEdit()
            {
                MenuID = MenuID,
                MenuName = menu.MenuName,
                AddCreateEditOther = result2
            });
        }
Beispiel #11
0
        //用OrderID取出團長ID
        public static int GetLeaderID_UseOrderID(string OrderID)
        {
            NewDrinkDB db      = new NewDrinkDB();
            int        orderid = Int32.Parse(OrderID);
            var        query   = db.CreateBuyOrder_LeaderOrders.Find(orderid);

            db.Dispose();
            return(query.UserID);
        }
Beispiel #12
0
        //區別有沒有下訂單及尚未回覆或不訂
        public static List <MyMember_Response> MyMem_Response(int OrderID)
        {
            //先在團員名單中找出團員
            NewDrinkDB db     = new NewDrinkDB();
            var        AllMem = db.CreateBuyOrder_MemberOrders.Where(m => m.OrderID == OrderID);
            List <MyMember_Response> result = new List <MyMember_Response>();

            if (AllMem.FirstOrDefault() != null)
            {
                //依照團員的狀態去顯示團員是否不訂飲料
                //0 -> 不訂
                //1 -> 尚未表態或是有訂
                foreach (var item in AllMem)
                {
                    //取出團員名稱
                    var UserName = db.Users.Find(item.UserID);

                    //如果狀態為0,則直接寫入(不訂飲料)
                    if (item.Together == false)
                    {
                        result.Add(new MyMember_Response()
                        {
                            MemID    = item.MemID,
                            OrderID  = item.OrderID,
                            UserID   = item.UserID,
                            Together = item.Together,
                            UserName = UserName.Name
                        });
                    }//End of Second IF.

                    //如果狀態為1,則判斷是否有商品訂單,若沒有則直接寫入(尚未回覆)
                    if (item.Together == true)
                    {
                        var HaveOrder = db.CreateBuyOrder_Details.Where(m => m.UserID == item.UserID && m.OrderID == OrderID);
                        if (HaveOrder.FirstOrDefault() == null)
                        {
                            result.Add(new MyMember_Response()
                            {
                                MemID    = item.MemID,
                                OrderID  = item.OrderID,
                                UserID   = item.UserID,
                                Together = item.Together,
                                UserName = UserName.Name
                            });
                        }
                    } //End of Second IF.
                }     //End of Foreach IF.
            }         //End of Main IF.

            //因該要另做一個視圖將未訂,及不訂的放一起

            return(result);
        }
Beispiel #13
0
        public static int GetHowManyMessage_UseUserEmail(string Mail)
        {
            NewDrinkDB db = new NewDrinkDB();

            var UserID = db.Users.Where(m => m.Email == Mail).Select(m => new { id = m.ID });
            int Userid = 0;

            foreach (var item in UserID)
            {
                Userid = item.id;
            }

            //判斷是否有資料超過三天,超過則刪除
            var time        = DateTime.Now;
            var resultCheck = db.SendMessageViews.Where(m => m.UserID == Userid && m.ReadOrNot == false);

            foreach (var item in resultCheck)
            {
                string NowDay  = time.ToString("yyyyMM");
                string SendDay = item.SendTime.ToString("yyyyMM");

                //如果不同年月則刪除
                if (NowDay != SendDay)
                {
                    var De = db.SendMessageViews.Find(item.ID);
                    db.SendMessageViews.Remove(De);
                    db.SaveChanges();
                }

                //如果超過三天則刪除
                string NowDay2  = time.ToString("dd");
                string SendDay2 = item.SendTime.ToString("dd");
                int    nowD     = Int32.Parse(NowDay2);
                int    SedD     = Int32.Parse(SendDay2);

                if (nowD - SedD >= 3)
                {
                    var De = db.SendMessageViews.Find(item.ID);
                    db.SendMessageViews.Remove(De);
                    db.SaveChanges();
                }
            }

            var db2     = new NewDrinkDB();
            var Message = db2.SendMessageViews.Where(m => m.UserID == Userid && m.ReadOrNot == false);
            int Mess    = Message.Count();

            db.Dispose();
            return(Mess);
        }
Beispiel #14
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);
        }
Beispiel #15
0
        //以菜單名取出菜單ID
        public static int MenuID(string MenuName)
        {
            NewDrinkDB db     = new NewDrinkDB();
            int        MenuID = 0;
            var        query  = db.Menus.Where(m => m.MenuName == MenuName).Select(m => new { ID = m.ID });

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

            db.Dispose();
            return(MenuID);
        }
Beispiel #16
0
        //取出使用者的ID
        public static int UserID(string UserEMail)
        {
            int        ID        = 0;
            NewDrinkDB db        = new NewDrinkDB();
            var        queryLinQ = db.Users.Where((m) => m.Email == UserEMail).Select(m => new { ID = m.ID });

            foreach (var item in queryLinQ)
            {
                ID = item.ID;
            }
            db.Dispose();

            return(ID);
        }
Beispiel #17
0
        //以使用者Email取出使用者ID
        public static int GetUserID_UseEmail(string UserMail)
        {
            NewDrinkDB db     = new NewDrinkDB();
            int        UserID = 0;
            var        query  = db.Users.Where(m => m.Email == UserMail);

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

            db.Dispose();
            return(UserID);
        }
Beispiel #18
0
        //取出飲料配料的名稱
        public static string Additem01_03N(int addID)
        {
            NewDrinkDB db   = new NewDrinkDB();
            string     addN = "";

            if (addID != 0)
            {
                var addName     = db.AddItemTypePrices.Find(addID);
                var additemName = db.AddItemTypes.Find(addName.ItemID);
                addN = additemName.ItemName;
            }

            db.Dispose();
            return(addN);
        }
Beispiel #19
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);
        }
Beispiel #20
0
        //依MenuID取出加料價表的ID
        public static List <int> PickAllItemPrice(int MenuID)
        {
            NewDrinkDB db     = new NewDrinkDB();
            var        result = new List <int>();
            //取出全價表
            var query = db.AddItemTypePrices.Where(m => m.MenuID == MenuID);

            foreach (var item in query)
            {
                result.Add(item.ID);
            }

            db.Dispose();
            return(result);
        }
Beispiel #21
0
        //取出已勾選的飲料冰度的ViewModel(checkbox)
        public static IList <SelectListItem> AllreadyMyIce(int SizePID)
        {
            NewDrinkDB db = new NewDrinkDB();

            SizeTable Sizequery = db.SizeTables.Find(SizePID);
            //先從店家冰度表取IceID
            var query = db.MenuIces.Where(m => m.MenuID == Sizequery.MenuID);

            //查看勾選了哪些項目
            var iceTable = db.IceTables.Where(m => m.SizePID == SizePID);

            var result = new List <SelectListItem>();

            foreach (var item in query)
            {
                //從iceTable將已勾選的項目勾選
                var  query2   = db.IceTypes.Find(item.IceID);
                bool AreCheck = false;

                foreach (var checkIce in iceTable)
                {
                    if (checkIce.IceID == item.IceID)
                    {
                        AreCheck = true;
                    }
                }

                if (AreCheck)
                {
                    result.Add(
                        new SelectListItem {
                        Text = item.IceName, Value = item.IceID.ToString(), Selected = true
                    }
                        );
                }
                else
                {
                    result.Add(
                        new SelectListItem {
                        Text = query2.IceName, Value = item.IceID.ToString(), Selected = false
                    }
                        );
                }
            }

            db.Dispose();
            return(result);
        }
Beispiel #22
0
        //依照MenuID, DrinkID取出SizePID (SizePID == 0)
        public static int PickSizePid_UseMenuIDdrinkID(int MenuID, int DrinkID)
        {
            NewDrinkDB db      = new NewDrinkDB();
            int        SizePID = 0;
            var        result  = db.SizeTables.Where(m => m.MenuID == MenuID && m.DrinkID == DrinkID);

            foreach (var item in result)
            {
                //取找到的第一個
                SizePID = item.ID;
                break;
            }

            db.Dispose();
            return(SizePID);
        }
Beispiel #23
0
        //先拿到全部尺寸,再判斷哪些已經勾過了(編輯店家甜度.冰度.尺寸的視圖用)
        public static IList <SelectListItem> MenuSIS_GetSize(int MenuID)
        {
            NewDrinkDB db = new NewDrinkDB();
            //拿到全部甜度
            var AllSize = db.SizeTypes.ToList();
            //拿到勾選的項目
            var MenuSize = db.MenuSizes.Where(m => m.MenuID == MenuID);

            var result = new List <SelectListItem>();

            foreach (var item in AllSize)
            {
                bool AreCheck = false;
                foreach (var itemSize in MenuSize)
                {
                    if (itemSize.SizeID == item.ID)
                    {
                        AreCheck = true;
                    }
                }

                if (AreCheck)
                {
                    //如果尺寸已勾選擇啟用勾選時在Menuices的名字
                    var NameI = db.MenuSizes.Where(m => m.MenuID == MenuID && m.SizeID == item.ID);
                    foreach (var NameSitem in NameI)
                    {
                        item.SizeName = NameSitem.SizeName;
                    }
                    result.Add(
                        new SelectListItem {
                        Text = item.SizeName, Value = item.ID.ToString(), Selected = true
                    }
                        );
                }
                else
                {
                    result.Add(
                        new SelectListItem {
                        Text = item.SizeName, Value = item.ID.ToString(), Selected = false
                    }
                        );
                }
            }
            db.Dispose();
            return(result);
        }
Beispiel #24
0
        //取出總菜單配料檢視部份視圖
        public static List <AddItemCreate> PickItemDetailPartial(int MenuID)
        {
            NewDrinkDB db     = new NewDrinkDB();
            var        result = db.AddItemTypePrices.Where(m => m.MenuID == MenuID);

            var AddView = new List <AddItemCreate>();
            int Num     = 0;

            foreach (var item in result)
            {
                //避免重覆取出
                if (item.ItemID == Num)
                {
                    continue;
                }

                Num = item.ItemID;
                //取出配料價表 0大, 1中, 2小
                //取出配料名
                var query = db.AddItemTypes.Find(item.ItemID);
                var AddPL = db.AddItemTypePrices.Where(m => m.MenuID == MenuID && m.ItemID == query.ID && m.SizeNumber == 0);
                var AddPM = db.AddItemTypePrices.Where(m => m.MenuID == MenuID && m.ItemID == query.ID && m.SizeNumber == 1);
                var AddPS = db.AddItemTypePrices.Where(m => m.MenuID == MenuID && m.ItemID == query.ID && m.SizeNumber == 2);

                foreach (var PriceL in AddPL)
                {
                    foreach (var PriceM in AddPM)
                    {
                        foreach (var PriceS in AddPS)
                        {
                            AddView.Add(new AddItemCreate()
                            {
                                ID       = item.ItemID,
                                ItemName = query.ItemName,
                                LPrice   = PriceL.ItemPrice,
                                MPrice   = PriceM.ItemPrice,
                                SPrice   = PriceS.ItemPrice
                            });
                        } //End PriceS Froeach.
                    }     //End PriceM Froeach.
                }         //End PriceL Froeach.
            }

            db.Dispose();
            return(AddView);
        }
Beispiel #25
0
        //以甜度名取出甜度ID(冰度,尺寸,加料也在這取)
        public static int SweetID(string Name, string type)
        {
            NewDrinkDB db     = new NewDrinkDB();
            int        MenuID = 0;

            switch (type)
            {
            case "sweet":
                var query = db.SweetTypes.Where(m => m.SweetName == Name).Select(m => new { ID = m.ID });
                foreach (var item in query)
                {
                    MenuID = item.ID;
                }
                break;

            case "ice":
                var query2 = db.IceTypes.Where(m => m.IceName == Name).Select(m => new { ID = m.ID });
                foreach (var item in query2)
                {
                    MenuID = item.ID;
                }
                break;

            case "size":
                var query3 = db.SizeTypes.Where(m => m.SizeName == Name).Select(m => new { ID = m.ID });
                foreach (var item in query3)
                {
                    MenuID = item.ID;
                }
                break;

            case "additem":
                var query4 = db.AddItemTypes.Where(m => m.ItemName == Name).Select(m => new { ID = m.ID });
                foreach (var item in query4)
                {
                    MenuID = item.ID;
                }
                break;

            default:
                break;
            }
            db.Dispose();
            return(MenuID);
        }
Beispiel #26
0
        //以MenuID取出冰度名稱
        public static List <IceType> PickMenuIce_UseMenuID(int MenuID)
        {
            NewDrinkDB db     = new NewDrinkDB();
            var        result = db.MenuIces.Where(m => m.MenuID == MenuID);
            var        IceT   = new List <IceType>();

            foreach (var item in result)
            {
                var query = db.IceTypes.Find(item.IceID);
                IceT.Add(new IceType()
                {
                    IceName = query.IceName
                });
            }

            db.Dispose();
            return(IceT);
        }
Beispiel #27
0
        //以MenuID取出飲料大小名稱
        public static List <SizeType> PickMenuSize_UseMenuID(int MenuID)
        {
            NewDrinkDB db     = new NewDrinkDB();
            var        result = db.MenuSizes.Where(m => m.MenuID == MenuID);
            var        SizeT  = new List <SizeType>();

            foreach (var item in result)
            {
                var query = db.SizeTypes.Find(item.SizeID);
                SizeT.Add(new SizeType()
                {
                    SizeName = query.SizeName
                });
            }

            db.Dispose();
            return(SizeT);
        }
Beispiel #28
0
        //取出選購菜單檢視View
        public static DMDetailsView BuyDMDetailView_UseMenuID(int MenuID)
        {
            NewDrinkDB db       = new NewDrinkDB();
            var        MenuName = db.Menus.Find(MenuID);
            List <DMDrinksDetailView> drinkModel = GetDrinksSizePrice(MenuID);

            var result = new DMDetailsView()
            {
                MenuID             = MenuID,
                MenuName           = MenuName.MenuName,
                MenuPhon           = MenuName.MenuPhone,
                OrderCondition     = MenuName.OrderConditions,
                DMDrinksDetailView = drinkModel
            };

            db.Dispose();
            return(result);
        }
Beispiel #29
0
        //取得目前現有冰度
        public static IList <SelectListItem> FirstGetIce()
        {
            NewDrinkDB db    = new NewDrinkDB();
            var        query = db.IceTypes.ToList();

            var result = new List <SelectListItem>();

            foreach (var item in query)
            {
                result.Add(
                    new SelectListItem {
                    Text = item.IceName, Value = item.ID.ToString()
                }
                    );
            }

            db.Dispose();
            return(result);
        }
Beispiel #30
0
        //取出購買飲料細項ViewModel
        public static BuyDMDrinkView GetBuyDMDrinkView_MenuIDdrinkID(int MenuID, int DrinkID)
        {
            NewDrinkDB db        = new NewDrinkDB();
            var        DrinkName = db.MenuDrinks.Find(DrinkID);

            var mySize = DrinkSize(MenuID, DrinkID);

            var result = new BuyDMDrinkView()
            {
                MenuID    = MenuID,
                DrinkID   = DrinkID,
                DrinkName = DrinkName.DrinkName,
                Bathus    = DrinkName.Bathus,
                SizeType  = mySize,
                Quantity  = 1
            };

            db.Dispose();
            return(result);
        }