internal static string MakeSearchingItem(int QIDnow, int OIDnow, string UserID) { // 從OrderTemp裡面拿到OrderPartitionID OrderTemp orderTemp = new OrderTemp(UserID); orderTemp.SelectByUserID(); // 用OrderPartitionID去找到ShopID,再用ShopID找到ShopItem OrderInfo orderInfo = new OrderInfo(UserID); orderInfo.OrderPartitionID = orderTemp.OrderPartitionID; string OrderPartitionIDSplitted = orderTemp.OrderPartitionID.Substring(0, 2); switch (OrderPartitionIDSplitted) { case "MO": // MyOrder orderInfo.SelectMyOrderTableByOrderPartitionID(); break; case "CO": // ClubOrder orderInfo.SelectClubOrderTableByOrderPartitionID(); break; default: break; } //NextHelper nextHelper = new NextHelper(QIDnow, OIDnow); //QuestionDetail questionDetailNext = nextHelper.GetNext(); //PreviousHelper previousHelper = new PreviousHelper(QIDnow, OIDnow); //QuestionDetail questionDetailPrevious = previousHelper.GetPrevious(); //CancelHelper cancelHelper = new CancelHelper(QIDnow, OIDnow); //QuestionDetail questionDetailCancel = cancelHelper.GetCancel(); ShopItem shopItem = new ShopItem(orderInfo.ShopID); List <ShopItem> myshopItems = shopItem.SelectByMyShopID(); List <ShopItem> bossshopItems = shopItem.SelectByBossShopID(); List <ShopItem> clubshopItems = shopItem.SelectByClubShopID(); ShopInfo shopInfo = new ShopInfo(); shopInfo.ShopID = orderInfo.ShopID; string OrderShopName; ShopImage shopImage = new ShopImage(orderInfo.ShopID); List <string> BossShopimagesUris = shopImage.SelectImageByShopID(); //抓出該商店的圖片 ShuffleImage(BossShopimagesUris); //隨機洗亂 ///// string DefaultUri = "https://i220.photobucket.com/albums/dd130/jung_04/GJ.gif"; //Flex圖片超連結 int ButtonControl = 4; //設定Button數量 ///// int ButtonCount = 0; //控制Button數量 FlexPushOrderMenu flexPushOrderMenu = new FlexPushOrderMenu(); if (myshopItems.Count > 0) { shopInfo.SelectMyShopNameByShopID(); OrderShopName = shopInfo.ShopName; int BubbleCount = 0; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.StartTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 foreach (ShopItem item in myshopItems) { if (ButtonCount >= ButtonControl) { ButtonCount = 0; BubbleCount++; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 } flexPushOrderMenu.contents.contents[BubbleCount].footer.contents.Add(new FlexPushOrderMenu.OrderButton(item.shopItem, item.ShopItemPrice)); flexPushOrderMenu.contents.contents[BubbleCount].footer.contents[ButtonCount].action.data = DateTime.Now.Add((orderInfo.EndTime - orderInfo.StartTime).Add(new TimeSpan(0, -5, 0)))//主程式檢查按鈕有效時間為5分鐘 + "," + 9999 + "," + 2 + "," + orderInfo.OrderPartitionID + "," + item.shopItem + "," + item.ShopItemPrice; ButtonCount++; } } if (bossshopItems.Count > 0) { if (bossshopItems.Count >= BossShopimagesUris.Count * ButtonControl) { int NeedAddcount = bossshopItems.Count - BossShopimagesUris.Count; for (int i = 0; i <= NeedAddcount; i++) { BossShopimagesUris.Add(BossShopimagesUris[i]); } } shopInfo.SelectBossShopNameByShopID(); OrderShopName = shopInfo.ShopName; int BubbleCount = 0; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(BossShopimagesUris[0])); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 foreach (ShopItem item in bossshopItems) { if (ButtonCount >= ButtonControl) { ButtonCount = 0; BubbleCount++; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(BossShopimagesUris[BubbleCount])); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 } flexPushOrderMenu.contents.contents[BubbleCount].footer.contents.Add(new FlexPushOrderMenu.OrderButton(item.shopItem, item.ShopItemPrice)); flexPushOrderMenu.contents.contents[BubbleCount].footer.contents[ButtonCount].action.data = DateTime.Now.Add((orderInfo.EndTime - orderInfo.StartTime).Add(new TimeSpan(0, -5, 0)))//主程式檢查按鈕有效時間為5分鐘 + "," + 9999 + "," + 2 + "," + orderInfo.OrderPartitionID + "," + item.shopItem + "," + item.ShopItemPrice; ButtonCount++; } } if (clubshopItems.Count > 0) { shopInfo.SelectClubShopNameByShopID(); OrderShopName = shopInfo.ShopName; int BubbleCount = 0; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 foreach (ShopItem item in clubshopItems) { if (ButtonCount >= ButtonControl) { ButtonCount = 0; BubbleCount++; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 } flexPushOrderMenu.contents.contents[BubbleCount].footer.contents.Add(new FlexPushOrderMenu.OrderButton(item.shopItem, item.ShopItemPrice)); flexPushOrderMenu.contents.contents[BubbleCount].footer.contents[ButtonCount].action.data = DateTime.Now.Add((orderInfo.EndTime - orderInfo.StartTime).Add(new TimeSpan(0, -5, 0)))//主程式檢查按鈕有效時間為5分鐘 + "," + 9999 + "," + 2 + "," + orderInfo.OrderPartitionID + "," + item.shopItem + "," + item.ShopItemPrice; ButtonCount++; } } JsonSerializerSettings settings = new JsonSerializerSettings(); settings.NullValueHandling = NullValueHandling.Ignore; var json = JsonConvert.SerializeObject(flexPushOrderMenu, settings); return("[" + json + "]"); }