示例#1
0
        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 + "]");
        }
示例#2
0
        private static string GetConfirmText(int QID, int OID, string UserIDorClubIDorOrderID)
        {
            OrderInfo orderInfo;

            switch (QID)
            {
            case 52:
                orderInfo         = new OrderInfo();
                orderInfo.OrderID = UserIDorClubIDorOrderID;
                orderInfo.SelectMyOrderNameByOrderID();
                return($"確定要刪除:{orderInfo.OrderName} 嗎???");



            case 61:
                switch (OID)
                {
                case 2:
                    OrderTemp orderTemp = new OrderTemp(UserIDorClubIDorOrderID);
                    orderTemp.SelectByUserID();
                    return($"請確認將開單時間修改為:{orderTemp.StartTime.ToString("yyyy-MM-dd HH:mm")},結單時間修改為:{orderTemp.EndTime.ToString("yyyy-MM-dd HH:mm")} 嗎???");

                default:
                    break;
                }
                break;

            case 102:
                switch (OID)
                {
                case 1:
                    ClubInfo clubInfo = new ClubInfo();
                    clubInfo.ClubID = UserIDorClubIDorOrderID;         // 這裡用ClubID
                    return($"確定離開 {clubInfo.SelectByClubid()[0].ClubName} 嗎???");

                default:
                    break;
                }
                break;

            case 152:
                orderInfo         = new OrderInfo();
                orderInfo.OrderID = UserIDorClubIDorOrderID;
                orderInfo.SelectClubOrderNameByOrderID();
                return($"確定要刪除:{orderInfo.OrderName} 嗎???");


            case 161:
                switch (OID)
                {
                case 2:
                    OrderTemp orderTemp = new OrderTemp(UserIDorClubIDorOrderID);
                    orderTemp.SelectByUserID();
                    return($"請確認將開單時間修改為:{orderTemp.StartTime.ToString("yyyy-MM-dd HH:mm")},結單時間修改為:{orderTemp.EndTime.ToString("yyyy-MM-dd HH:mm")} 嗎???");

                default:
                    break;
                }
                break;

            case 171:
                switch (OID)
                {
                case 7:
                    ShopTemp shopTemp = new ShopTemp(UserIDorClubIDorOrderID);         // 這裡用UserID
                    shopTemp.GetMyShopTempInfoFromSQL();
                    List <ShopTemp> shopItems = shopTemp.GetShopItemTempFromSQL();

                    string confirmText1 = $"請確認建立商店資訊:" +
                                          $"商店名稱:{shopTemp.ShopName}," +
                                          $"商店電話:{shopTemp.ShopPhone}," +
                                          $"商店地址:{shopTemp.ShopAddress},商店品項:";

                    string confirmText2 = "";
                    for (int i = 0; i < shopItems.Count; i++)
                    {
                        confirmText2 += $"{shopItems[i].ShopItem}({shopItems[i].ShopItemPrice} TWD) ";
                    }

                    return(confirmText1 + confirmText2);

                default:
                    break;
                }
                break;

            case 201:
                switch (OID)
                {
                case 3:
                    return($"確定建立嗎???");

                default:
                    break;
                }
                break;


            case 211:
                switch (OID)
                {
                case 3:
                    return($"要繼續選擇商店嗎???");

                default:
                    break;
                }
                break;

            case 231:
                switch (OID)
                {
                case 3:
                    ShopInfo shopInfo = new ShopInfo();
                    shopInfo.ShopID = UserIDorClubIDorOrderID;
                    shopInfo.SelectMyShopNameByShopID();
                    if (shopInfo.ShopName != null)
                    {
                        return($"確定將此訂單商店換成 {shopInfo.ShopName} 嗎???");
                    }
                    else
                    {
                        List <ShopInfo> shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                        return($"確定將此訂單商店換成 {shopInfos[0].ShopName} 嗎???");
                    }

                default:
                    break;
                }
                return("");


            case 241:
                switch (OID)
                {
                case 3:
                    return($"確定建立嗎???");

                default:
                    break;
                }
                break;

            case 251:
                switch (OID)
                {
                case 3:
                    return($"要繼續選擇商店嗎???");

                default:
                    break;
                }
                break;

            case 261:
                switch (OID)
                {
                case 3:
                    ShopInfo shopInfo = new ShopInfo();
                    shopInfo.ShopID = UserIDorClubIDorOrderID;
                    shopInfo.SelectMyShopNameByShopID();
                    if (shopInfo.ShopName != null)
                    {
                        return($"確定將此訂單商店換成 {shopInfo.ShopName} 嗎???");
                    }
                    else
                    {
                        List <ShopInfo> shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                        return($"確定將此訂單商店換成 {shopInfos[0].ShopName} 嗎???");
                    }

                default:
                    break;
                }
                return("");

            case 121:
                switch (OID)
                {
                case 5:
                    return("需要繼續修改其他品項嗎?");

                default:
                    break;
                }
                break;

            case 271:
                switch (OID)
                {
                case 7:
                    ShopTemp shopTemp = new ShopTemp(UserIDorClubIDorOrderID);         // 這裡用UserID
                    shopTemp.GetClubShopTempInfoFromSQL();
                    List <ShopTemp> shopItems = shopTemp.GetShopItemTempFromSQL();

                    string confirmText1 = $"請確認建立社團商店資訊:" +
                                          $"商店名稱:{shopTemp.ShopName}," +
                                          $"商店電話:{shopTemp.ShopPhone}," +
                                          $"商店地址:{shopTemp.ShopAddress},商店品項:";

                    string confirmText2 = "";
                    for (int i = 0; i < shopItems.Count; i++)
                    {
                        confirmText2 += $"{shopItems[i].ShopItem}({shopItems[i].ShopItemPrice} TWD) ";
                    }

                    return(confirmText1 + confirmText2);



                default:
                    break;
                }
                break;

            default:
                break;
            }
            return("");
        }