public static TCombo parsecombo(JObject ja) { TCombo combo = new TCombo(); combo.Startnum = int.Parse(ja["startnum"].ToString()); combo.Endnum = int.Parse(ja["endnum"].ToString()); combo.Status = ja["status"].ToString(); combo.Columnname = ja["columnname"].ToString(); combo.Ordernum = float.Parse(ja["ordernum"].ToString()); combo.Columnid = ja["columnid"].ToString(); combo.Id = ja["id"].ToString(); combo.Dishid = ja["dishid"].ToString(); combo.ItemDesc = ja["itemDesc"].ToString(); JArray jr = (JArray)ja["alldishes"]; for (int i = 0; i <= jr.Count - 1; i++) { JObject jacombo = (JObject)jr[i]; string dishes = jacombo["dishes"].ToString(); if (dishes == null) { dishes = ""; } if (dishes.Length > 0) { //鱼锅 TPotDishInfo potinfo = parseonlyPot(jacombo); combo.Dishs.Add(potinfo); } else { t_shopping dishinfo = parseonly(jacombo, false); combo.Dishs.Add(dishinfo); } } return(combo); }
public static TComboDish parse(JObject jaData) { TComboDish combodish = new TComboDish(); JArray jronly = (JArray)jaData["only"]; JArray jrcombo = (JArray)jaData["combo"]; //必选 for (int i = 0; i <= jronly.Count - 1; i++) { //如果是单品 dishes JObject ja = (JObject)jronly[i]; string dishes = ja["dishes"].ToString(); if (dishes == null) { dishes = ""; } if (dishes.Length > 0) { //鱼锅 TPotDishInfo potinfo = parseonlyPot(ja); combodish.Onlydishs.Add(potinfo); } else { t_shopping dishinfo = parseonly(ja, false); combodish.Onlydishs.Add(dishinfo); } } //几选几 for (int i = 0; i <= jrcombo.Count - 1; i++) { TCombo combo = parsecombo((JObject)jrcombo[i]); combodish.Combodishs.Add(combo); } return(combodish); }