示例#1
0
        /// <summary>
        /// Платежи
        /// </summary>
        private void CreatePaymentWorksheet()
        {
            PaymentList = PaymentsFunction.GetPaymentsList();

            // шапка
            PaymentkWorksheet.Cells[1, 1].Value = "Номер заказа";
            PaymentkWorksheet.Cells[1, 2].Value = "Дата";
            PaymentkWorksheet.Cells[1, 3].Value = "Id платежа";
            PaymentkWorksheet.Cells[1, 4].Value = "Номер транзакции";
            PaymentkWorksheet.Cells[1, 5].Value = "Комменатрий";
            PaymentkWorksheet.Cells[1, 6].Value = "Адрес счета получателя";
            PaymentkWorksheet.Cells[1, 7].Value = "Сумма";
            PaymentkWorksheet.Cells[1, 8].Value = "Платежная система";

            int row = 2;

            foreach (var payment in PaymentList)
            {
                //Номер заказа
                PaymentkWorksheet.Cells[row, 1].Value = payment.Invoice.Orders.FirstOrDefault().Number;

                //Дата
                PaymentkWorksheet.Cells[row, 2].Value = payment.TimestampDataAdd.ToString();

                //Id платежа
                PaymentkWorksheet.Cells[row, 3].Value = payment.Id;

                //Номер транзакции
                PaymentkWorksheet.Cells[row, 4].Value = payment.TxId;

                //Комменатрий
                PaymentkWorksheet.Cells[row, 5].Value = payment.Comment;

                //Адрес счета получателя
                PaymentkWorksheet.Cells[row, 6].Value = payment.Invoice.AccountNumber;

                //Сумма
                PaymentkWorksheet.Cells[row, 7].Value = payment.Summ;

                //Платежная система
                PaymentkWorksheet.Cells[row, 8].Value = payment.Invoice.PaymentType.Name;
            }
        }
        public override InlineQueryResult[] GetResult()
        {
            var list = PaymentsFunction.GetPaymentsList().Take(MaxResult).ToList();


            InputTextMessageContent[]  textcontent = new InputTextMessageContent[list.Count];
            InlineQueryResultArticle[] article     = new InlineQueryResultArticle[list.Count];
            InlineQueryResult[]        result      = new InlineQueryResult[list.Count];

            int i = 0;

            foreach (var payment in list)
            {
                //PaymentViewMsg = new Messages.Admin.PaymentViewMessage(payment);
                //BotMessage mess = PaymentViewMsg.BuildMsg();

                textcontent[i]                       = new InputTextMessageContent();
                textcontent[i].ParseMode             = Telegram.Bot.Types.Enums.ParseMode.Html;
                textcontent[i].DisableWebPagePreview = true;
                textcontent[i].MessageText           = "/payment" + payment.Id.ToString();

                article[i]             = new InlineQueryResultArticle();
                article[i].HideUrl     = false;
                article[i].Id          = payment.Id.ToString();
                article[i].Title       = "Платеж №" + payment.Id.ToString();
                article[i].Description = payment.TimestampDataAdd.ToString();

                article[i].ThumbUrl = "https://cdn2.iconfinder.com/data/icons/shop-payment-vol-6/128/shop-01-256.png";
                //article[i].ReplyMarkup = mess.MessageReplyMarkup;
                article[i].InputMessageContent = textcontent[i];


                result[i] = new InlineQueryResult();
                result[i] = article[i];

                i++;
            }

            return(result);
        }