Esempio n. 1
0
        private bool getGroupDetail()
        {
            bool ret = false;
            //JArray groupData=null;
            JObject groupData = null;

            ret = RestClient.getMenuCombodish(dishinfo.Dishid, dishinfo.Menuid, out groupData);
            if (!ret)
            {
                Warning("获取套餐信息失败!");
                return(false);
            }
            comboDish = TComboDish.parse(groupData);
            ret       = true;
            return(ret);
        }
Esempio n. 2
0
        public static bool ShowCombodish(t_shopping dishinfo, TComboDish comboDish)
        {
            frmCombodish frm = new frmCombodish();

            frm.comboDish = comboDish;
            frm.dishinfo  = dishinfo;
            if (!frm.getGroupDetail())
            {
                return(false);
            }
            frm.comboDish.Dishinfo = dishinfo;
            frm.initView();
            frm.ShowDialog();
            bool ret = frm.DialogResult == DialogResult.OK;

            //potDishInfo = frm.potDishInfo;
            return(ret);
        }
Esempio n. 3
0
        private void addDish(JObject ja)
        {
            ///增加菜品到购物车
            if (ja == null)
            {
                return;
            }
            //如果是多单位的要选择单位
            string userid = Globals.CurrOrderInfo.userid;

            if (userid == null)
            {
                userid = Globals.UserInfo.UserID;
            }
            t_shopping dishinfo = new t_shopping();

            dishinfo.Orderid     = Globals.CurrOrderInfo.orderid;
            dishinfo.Userid      = userid;// Globals.UserInfo.UserID;
            dishinfo.Ordertime   = DateTime.Now;
            dishinfo.Orderstatus = 0;
            dishinfo.Dishnum     = 1;
            dishinfo.Tableid     = Globals.CurrTableInfo.tableNo;
            dishinfo.Dishid      = ja["dishid"].ToString();
            dishinfo.Avoid       = "";
            dishinfo.Dishidleft  = 1;
            dishinfo.Title       = InternationaHelper.GetBeforeSeparatorFlagData(ja["title"].ToString());
            dishinfo.DishType    = ja["dishtype"].ToString();
            dishinfo.DishUnitSrc = ja["unit"].ToString();
            dishinfo.Weigh       = int.Parse(ja["weigh"].ToString());
            dishinfo.Memberprice = 0;
            dishinfo.Level       = "0";
            try
            {
                dishinfo.Level = ja["level"].ToString();
            }
            catch { }
            if (Globals.CurrOrderInfo.memberno == null)
            {
                Globals.CurrOrderInfo.memberno = "";
            }
            bool    ismember = Globals.CurrOrderInfo.memberno.Length > 0;
            decimal price    = 0;
            string  pricestr = "";

            pricestr = ja["vipprice"].ToString(); //可能还会有多单位的问题
            if (pricestr.Equals("") || pricestr.Equals(""))
            {
                pricestr = ja["price"].ToString();
            }
            dishinfo.Memberprice = strtofloat(pricestr);
            pricestr             = ja["price"].ToString();
            dishinfo.Price2      = strtofloat(pricestr);
            if (dishinfo.Memberprice <= 0)
            {
                dishinfo.Memberprice = dishinfo.Price2;
            }
            if (ismember)
            {
                price = dishinfo.Memberprice;
            }
            else
            {
                price = dishinfo.Price2;
            }
            dishinfo.Price = price;

            dishinfo.Amount = 0;
            dishinfo.Source = ja["source"].ToString();
            int dishStatus = RestClient.getFoodStatus(dishinfo.Dishid, dishinfo.Dishunit);

            if (dishStatus == 1)
            {
                Warning("选择的菜品已沽清!");
                return;
            }
            //
            if (dishinfo.DishType.Equals("2"))
            {
                //套餐getMenuCombodish
                dishinfo.Menuid = menuid;
                TComboDish comboDish = null;
                if (frmCombodish.ShowCombodish(dishinfo, comboDish))//, out potDishInfo
                {
                }
            }
            else
            if (dishinfo.DishType.Equals("1"))     ////如果是鱼锅
            {
                TPotDishInfo potDishInfo;
                //如果level=1是新双拼类型鱼锅
                if (dishinfo.Level.Equals("1"))
                {
                    //显示新双拼选择界面

                    return;
                }
                if (frmFish.ShowFish(dishinfo, out potDishInfo))
                {
                    potDishInfo.PotInfo.Orderid               = Globals.CurrOrderInfo.orderid;
                    potDishInfo.PotInfo.Userid                = userid;// Globals.UserInfo.UserID;
                    potDishInfo.PotInfo.Ordertime             = DateTime.Now;
                    potDishInfo.PotInfo.Orderstatus           = 0;
                    potDishInfo.PotInfo.Tableid               = Globals.CurrTableInfo.tableNo;
                    potDishInfo.PotInfo.Primarydishtype       = 1;
                    potDishInfo.FishDishInfo1.Orderid         = Globals.CurrOrderInfo.orderid;
                    potDishInfo.FishDishInfo1.Userid          = userid;// Globals.UserInfo.UserID;
                    potDishInfo.FishDishInfo1.Ordertime       = DateTime.Now;
                    potDishInfo.FishDishInfo1.Orderstatus     = 0;
                    potDishInfo.FishDishInfo1.Tableid         = Globals.CurrTableInfo.tableNo;
                    potDishInfo.FishDishInfo1.Primarydishtype = 1;
                    dishinfo.Dishnum                      = 1;
                    dishinfo.Parentdishid                 = potDishInfo.PotInfo.Parentdishid;
                    dishinfo.Groupid                      = potDishInfo.PotInfo.Groupid;
                    dishinfo.DishUnitSrc                  = "份";
                    dishinfo.Orderstatus                  = 0;
                    potDishInfo.PotInfo.Orderstatus       = 2;
                    potDishInfo.FishDishInfo1.Orderstatus = 3;
                    dishinfo.Ordertype                    = 1;
                    dishinfo.Primarydishtype              = 1;
                    t_shopping.add(ref Globals.ShoppTable, dishinfo, true);
                    potDishInfo.PotInfo.Ordertype = 1;
                    t_shopping.add(ref Globals.ShoppTable, potDishInfo.PotInfo, true);
                    potDishInfo.FishDishInfo1.Ordertype = 1;
                    t_shopping.add(ref Globals.ShoppTable, potDishInfo.FishDishInfo1, true);
                    if (potDishInfo.FishDishInfo2 != null)
                    {
                        potDishInfo.FishDishInfo2.Orderid         = Globals.CurrOrderInfo.orderid;
                        potDishInfo.FishDishInfo2.Userid          = userid;// Globals.UserInfo.UserID;
                        potDishInfo.FishDishInfo2.Ordertime       = DateTime.Now;
                        potDishInfo.FishDishInfo2.Tableid         = Globals.CurrTableInfo.tableNo;
                        potDishInfo.FishDishInfo2.Orderstatus     = 3;
                        potDishInfo.FishDishInfo2.Ordertype       = 1;
                        potDishInfo.FishDishInfo2.Primarydishtype = 1;
                        t_shopping.add(ref Globals.ShoppTable, potDishInfo.FishDishInfo2, true);
                    }
                }
            }
            else
            {
                dishinfo.Ordertype       = 0;
                dishinfo.Primarydishtype = 0;
                t_shopping.add(ref Globals.ShoppTable, dishinfo, false);
            }
            //通知调用页更新页面
            OnShoppingChange();
        }