Ejemplo n.º 1
0
 public DialogService(
     INodeProvider nodeProvider,
     IDialogRepository dialogRepository)
 {
     _nodeProvider     = nodeProvider;
     _dialogRepository = dialogRepository;
 }
Ejemplo n.º 2
0
        public EmployeeReportViewModel(IReportService reportService, IDialogRepository dialogRepository)
            : base(reportService, dialogRepository)
        {
            _shiftGroupingVmCollection = new ObservableCollection <ShiftGroupingViewModel>();
            ((INotifyCollectionChanged)_reportService.ShiftGroupingCollection).CollectionChanged += (s, e) =>
            {
                if (e.NewItems?[0] != null)
                {
                    var sgvm = new ShiftGroupingViewModel((ShiftGrouping)e.NewItems[0], FilterVmCollection);
                    sgvm.PropertyChanged += this.OnIsModifyChanged;
                    _shiftGroupingVmCollection.Add(sgvm);
                }

                if (e.OldItems?[0] != null)
                {
                    var delShiftGrouping = _shiftGroupingVmCollection.First(sh => ReferenceEquals(sh.ShiftGrouping, e.OldItems[0]));
                    delShiftGrouping.PropertyChanged -= OnIsModifyChanged;
                    _shiftGroupingVmCollection.Remove(delShiftGrouping);
                }

                if (e.NewItems?[0] == null && e.OldItems?[0] == null)
                {
                    foreach (var shiftGroupingViewModel in _shiftGroupingVmCollection)
                    {
                        shiftGroupingViewModel.PropertyChanged -= OnIsModifyChanged;
                    }

                    _shiftGroupingVmCollection.Clear();
                }
            };

            ShiftGroupingVmCollection = _shiftGroupingVmCollection.Where(ShiftGroupingPredicate).ToArray();
            //IsModify = true;
        }
Ejemplo n.º 3
0
 public DialogService(IMessageRepository messageRepository,
                      IUserRepository userRepository,
                      IDialogRepository dialogRepository)
 {
     _messageRepository = messageRepository;
     _userRepository    = userRepository;
     _dialogRepository  = dialogRepository;
 }
Ejemplo n.º 4
0
 public DialogController(IUserRepository userRepository, IDialogRepository dialogRepository, IMessageRepository messageRepository, IMapper mapper, IStringLocalizer localizer)
 {
     _messageRepository = messageRepository;
     _dialogRepository  = dialogRepository;
     _usersRepository   = userRepository;
     _localizer         = localizer;
     _mapper            = mapper;
 }
Ejemplo n.º 5
0
 public DialogService(ChatNpgSQLContext context,
                      IDialogRepository dialogRepository,
                      IMapper mapper,
                      IChatEventRepository chatEventRepository,
                      IBotNotifier botNotifier)
 {
     _context             = context;
     _dialogRepository    = dialogRepository;
     _mapper              = mapper;
     _chatEventRepository = chatEventRepository;
     _botNotifier         = botNotifier;
 }
Ejemplo n.º 6
0
        protected ReportViewModel(IReportService reportService, IDialogRepository dialogRepository)
        {
            _reportService    = reportService ?? throw new ArgumentNullException(nameof(reportService), @"ReportService cannot be null.");
            _dialogRepository = dialogRepository ?? throw new ArgumentNullException(nameof(dialogRepository), @"IDialogRepository cannot be null.");

            CreateCommonCollections();
            _filterVmCollection = GetFilterCollection();
            FilterVmCollection  = new ReadOnlyObservableCollection <FilterViewModel>(_filterVmCollection);


            void CreateCommonCollections()
            {
                var appointmentVmCollection = new ObservableCollection <AppointmentViewModel>(_reportService.AppointmentCollection.Select(a => new AppointmentViewModel(a)));

                AppointmentVmCollection = new ReadOnlyObservableCollection <AppointmentViewModel>(appointmentVmCollection);
                Observe(_reportService.AppointmentCollection, appointmentVmCollection, a => a.Appointment);

                var positionVmCollection = new ObservableCollection <PositionViewModel>(_reportService.PositionCollection.Select(p => new PositionViewModel(p)));

                PositionVmCollection = new ReadOnlyObservableCollection <PositionViewModel>(positionVmCollection);
                Observe(_reportService.PositionCollection, positionVmCollection, p => p.Position);

                var rankVmCollection = new ObservableCollection <RankViewModel>(_reportService.RankCollection.Select(r => new RankViewModel(r)));

                RankVmCollection = new ReadOnlyObservableCollection <RankViewModel>(rankVmCollection);
                Observe(_reportService.RankCollection, rankVmCollection, r => r.Rank);

                var shiftVmCollection = new ObservableCollection <ShiftViewModel>(_reportService.ShiftCollection.Select(sh => new ShiftViewModel(sh)));

                ShiftVmCollection = new ReadOnlyObservableCollection <ShiftViewModel>(shiftVmCollection);
                Observe(_reportService.ShiftCollection, shiftVmCollection, sh => sh.Shift);

                var shortBreakCollection = new ObservableCollection <ShortBreakScheduleViewModel>(_reportService.ShortBreakCollection.Select(sbs => new ShortBreakScheduleViewModel(sbs)));

                ShortBreakVmCollection = new ReadOnlyObservableCollection <ShortBreakScheduleViewModel>(shortBreakCollection);
                Observe(_reportService.ShortBreakCollection, shortBreakCollection, sbs => sbs.ShortBreakSchedule);
            }
        }
Ejemplo n.º 7
0
 public DialogService(IDialogRepository dialogsRepository, IUnitOfWork unitOfWork, IUserProfileRepository userProfileRepository)
 {
     this.dialogsRepository     = dialogsRepository;
     this.unitOfWork            = unitOfWork;
     this.userProfileRepository = userProfileRepository;
 }
Ejemplo n.º 8
0
 public DialogService(IDialogRepository dialogRepository)
 {
     _dialogRepository = dialogRepository;
 }
        public ProductivityReportViewModel(IReportService reportService, IDialogRepository dialogRepository)
            : base(reportService, dialogRepository)
        {
            SetupPeriod();


            var timesOperationVm = new OperationViewModel(new Operation {
                Id = -1, Name = "Время", Group = OperationGroups.Time
            });

            timesOperationVm.SortRequested += Sort;
            _operationVmCollection          = new ObservableCollection <OperationViewModel>(_reportService.OperationCollection.Select(o =>
            {
                var ovm            = new OperationViewModel(o);
                ovm.SortRequested += Sort;
                return(ovm);
            }))
            {
                timesOperationVm
            };
            Observe(_reportService.OperationCollection, _operationVmCollection, o => o.Operation);
            AddOperationFilter();
            OperationVmCollection = _operationVmCollection.Where(OperationPredicate).OrderBy(o => o.Id).ToArray();

            _employeeProductivityVmCollection = CreateEmployeeProductivityVmCollection();
            EmployeeProductivityVmCollection  = _employeeProductivityVmCollection.Where(ep => IsActivePredicate(ep.EmployeeVm) &&
                                                                                        PositionPredicate(ep.EmployeeVm) &&
                                                                                        AppointmentPredicate(ep.EmployeeVm) &&
                                                                                        ShiftPredicate(ep.EmployeeVm) &&
                                                                                        RankPredicate(ep.EmployeeVm) &&
                                                                                        IsSmokerPredicate(ep.EmployeeVm)
                                                                                        )
                                                .OrderBy(ep => ep.PositionId)
                                                .ThenBy(ep => ep.AppointmentId)
                                                .ThenBy(ep => ep.Name);

            SortOperationVm = new OperationViewModel(new Operation {
                Id = -2, Name = "", Group = OperationGroups.SortByDefault
            });
            SortOperationVm.SortRequested += Sort;
            _lastOperationVm = SortOperationVm;

            void SetupPeriod()
            {
                var now   = DateTime.Now;
                var start = now.Date.Subtract(TimeSpan.FromDays(now.Day - 1));

                Period = new Period(start, now);
            }

            ObservableCollection <EmployeeProductivityViewModel> CreateEmployeeProductivityVmCollection()
            {
                var empColl = new ObservableCollection <EmployeeProductivityViewModel>(
                    _reportService.EmployeeProductivityCollections.Select(
                        p => new EmployeeProductivityViewModel(p, FilterVmCollection, _reportService.CategoryCollection)
                        )
                    );


                (( INotifyCollectionChanged )_reportService.EmployeeProductivityCollections).CollectionChanged +=
                    (s, e) =>
                {
                    if (e.NewItems?[0] != null)
                    {
                        var epvm = new EmployeeProductivityViewModel(( EmployeeProductivity )e.NewItems[0], FilterVmCollection, _reportService.CategoryCollection);
                        empColl.Add(epvm);
                        return;
                    }

                    if (e.OldItems?[0] != null)
                    {
                        empColl.Remove(empColl.First(vm => ReferenceEquals(vm.EmployeeProductivity, e.OldItems[0])));
                        return;
                    }

                    if (e.NewItems?[0] == null && e.OldItems?[0] == null)
                    {
                        empColl.Clear();
                    }
                };
                return(empColl);
            }
        }
Ejemplo n.º 10
0
 public UserService(
     IUserRepository userRepository, IDialogRepository dialogRepository)
 {
     _userRepository   = userRepository;
     _dialogRepository = dialogRepository;
 }
Ejemplo n.º 11
0
 public DialogRepository()
 {
     _nodeRepository   = TestContainer.Container.GetInstance <INodeRepository>();
     _dialogRepository = TestContainer.Container.GetInstance <IDialogRepository>();
 }