コード例 #1
0
ファイル: SQLCommunicator.cs プロジェクト: OTL90104/OrderBOT
        internal static string CommunicateClubShop(string UserID, int QID, int OID, string channelAccessToken)
        {
            // 取得ShopTemp裡的資料:ShopName, ShopPhone, ShopAddress, ClubID
            ShopTemp shopTemp = new ShopTemp(UserID);

            shopTemp.GetClubShopTempInfoFromSQL();

            // 先用時間和UserID製作ShopID,因為是ClubShop所以前面加上CS
            shopTemp.ShopID = $"CS{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{shopTemp.ClubID}";

            // 取得ShopItemTemp裡的資料:ShopItem, ShopItemPrice
            List <ShopTemp> shopItemList = shopTemp.GetShopItemTempFromSQL();

            // 把資料存進各個資料表
            int result = 0;

            result = shopTemp.InsertAllClubShopData(shopItemList);
            if (result > 0)
            {
                shopTemp.InitializeShopTempByUserID();
                shopTemp.DeleteShopItemTempByUserID();

                UserStatus userStatus = new UserStatus(UserID);
                userStatus.InitializeUserStatusByUserID();
                return("商店建立成功");
            }
            else
            {
                return("商店建立失敗");
            }
        }
コード例 #2
0
ファイル: FollowManager.cs プロジェクト: OTL90104/OrderBOT
        internal void process(Event item, ReceievedMessage receivedMessage, string channelAccessToken, Bot bot)
        {
            string     userDisplayName = isRock.LineBot.Utility.GetUserInfo(item.source.userId, channelAccessToken).displayName;
            UserStatus userStatus      = new UserStatus(item.source.userId, userDisplayName);

            userStatus.InitializeByUserID();

            PeriodOrderTmp periodOrderTmp = new PeriodOrderTmp(item.source.userId);

            periodOrderTmp.InsertInitialPeriodOrderTmp();

            OrderTemp orderTmp = new OrderTemp(item.source.userId);

            orderTmp.InsertInitialOrderTmp();

            ShopTemp shopTemp = new ShopTemp(item.source.userId);

            shopTemp.InsertInitialShopTemp();
        }
コード例 #3
0
ファイル: SQLCommunicator.cs プロジェクト: OTL90104/OrderBOT
        internal static string CommunicateShopAddressUpdate(string UserID, int QID, int OID, string channelAccessToken)
        {
            // 先拿到存在ShopTemp裡面的ShopPhone
            ShopTemp shopTemp = new ShopTemp(UserID);

            shopTemp.SelectByUserID();

            // 拿到存在UserStatus裡的TempData,目前裡面是前一步輸入的ShopID
            UserStatus userStatus = new UserStatus(UserID);

            userStatus.SelectByUserID();

            ShopInfo shopInfo = new ShopInfo();
            int      result   = 0;

            // 分成MyShop跟ClubShop兩種update方法
            switch (QID)
            {
            case 193:
                shopInfo.ShopAddress = shopTemp.ShopAddress;
                result = shopInfo.UpdateMyShopAddressByShopID(shopTemp.ShopID);
                break;

            case 293:
                shopInfo.ShopAddress = shopTemp.ShopAddress;
                result = shopInfo.UpdateClubShopAddressByShopID(userStatus.TempData);
                break;

            default:
                break;
            }

            if (result > 0)
            {
                userStatus.InitializeUserStatusByUserID();
                shopTemp.InitializeShopTempByUserID();
                return("商店地址修改成功");
            }
            else
            {
                return("商店地址修改失敗");
            }
        }
コード例 #4
0
ファイル: SQLCommunicator.cs プロジェクト: OTL90104/OrderBOT
        internal static string CommunicateDeleteShop(string UserID, int QID, int OID, string channelAccessToken)
        {
            // 先從ShopTemp取得ClubID和ShopID
            ShopTemp shopTemp = new ShopTemp(UserID);

            shopTemp.SelectByUserID();

            ShopInfo   shopInfo;
            UserStatus userStatus = new UserStatus(UserID);
            int        result     = 0;

            // 分成MyShop跟ClubShop兩種delete方法
            switch (QID)
            {
            case 182:
                shopInfo = new ShopInfo(UserID);
                result   = shopInfo.DeleteMyShopByUserIDandShopID(shopTemp.ShopID);
                break;

            case 282:
                shopInfo = new ShopInfo(shopTemp.ClubID);
                result   = shopInfo.DeleteClubShopByClubIDandShopID(shopTemp.ShopID);
                break;

            default:
                break;
            }
            if (result > 0)
            {
                userStatus.InitializeUserStatusByUserID();
                shopTemp.InitializeShopTempByUserID();
                return("商店刪除成功");
            }
            else
            {
                return("商店刪除失敗");
            }
        }
コード例 #5
0
ファイル: MessageMaker.cs プロジェクト: OTL90104/OrderBOT
        internal static string make(string UserID, int QIDnow, int OIDnow, string data)
        {
            NextHelper     nextHelper         = new NextHelper(QIDnow, OIDnow);
            QuestionDetail questionDetailNext = nextHelper.GetNext();

            //如果是取得參加碼,直接回傳藏在postback裡的data
            if (QIDnow == 101 && OIDnow == 1)
            {
                return(data);
            }
            else if (QIDnow == 73 && OIDnow == 2)
            {
                return(data);
            }
            else if (QIDnow == 53 && OIDnow == 1)
            {
                return(data);
            }
            else if (QIDnow == 153 && OIDnow == 1)
            {
                return(data);
            }
            else if (QIDnow == 9998)
            {
                switch (data)
                {
                case "accept":
                    return("已向訂購者傳送確認訊息!");

                case "refuse":
                    return("已向訂購者傳送婉拒訊息!");

                default:
                    break;
                }
            }
            QuestionDetail        questionDetail     = new QuestionDetail(QIDnow, OIDnow);
            List <QuestionDetail> questionDetailList = questionDetail.SelectByQidAndOid();

            switch (QIDnow)
            {
            case 121:
                UserStatus userStatustemp = new UserStatus(UserID);
                userStatustemp.SelectByUserID();
                data = userStatustemp.TempData;
                break;

            default:
                break;
            }
            UserStatus userStatus = new UserStatus(UserID, questionDetailNext.QID, questionDetailNext.OID, data);

            userStatus.UpdateByUserID();

            // 先偷做一些事情
            switch (QIDnow)
            {
            case 71:
                switch (OIDnow)
                {
                case 3:
                    // 把UserID加入訂單

                    break;

                default:
                    break;
                }
                break;

            case 194:
                switch (OIDnow)
                {
                case 2:
                    // 改品項的時候要先記錄改之前的品項到ShopTemp,之後才知道要改哪一筆
                    ShopTemp shopTemp = new ShopTemp(UserID);
                    shopTemp.ShopItem = data;
                    shopTemp.UpdateItemToShopTemp();
                    break;

                case 6:
                    // 清空
                    shopTemp = new ShopTemp(UserID);
                    shopTemp.InitializeShopTempByUserID();
                    shopTemp.DeleteShopItemTempByUserID();
                    userStatus.InitializeUserStatusByUserID();
                    break;

                default:
                    break;
                }
                break;

            case 294:
                switch (OIDnow)
                {
                case 2:
                    // 改品項的時候要先記錄改之前的品項到ShopTemp,之後才知道要改哪一筆
                    ShopTemp shopTemp = new ShopTemp(UserID);
                    shopTemp.ShopItem = data;
                    shopTemp.UpdateItemToShopTemp();
                    break;

                case 6:
                    // 清空
                    shopTemp = new ShopTemp(UserID);
                    shopTemp.InitializeShopTempByUserID();
                    shopTemp.DeleteShopItemTempByUserID();
                    userStatus.InitializeUserStatusByUserID();
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }

            return(questionDetailList[0].AnswerOption);
        }
コード例 #6
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("");
        }
コード例 #7
0
ファイル: ImagemapMaker.cs プロジェクト: OTL90104/OrderBOT
        internal static ImagemapMessage MakeMenu(Event item)
        {
            // 先做初始化
            UserStatus userStatus = new UserStatus(item.source.userId);

            userStatus.InitializeUserStatusByUserID();
            ShopTemp shopTemp = new ShopTemp(item.source.userId);

            shopTemp.InitializeShopTempByUserID();
            shopTemp.DeleteShopItemTempByUserID();
            OrderTemp orderTemp = new OrderTemp(item.source.userId);

            orderTemp.UpdateInitialOrderTemp();
            PeriodOrderTmp periodOrderTmp = new PeriodOrderTmp(item.source.userId);

            periodOrderTmp.UpdateInitialPeriodOrderTmp();
            ShopListTemp shopListTemp = new ShopListTemp(item.source.userId);

            shopListTemp.DeleteByUserID();
            BuyerTemp buyerTemp = new BuyerTemp(item.source.userId);

            buyerTemp.DeleteByBuyerID();
            // 先做初始化


            ImagemapMessage imagemapMessage = new ImagemapMessage();

            Uri uri = new Uri("https://i220.photobucket.com/albums/dd130/jung_04/Menu2.png#");

            imagemapMessage.baseUrl = uri;
            imagemapMessage.altText = "這是imagemap";
            Size size = new Size(1040, 1040);

            imagemapMessage.baseSize = size;

            #region LeftUp
            isRock.LineBot.ImagemapArea imagemapAreaLeftUp = new isRock.LineBot.ImagemapArea()
            {
                x      = 0,
                y      = 0,
                width  = 520,
                height = 520
            };
            isRock.LineBot.ImagemapMessageAction imagemapMessageActionLeftUp = new ImagemapMessageAction();

            imagemapMessageActionLeftUp.area = imagemapAreaLeftUp;
            imagemapMessageActionLeftUp.text = "我要進入訂單模式!!!";

            imagemapMessage.actions.Add(imagemapMessageActionLeftUp);


            #endregion
            #region RightUp
            isRock.LineBot.ImagemapArea imagemapAreaRightUp = new isRock.LineBot.ImagemapArea()
            {
                x      = 520,
                y      = 0,
                width  = 520,
                height = 520
            };

            isRock.LineBot.ImagemapMessageAction imagemapMessageActionRightUp = new ImagemapMessageAction();

            imagemapMessageActionRightUp.area = imagemapAreaRightUp;
            imagemapMessageActionRightUp.text = "我要進入個人模式!!!";

            imagemapMessage.actions.Add(imagemapMessageActionRightUp);

            #endregion
            #region LeftDown
            isRock.LineBot.ImagemapArea imagemapAreaLeftDown = new isRock.LineBot.ImagemapArea()
            {
                x      = 0,
                y      = 520,
                width  = 520,
                height = 520
            };

            isRock.LineBot.ImagemapMessageAction imagemapMessageActionLeftDown = new ImagemapMessageAction();

            imagemapMessageActionLeftDown.area = imagemapAreaLeftDown;
            imagemapMessageActionLeftDown.text = "我要進入社團模式!!!";

            imagemapMessage.actions.Add(imagemapMessageActionLeftDown);
            #endregion
            #region RightDown
            var actions1 = new List <isRock.LineBot.ImagemapActionBase>();
            isRock.LineBot.ImagemapArea imagemapAreaRightDown = new isRock.LineBot.ImagemapArea()
            {
                x      = 520,
                y      = 520,
                width  = 520,
                height = 520
            };

            isRock.LineBot.ImagemapMessageAction imagemapMessageActionRightDown = new ImagemapMessageAction();

            imagemapMessageActionRightDown.area = imagemapAreaRightDown;
            imagemapMessageActionRightDown.text = "我要進入商店模式!!!";

            imagemapMessage.actions.Add(imagemapMessageActionRightDown);

            #endregion


            return(imagemapMessage);
        }