public async Task MessageAboutRegistrationPilot(TelegramBotClient client, ServiceProvider provider, long chatid) { int countAdmin = await provider.adminService.CountAdmins(); if (countAdmin == 0) { return; } List <long> admins = await provider.adminService.GetChatId(); ProposalDTO proposal = await provider.proposalService.FindById(chatid); int numberOfPurpost = await propose.GetCount(); UserDTO user = await provider.userService.FindUserByPredicate(i => i.ChatId == proposal.ChatId); if (user == null) { throw new System.Exception("user is null"); } string message = $"Pilots: {propose.GetCount()}\n" + $"Pilot №{proposal.ChatId} is registered\n " + $"Name:{user.FIO}\n " + $"Tel.:{user.Phone}\n " + $"Insurance:{proposal.TypeOfInsurance}\n " + $"Address:{proposal.Address}\n " + $"Address, geolocation:{proposal.RealAddress}"; admins.ForEach(async(item) => { await client.SendTextMessageAsync(item, message); }); }
public async Task MessageAboutCreateTask(TelegramBotClient client, ServiceProvider provider, long chatid) { int countAdmin = await provider.adminService.CountAdmins(); if (countAdmin == 0) { return; } List <long> admins = await provider.adminService.GetChatId(); int numberOfPurpost = await propose.GetCount(); UserDTO user = await provider.userService.FindUserByPredicate(i => i.ChatId == chatid); BuisnessTaskDTO task = await provider.buisnessTaskService.LastTaskForUser(chatid); string message = $"Создана заявка:{task.Id}\n " + $"Создал пользователь: {user.FIO}\n " + $"Телефон пользователя: {user.Phone} \n" + $"Задача в регионе:{task.Region} \n " + $"Описание задачи:{task.Description}\n " + $"Сумма: {task.Sum}"; admins.ForEach(async(items) => { await client.SendTextMessageAsync(items, message); }); }