//void editMessageCaption(Update update,string answer,int ? id ,string reply_markup) // { // } string Recycle(Update update, int?id, out string reply_markup) { string answer = ""; reply_markup = ""; TelegramRecycle rec = new TelegramRecycle(update, id); string[] _data = update.callback_query.data.Split(); switch (_data[1] ?? "") { case "покупка": rec.AddBuy(_data[2], _data[3]); answer = Shop(_data[2], _data[3], update, id, out reply_markup); break; case "отобразить": answer = rec.ShowMyBuy(); InlineKeyboard keyboard = new InlineKeyboard(); List <InlineKeyboardButton> line = new List <InlineKeyboardButton>() { new InlineKeyboardButton("Оформить", "корзина оформить"), new InlineKeyboardButton("Изменить", "корзина изменить") }; keyboard.AddLine(line); keyboard.AddButton(new InlineKeyboardButton("⬅️ Назад", "about")); reply_markup = JsonConvert.SerializeObject(keyboard); break; case "изменить": answer = rec.ChangeMyBuy(out reply_markup); break; case "удалить": rec.DeleteElement(_data[2], _data[3]); answer = rec.ChangeMyBuy(out reply_markup); break; case "оформить": answer = "Выберете вариант:" + Environment.NewLine + Environment.NewLine + "Отправить телефон и мы с вами свяжемся n"; reply_markup = ReturnReplyToAdmin(); SendMessage(update.callback_query.from.id, answer, ReceiveToken(update, id), reply_markup); return("отмена"); default: break; } // answer = "В корзине" + rec.Count + " шт"; //InlineKeyboard keyboard = new InlineKeyboard(); //keyboard.AddButton(new InlineKeyboardButton("Назад", "about")); //AddMainButtons(keyboard); //reply_markup = JsonConvert.SerializeObject(keyboard); //Shop(_data[2], _data[3], update, id, out reply_markup); if (reply_markup == "") { MainMenu(update, id, out reply_markup); } return(answer); }
void AddMainButtons(InlineKeyboard keyboard, Update update, int?id) { TelegramRecycle tel = new TelegramRecycle(update, id); List <InlineKeyboardButton> line = new List <InlineKeyboardButton>() { new InlineKeyboardButton("❓ Есть вопрос", "?"), new InlineKeyboardButton("📖 О нас", "about") }; keyboard.AddLine(line); }
void AddRecycle(InlineKeyboard keyboard, string nameCategory, string nameProduct, Update update, int?id) { TelegramRecycle tel = new TelegramRecycle(update, id); List <InlineKeyboardButton> line = new List <InlineKeyboardButton>() { new InlineKeyboardButton("♻️ Корзина (" + tel.Count + ")", "корзина отобразить"), }; if (nameProduct == "" || nameCategory == "") { keyboard.AddLine(line); return; } line.Add(new InlineKeyboardButton("Добавить в корзину", "корзина покупка " + nameCategory + " " + nameProduct)); keyboard.AddLine(line); }