示例#1
0
        private async Task <IActionResult> CloseHelpDesk()
        {
            var WhoItWorkNow = HelpDeskFunction.WhoItWorkNow(HelpDeskId);

            if (WhoItWorkNow.Follower.Id == FollowerId)
            {
                HelpDesk   = HelpDeskFunction.HelpDeskClosed(HelpDeskId, FollowerId);
                BotMessage = new AdminHelpDeskMessage(HelpDesk);
                await EditMessage(BotMessage.BuildMsg());

                //уведомляем всех сотрудников
                BotMessage = new HelpDeskActionNotifiMessage(HelpDesk, HelpDesk.HelpDeskAnswer.LastOrDefault());
                await SendMessageAllBotEmployeess(BotMessage.BuildMsg());

                //уведомляем пользователя который создал заявку о том что заявка закрыта
                BotMessage = new HelpDeskEditorMessage(HelpDesk);
                await SendMessage(HelpDesk.Follower.ChatId, BotMessage.BuildMsg());

                return(OkResult);
            }

            else
            {
                await SendMessage(new BotMessage { TextMessage = "Заявка в обработке у " + WhoItWorkNow.Follower.FirstName + " " + WhoItWorkNow.Follower.LastName });

                return(OkResult);
            }
        }
        private async Task <IActionResult> AddTextToHelpDesk()
        {
            var NoSendHelp = HelpDeskFunction.InsertHelpDesk(FollowerId, BotInfo.Id, ReplyToMessageText);

            BotMessage = new HelpDeskEditorMessage(NoSendHelp);
            await SendMessage(BotMessage.BuildMsg());

            return(OkResult);
        }
        /// <summary>
        /// Прикрепить еще вложения к заявке
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> GetHelpDeskNoSendAndAddAttach()
        {
            int AttachId = await CheckAttach();

            var NoSendHelp = HelpDeskFunction.GetHelpDesk(FollowerId, BotInfo.Id);

            var attach = HelpDeskFunction.AddAttachToHelpDesk(AttachId, NoSendHelp.Id);

            if (attach != null)
            {
                NoSendHelp.HelpDeskAttachment.Add(attach);
            }

            BotMessage = new HelpDeskEditorMessage(NoSendHelp);
            await SendMessage(BotMessage.BuildMsg());

            return(OkResult);
        }
        private async Task <IActionResult> SaveHelpDesk(int HelpDeskId)
        {
            if (!FollowerFunction.IsBlocked(FollowerId))
            {
                var Help = HelpDeskFunction.SaveHelpDesk(HelpDeskId);

                BotMessage = new HelpDeskEditorMessage(Help);
                await EditMessage(BotMessage.BuildMsg());

                AdminHelpDeskMessage adminHelpDesk = new AdminHelpDeskMessage(Help);
                await base.SendMessageAllBotEmployeess(adminHelpDesk.BuildMsg());
            }

            else
            {
                await SendMessage(new BotMessage { TextMessage = "Пользователь заблокирован!" });
            }

            return(OkResult);
        }