//取得錯誤返回值(NewMenu) public static NewMenu ErrorBackMenu(NewMenu menu) { menu.Sweet = FirstGetSweet(); menu.Size = FirstGetSize(); menu.IceHot = FirstGetIce(); return(menu); }
//判斷加料金額不為負值 public static int PriceIsNotSmall(NewMenu newM) { int Price = 0; foreach (var item in newM.AddItemCreate) { if (item.LPrice < 0 || item.MPrice < 0 || item.SPrice < 0) { Price = -1; break; } Price = 1; } return(Price); }
//將甜度,冰度,尺寸加入陣列 public static List <int> CheckCheckboxNotEmpty(NewMenu newM, string type) { var addItem = new List <int>(); switch (type) { case "sweet": foreach (var item in newM.Sweet) { if (item.Selected) { //加到陣列 var DD = Int32.Parse(item.Value); addItem.Add(DD); } else { //跳過 continue; } } break; case "ice": foreach (var item in newM.IceHot) { if (item.Selected) { //加到陣列 var DD = Int32.Parse(item.Value); addItem.Add(DD); } else { //跳過 continue; } } break; case "size": foreach (var item in newM.Size) { if (item.Selected) { //加到陣列 var DD = Int32.Parse(item.Value); addItem.Add(DD); } else { //跳過 continue; } } break; default: break; } return(addItem); }