public async Task ShowAllOrders(long chatid, MessageEventArgs messageObject, bool isBuisnessman = false) { int countTask; BuisnessTaskDTO task; string message; // для бизнесменов if (isBuisnessman) { countTask = await provider.buisnessTaskService.CountTask(chatid); if (countTask == 0) { await client.SendTextMessageAsync(chatid, "Вы не создали ниодной задачи"); } task = await provider.buisnessTaskService.GetFirstElement(chatid); message = $"Заявка номер: {task.Id} \n" + $"Регион: {task.Region} \n" + $"Описание: {task.Description} \n" + $"Сумма: {task.Sum}"; await provider.showOrderService.SetDefaultProduct(chatid, true); await provider.showOrderService.ChangeMessageId(chatid, messageObject.Message.MessageId); await client.SendTextMessageAsync(chatid, message, 0, false, false, 0, KeyBoardHandler.CallBackShowOrdersForBuisnessman()); return; } countTask = await provider.buisnessTaskService.CountTask(); if (countTask == 0) { // отправлять await client.SendTextMessageAsync(chatid, "Еще нету созданных задач"); await provider.userService.ChangeAction(chatid, "NULL", 0); return; } task = await provider.buisnessTaskService.GetFirstElement(); message = $"Заявка номер: {task.Id} \n" + $"Регион: {task.Region} \n" + $"Описание: {task.Description} \n" + $"Сумма: {task.Sum}"; await provider.showOrderService.SetDefaultProduct(chatid); await provider.showOrderService.ChangeMessageId(chatid, messageObject.Message.MessageId); await client.SendTextMessageAsync(chatid, message, 0, false, false, 0, KeyBoardHandler.CallBackShowOrders()); }
public async Task ShowMyOrdersCallBack(CallbackQueryEventArgs callback) { long chatid = callback.CallbackQuery.Message.Chat.Id; if (callback.CallbackQuery.Data == "BuisnessNext") { BuisnessTaskDTO task = await provider.showOrderService.GetNextProduct(chatid, true); if (task == null) { await client.SendTextMessageAsync(chatid, "Это была последняя задача"); return; } int messageId = await provider.showOrderService.GetMessageId(chatid); string message = $"Заявка номер: {task.Id} \n" + $"Регион: {task.Region} \n" + $"Описание: {task.Description} \n" + $"Сумма: {task.Sum}"; await client.EditMessageTextAsync(chatid, messageId + 1, message, 0, false, (InlineKeyboardMarkup)KeyBoardHandler.CallBackShowOrdersForBuisnessman()); } if (callback.CallbackQuery.Data == "BuisnessBack") { BuisnessTaskDTO task = await provider.showOrderService.GetPreviousProduct(chatid, true); if (task == null) { await client.SendTextMessageAsync(chatid, "Это первая задача"); return; } int messageId = await provider.showOrderService.GetMessageId(chatid); string message = $"Заявка номер: {task.Id} \n" + $"Регион: {task.Region} \n" + $"Описание: {task.Description} \n" + $"Сумма: {task.Sum}"; await client.EditMessageTextAsync(chatid, messageId + 1, message, 0, false, (InlineKeyboardMarkup)KeyBoardHandler.CallBackShowOrdersForBuisnessman()); } }