예제 #1
0
        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("商店地址修改失敗");
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        internal static string CommunicateUserInfo(string userId, int QID, int OID, string postbackData, string channelAccessToken)
        {
            UserStatus userStatus;
            OrderInfo  orderInfo;
            int        result;

            switch (QID)
            {
            case 71:
                switch (OID)
                {
                case 3:
                    // 先拿到UserStatus裡面的TempData,上一步存的是OrderID
                    userStatus = new UserStatus(userId);
                    userStatus.SelectByUserID();

                    // 把資料存進OrderUserTable裡
                    orderInfo         = new OrderInfo(userId);
                    orderInfo.OrderID = userStatus.TempData;
                    result            = orderInfo.InsertOrdeUserTable();

                    if (result > 0)
                    {
                        List <OrderInfo> list = orderInfo.SelectMyOrderByOrderID();
                        if (list[0].OrderStatus == "available")
                        {
                            string CheckMessage = "成功參加訂單~~\n此訂單正在推播中~~\n可以直接點選上面選項直接訂購喔~~";
                            //   isRock.LineBot.Utility.PushMessage(userId, CheckMessage, channelAccessToken);
                            OrderTemp orderTemp = new OrderTemp(userId);
                            orderTemp.OrderPartitionID = list[0].OrderPartitionID;
                            orderTemp.UpdateOrderPartitionIDByUserID();
                            string JasonMessage = FlexMaker.MakeSearchingItem(QID, OID, userId);
                            isRock.LineBot.Utility.PushMessagesWithJSON(userId, JasonMessage, channelAccessToken);
                            return(CheckMessage);
                        }
                        else
                        {
                            return("成功參加訂單");
                        }
                    }
                    else
                    {
                        return("參加訂單失敗");
                    }

                default:
                    break;
                }
                break;

            case 82:
                switch (OID)
                {
                case 2:
                    OrderTemp orderTemp = new OrderTemp(userId);
                    orderTemp.SelectByUserID();

                    orderInfo = new OrderInfo(userId);
                    orderInfo.OrderPartitionID = orderTemp.OrderPartitionID;
                    orderInfo.SelectMyOrderTableByOrderPartitionID();

                    switch (postbackData)
                    {
                    case "MyOrderPartition":             // 刪除我的週期性訂單的其中一筆
                        result = orderInfo.DeleteMyOrderPartitionByUserIDandOrderPartitionID();
                        if (result > 0)
                        {
                            return("成功刪除訂單");
                        }
                        else
                        {
                            return("刪除訂單失敗");
                        }

                    case "MyOrder":             // 刪除完整我的週期性訂單
                        result = orderInfo.DeleteMyOrderByUserIDandOrderID();
                        if (result > 0)
                        {
                            return("成功刪除訂單");
                        }
                        else
                        {
                            return("刪除訂單失敗");
                        }

                    case "MyOnceOrder":             // 刪除一次性我的訂單
                        result = orderInfo.DeleteMyOrderByUserIDandOrderID();
                        if (result > 0)
                        {
                            return("成功刪除訂單");
                        }
                        else
                        {
                            return("刪除訂單失敗");
                        }

                    default:
                        break;
                    }

                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
            return("資料庫溝通失敗");
        }