показ заявок с высоким приоритетом в самом верху списка и пометка восклицательным знаком
This commit is contained in:
parent
583c408cec
commit
c106e1cac3
14
Program.cs
14
Program.cs
@ -562,7 +562,7 @@ class Program
|
|||||||
{
|
{
|
||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
var command = connection.CreateCommand();
|
var command = connection.CreateCommand();
|
||||||
command.CommandText = "SELECT Id, Description, Status FROM Reports WHERE Status != 'закрыта'";
|
command.CommandText = "SELECT Id, Description, Status, Priority FROM Reports WHERE Status != 'закрыта' ORDER BY CASE Priority WHEN 'высокий' THEN 1 WHEN 'средний' THEN 2 ELSE 3 END";
|
||||||
|
|
||||||
var buttons = new List<InlineKeyboardButton[]>();
|
var buttons = new List<InlineKeyboardButton[]>();
|
||||||
|
|
||||||
@ -573,12 +573,14 @@ class Program
|
|||||||
long id = reader.GetInt64(0);
|
long id = reader.GetInt64(0);
|
||||||
string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length));
|
string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length));
|
||||||
string status = reader.GetString(2);
|
string status = reader.GetString(2);
|
||||||
|
string priority = reader.GetString(3);
|
||||||
string statusEmoji = GetStatusEmoji(status);
|
string statusEmoji = GetStatusEmoji(status);
|
||||||
|
string priorityMarker = priority.ToLower() == "высокий" ? "⚠️" : "";
|
||||||
|
|
||||||
buttons.Add(new[]
|
buttons.Add(new[]
|
||||||
{
|
{
|
||||||
InlineKeyboardButton.WithCallbackData(
|
InlineKeyboardButton.WithCallbackData(
|
||||||
$"#{id} - {statusEmoji} {status} - {description}...",
|
$"{priorityMarker} #{id} - {statusEmoji} {status} - {description}...",
|
||||||
$"report_{id}")
|
$"report_{id}")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -608,6 +610,7 @@ class Program
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId)
|
private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId)
|
||||||
{
|
{
|
||||||
string connectionString = "Data Source=bot.db";
|
string connectionString = "Data Source=bot.db";
|
||||||
@ -618,7 +621,7 @@ class Program
|
|||||||
{
|
{
|
||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
var command = connection.CreateCommand();
|
var command = connection.CreateCommand();
|
||||||
command.CommandText = "SELECT Id, Description, Status FROM Reports WHERE Status = 'закрыта'";
|
command.CommandText = "SELECT Id, Description, Status, Priority FROM Reports WHERE Status = 'закрыта' ORDER BY CASE Priority WHEN 'высокий' THEN 1 WHEN 'средний' THEN 2 ELSE 3 END";
|
||||||
|
|
||||||
var buttons = new List<InlineKeyboardButton[]>();
|
var buttons = new List<InlineKeyboardButton[]>();
|
||||||
|
|
||||||
@ -629,12 +632,14 @@ class Program
|
|||||||
long id = reader.GetInt64(0);
|
long id = reader.GetInt64(0);
|
||||||
string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length));
|
string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length));
|
||||||
string status = reader.GetString(2);
|
string status = reader.GetString(2);
|
||||||
|
string priority = reader.GetString(3);
|
||||||
string statusEmoji = GetStatusEmoji(status);
|
string statusEmoji = GetStatusEmoji(status);
|
||||||
|
string priorityMarker = priority.ToLower() == "высокий" ? "⚠️" : "";
|
||||||
|
|
||||||
buttons.Add(new[]
|
buttons.Add(new[]
|
||||||
{
|
{
|
||||||
InlineKeyboardButton.WithCallbackData(
|
InlineKeyboardButton.WithCallbackData(
|
||||||
$"#{id} - {statusEmoji} {status} - {description}...",
|
$"{priorityMarker} #{id} - {statusEmoji} {status} - {description}...",
|
||||||
$"report_{id}")
|
$"report_{id}")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -663,6 +668,7 @@ class Program
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static async Task ShowReportDetails(ITelegramBotClient botClient, long chatId, long reportId, int messageId)
|
private static async Task ShowReportDetails(ITelegramBotClient botClient, long chatId, long reportId, int messageId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user