Exemple #1
0
        internal static string UpdateOrder(int QID, int OID, string userId)
        {
            int       result = 0;
            OrderTemp orderTemp;
            OrderInfo orderInfo;

            switch (QID)
            {
            case 61:
                orderTemp = new OrderTemp(userId);
                orderTemp.SelectByUserID();
                orderInfo = new OrderInfo(userId);
                orderInfo.OrderPartitionID = orderTemp.OrderPartitionID;
                orderInfo.SelectMyOrderTableByOrderPartitionID();
                orderInfo.StartTime = orderTemp.StartTime;
                orderInfo.EndTime   = orderTemp.EndTime;
                switch (orderInfo.OrderStatus)
                {
                case "wait":
                    orderInfo.OrderStatus = "wait";
                    result = orderInfo.UpdateTimeByOrderPartitionIDToMyOrder();

                    break;

                case "available":
                    orderInfo.OrderStatus = "wait";
                    result = orderInfo.UpdateTimeByOrderPartitionIDToMyOrder();

                    break;

                case "done":
                    return("此訂單已經結單,無法再改時間囉~");

                    break;

                default:
                    break;
                }
                //  result = orderInfo.UpdateTimeByOrderPartitionIDToMyOrder();
                break;

            case 161:
                orderTemp = new OrderTemp(userId);
                orderTemp.ClubIDSelectByUserID();
                orderTemp.SelectByUserID();

                orderInfo = new OrderInfo(orderTemp.ClubID);
                orderInfo.OrderPartitionID = orderTemp.OrderPartitionID;
                orderInfo.SelectClubOrderTableByOrderPartitionID();

                orderInfo.StartTime = orderTemp.StartTime;
                orderInfo.EndTime   = orderTemp.EndTime;
                switch (orderInfo.OrderStatus)
                {
                case "wait":
                    orderInfo.OrderStatus = "wait";
                    result = orderInfo.UpdateTimeByOrderPartitionIDTOClubOrder();

                    break;

                case "available":
                    orderInfo.OrderStatus = "wait";
                    result = orderInfo.UpdateTimeByOrderPartitionIDTOClubOrder();

                    break;

                case "done":
                    return("此訂單已經結單,無法再改時間囉~");

                    break;

                default:
                    break;
                }

                //        result = orderInfo.UpdateTimeByOrderPartitionIDTOClubOrder();
                break;

            default:
                break;
            }
            if (result > 0)
            {
                orderTemp = new OrderTemp(userId);
                orderTemp.UpdateInitialOrderTemp();
                return("修改成功");
            }
            else
            {
                return("修改失敗");
            }
        }
Exemple #2
0
        internal static string CommunicateOrder(string userId, int QID, int OID, string OrderName, string channelAccessToken)
        {
            OrderTemp orderTmp = new OrderTemp(userId);

            orderTmp.SelectByUserID();             //這裡主要從OrderTmp抓取起始時間跟結束時間,ShopID
            OrderInfo orderinfo = new OrderInfo(); //準備輸入SQL的資料

            switch (QID)                           //根據QID不同初始化clubOrderAndMyOrder
            {
            case 201:
                orderinfo = new OrderInfo(userId, OrderName);
                break;

            case 231:    //231只修改shopID
                orderinfo = new OrderInfo(userId);
                orderTmp.SelectByUserID();
                orderTmp.ShopID = OrderName;    //在此處傳進來OrderName是ShopID
                break;

            case 241:
                orderTmp.ClubIDSelectByUserID();    //撈取ClubID
                orderinfo = new OrderInfo(orderTmp.ClubID, OrderName);
                break;

            case 261:
                orderTmp.ClubIDSelectByUserID();    //撈取ClubID
                orderinfo = new OrderInfo(orderTmp.ClubID);
                orderTmp.SelectByUserID();
                orderTmp.ShopID = OrderName;    //在此處傳進來OrderName是ShopID
                break;

            default:
                break;
            }
            orderinfo.StartTime = orderTmp.StartTime;
            orderinfo.EndTime   = orderTmp.EndTime;
            orderinfo.ShopID    = orderTmp.ShopID;
            if (QID == 201 | QID == 241)
            {
                orderinfo.OrderType = "Once";
            }
            else
            {
                orderinfo.OrderType = "Period";
            }
            orderinfo.OrderStatus = "wait";

            int result = 0;

            switch (QID)
            {
            case 201:
                orderinfo.OrderPartitionID = "MOO" + orderinfo.OrderID;
                result = orderinfo.InserMyOrderTableToSQL();
                break;

            case 231:    //修改MyOrder訂單店家
                orderinfo.OrderPartitionID = orderTmp.OrderPartitionID;
                result = orderinfo.UpdateShopIDByOrderPartitionIDToMyOrder();
                if (result > 0)
                {
                    return("修改完成");
                }
                else
                {
                    return("修改失敗");
                }
                break;

            case 241:
                orderinfo.OrderPartitionID = "COO" + orderinfo.OrderID;
                result = orderinfo.InserClubOrderTableToSQL();
                if (result > 0)
                {
                    UserStatus userStatus = new UserStatus(userId);
                    userStatus.InitializeUserStatusByUserID();
                    orderTmp.UpdateInitialOrderTemp();
                    orderTmp = new OrderTemp(userId);

                    return("社團訂單建立成功,所有社團成員皆能收到此訂單通知,無須再讓成員加入訂單喔~");
                }
                break;

            case 261:
                orderinfo.OrderPartitionID = orderTmp.OrderPartitionID;
                result = orderinfo.UpdateShopIDByOrderPartitionIDToClubOrder();
                if (result > 0)
                {
                    return("修改完成");
                }
                else
                {
                    return("修改失敗");
                }
                break;

            default:
                break;
            }
            if (result > 0)
            {
                UserStatus userStatus = new UserStatus(userId);
                userStatus.InitializeUserStatusByUserID();
                orderTmp = new OrderTemp(userId);
                orderinfo.InsertOrdeUserTable();
                orderTmp.UpdateInitialOrderTemp();

                isRock.LineBot.Utility.PushMessage(userId, orderinfo.OrderID, channelAccessToken);
                //   string orderCreateMessage = "上面是你的訂單參加碼,可以將此參加碼分享給其他人,讓其他人加入你的訂單喔~";
                //    isRock.LineBot.Utility.PushMessage(userId, orderCreateMessage, channelAccessToken);
                return("訂單建立成功喔~~\n上面是你的訂單參加碼,可以將此參加碼分享給其他人,讓其他人加入你的訂單喔~");
            }
            else
            {
                return("訂單建立失敗");
            }
        }
Exemple #3
0
        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);
        }