Example #1
0
        internal void AddOservable(IDoctor doctor)
        {
            var observeData = new ObserveData(SelectClinic.Id, doctor.Id, doctor.DoctorName);

            _detector.Add(observeData);
            refreshObserves();
        }
Example #2
0
        public void NewTicketsAdded(IObserveData observeData, IEnumerable <ITicket> newTickets)
        {
            var observerVM = ObserveData.FirstOrDefault(x => x.ObserveData == observeData);

            if (observerVM == null)
            {
                return;
            }

            observerVM.Tickets = GetTickets(observerVM.ObserveData.ClinicId, observerVM.ObserveData.DoctorId);
        }
Example #3
0
        private void doSelectTicket(ChatInfo chatInfo, CommandInfo commandInfo)
        {
            switch (commandInfo.Command)
            {
            case Commands.Back:
                commandInfo.Command = Commands.RefreshByCommand;
                chatInfo.ChatLevel  = Level.SelectSpec;
                doStep(chatInfo, commandInfo);
                return;

            case Commands.Refresh:
                commandInfo.Command = Commands.RefreshByCommand;
                chatInfo.ChatLevel  = Level.SelectDoctor;
                doStep(chatInfo, commandInfo);
                return;

            case Commands.Subscribe:
            {
                if (chatInfo.Detector == null)
                {
                    chatInfo.Detector             = ContainerHolder.Container.Resolve <IDetector>();
                    chatInfo.TicketsEventHandler += onTicketsAdded;
                    chatInfo.Detector.AddListener(chatInfo);
                }

                var observe = new ObserveData(chatInfo.Info.Clinic.Id, chatInfo.Info.Doctor.Id, chatInfo.Info.Doctor.DoctorName);
                if (chatInfo.Detector.Exists(observe))
                {
                    _botClient.SendTextMessageAsync(chatInfo.ChatId, "Вы уже подписаны на этого врача");
                    return;
                }
                chatInfo.Detector.Add(observe);
                _botClient.SendTextMessageAsync(chatInfo.ChatId, $"Мы начали следить за номерками {chatInfo.Info.Doctor.DoctorName}");
                break;
            }

            default:
                sendErrorCommand(chatInfo.ChatId, commandInfo.OriginalCommand);
                return;
            }
        }