コード例 #1
0
ファイル: FlexMaker.cs プロジェクト: OTL90104/OrderBOT
        internal static string MakeShopItem(string UserID, int QID, int OID, string shopID)
        {
            List <ShopInfo> shopInfos = new List <ShopInfo>();
            List <ShopItem> shopItems = new List <ShopItem>();;
            ShopInfo        shopInfo  = new ShopInfo();
            ShopItem        shopItem;

            shopInfo.ShopID = shopID;
            switch (QID)
            {
            case 201:
                shopInfos = shopInfo.MyShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByMyShopID();
                break;

            case 202:
                shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByBossShopID();
                break;

            case 211:
                shopInfos = shopInfo.MyShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByMyShopID();
                break;

            case 212:
                shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByBossShopID();
                break;

            case 231:
                shopInfos = shopInfo.MyShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByMyShopID();
                break;

            case 232:
                shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByBossShopID();
                break;

            case 241:
                shopInfos = shopInfo.ClubShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByClubShopID();
                break;

            case 242:
                shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByBossShopID();
                break;

            case 251:
                shopInfos = shopInfo.ClubShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByClubShopID();
                break;

            case 252:
                shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByBossShopID();
                break;

            case 261:
                shopInfos = shopInfo.ClubShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByClubShopID();
                break;

            case 262:
                shopInfos = shopInfo.BossShopSelectShopNameByShopid();
                shopItem  = new ShopItem(shopID);
                shopItems = shopItem.SelectByBossShopID();
                break;

            default:
                break;
            }



            FlexBublbe flexBublbe = new FlexBublbe();

            flexBublbe.contents.contents[0].body.contents[1].text = shopInfos[0].ShopName;


            flexBublbe.contents.contents[0].body.contents[3].contents = new List <FlexBublbe.Content>();
            FlexBublbe.Content content = new FlexBublbe.Content();



            foreach (ShopItem shopItemm in shopItems)
            {
                content        = new FlexBublbe.Content();
                content.type   = "box";
                content.layout = "horizontal";
                //flexBublbe.contents.contents[0].body.contents[3].contents.Add(content);
                ShopItemText shopItemText = new ShopItemText();
                shopItemText.type  = "text";
                shopItemText.text  = shopItemm.shopItem;
                shopItemText.size  = "md";
                shopItemText.color = "#111111";
                content.contents.Add(shopItemText);
                shopItemText       = new ShopItemText();
                shopItemText.type  = "text";
                shopItemText.text  = shopItemm.ShopItemPrice.ToString("0.##") + "  TWD";
                shopItemText.size  = "md";
                shopItemText.color = "#111111";
                shopItemText.align = "end";
                content.contents.Add(shopItemText);
                flexBublbe.contents.contents[0].body.contents[3].contents.Add(content);
            }

            flexBublbe.contents.contents[0].body.contents.Add(new PartitionLine());

            //底下Btn
            FooterBtn      footerBtn      = new FooterBtn();
            NextHelper     nextHelper     = new NextHelper(QID, OID);
            QuestionDetail questionDetail = nextHelper.GetNext();

            footerBtn.contents[0].action.data = $"{DateTime.Now},{questionDetail.QID},{questionDetail.OID},{shopID}";
            PreviousHelper previousHelper = new PreviousHelper(QID, OID);

            questionDetail = previousHelper.GetPrevious();
            footerBtn.contents[1].action.data = $"{DateTime.Now},{questionDetail.QID},{questionDetail.OID},{shopID}";
            flexBublbe.contents.contents[0].body.contents.Add(footerBtn);



            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.NullValueHandling = NullValueHandling.Ignore;
            var json = JsonConvert.SerializeObject(flexBublbe, settings);

            //  string json = JsonConvert.SerializeObject(flexBublbe);

            return("[" + json + "]");
        }
コード例 #2
0
ファイル: ConfirmMaker.cs プロジェクト: OTL90104/OrderBOT
        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("");
        }