Пример #1
0
        public GetMenuResponse2 GetMenu2()
        {
            Utils.ToCardLog("AlohaExternal GetMenu");
            GetMenuResponse2 Tmp = ConvertMenu(AlohaTSClass.CurentAlohaMnu);

            return(Tmp);
        }
Пример #2
0
        private GetMenuResponse2 ConvertMenu(StopListService.AlohaMnu Mnu)
        {
            GetMenuResponse2 Tmp    = new GetMenuResponse2();
            AlohaMnuExt      MnuExt = new AlohaMnuExt();

            MnuExt.DepId   = Mnu.Dep;
            MnuExt.SubMnus = new List <AlohaSubMnuExt>();
            Tmp.Mnus       = new List <AlohaMnuExt>();
            Tmp.Mnus.Add(MnuExt);
            if (Mnu.Smnus == null)
            {
                return(Tmp);
            }
            foreach (StopListService.AlohaSMnu Smnu in Mnu.Smnus)
            {
                AlohaSubMnuExt AlSmnu = new AlohaSubMnuExt()
                {
                    LongName = Smnu.Name,
                    Id       = Smnu.Id,
                    Items    = new List <AlohaItemExt> ()
                };
                if (Smnu.Dishes == null)
                {
                    continue;
                }
                foreach (StopListService.AlohaDish ad in Smnu.Dishes)
                {
                    AlohaItemExt itm = new AlohaItemExt()
                    {
                        LongName  = ad.Name,
                        Id        = ad.BarCode,
                        Price     = (int)(ad.Price * 100),
                        EngName   = ad.EngName,
                        ModGroups = new List <AlohaModGroupeExt> ()
                    };

                    foreach (StopListService.AlohaModGroupe AlModGr in ad.ModGroups)
                    {
                        AlohaModGroupeExt NAlohaGr = new AlohaModGroupeExt()
                        {
                            Id       = AlModGr.Id,
                            LongName = AlModGr.Name,
                            Mods     = new List <AlohaModExt> ()
                        };



                        foreach (StopListService.AlohaMod Nm in AlModGr.Mods)
                        {
                            AlohaModExt NMod = new AlohaModExt()
                            {
                                Id       = Nm.BarCode,
                                LongName = Nm.Name,
                                Price    = (int)(Nm.Price * 100),
                            };
                            NAlohaGr.Mods.Add(NMod);
                        }



                        itm.ModGroups.Add(NAlohaGr);
                    }
                    AlSmnu.Items.Add(itm);
                }

                MnuExt.SubMnus.Add(AlSmnu);
            }

            return(Tmp);
        }