49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Text.RegularExpressions;
|
|
using SvetoforVKBot.Models.Commands.LK.Cart;
|
|
using SvetoforVKBot.Models.Updates;
|
|
using VkNet;
|
|
using VkNet.Model;
|
|
using VkNet.Model.RequestParams;
|
|
using Newtonsoft.Json;
|
|
using VkNet.Model.Keyboard;
|
|
|
|
namespace SvetoforVKBot.Models.Commands.LK.Cart
|
|
{
|
|
public class SelectCartCommand : Command
|
|
{
|
|
public override string Name => "{\"button\":\"selectCart-";
|
|
|
|
public override void Execute(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db){ }
|
|
|
|
public override void ExecutePL(RootObject update, VkApi client, SvetoforVKBot.Data.SvetoforVKBotEntities db)
|
|
{
|
|
MessagesSendParams @params = new MessagesSendParams();
|
|
var chatId = update.@object.message.from_id;
|
|
Regex regex = new Regex("[^0-9]");
|
|
List<ProductsDostavka> products = new List<ProductsDostavka>();
|
|
List<Button> buttons = new List<Button>();
|
|
|
|
try
|
|
{
|
|
string[] payload = update.@object.message.payload.Split('-');
|
|
int curCart = Convert.ToInt32(regex.Replace(payload[1], ""));
|
|
|
|
ShowCart showCart = new ShowCart();
|
|
showCart.Execute(update, client, db, curCart);
|
|
|
|
}
|
|
catch (Exception ee)
|
|
{
|
|
@params.Message = "‼Ошибка в SelectCartCommand: " + ee.Message;
|
|
@params.Attachments = null;
|
|
@params.Keyboard = null;
|
|
@params.UserId = 59111081;
|
|
@params.RandomId = GetRandomId();
|
|
client.Messages.SendAsync(@params);
|
|
}
|
|
}
|
|
}
|
|
} |