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("商店建立失敗"); } }
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); }
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); }