Exemplo n.º 1
0
 public void AddReasons(StockScore score)
 {
     Reasons.AddRange(score.Reasons);
 }
        private void OnTicketViewModelEvent(EventParameters <TicketViewModel> obj)
        {
            if (obj.Topic == EventTopicNames.SelectTicketTag)
            {
                ResetValues(obj.Value);
                _showFreeTagEditor = SelectedTicket.LastSelectedTicketTag.FreeTagging;

                List <TicketTag> tags;
                if (_showFreeTagEditor)
                {
                    tags = Dao.Query <TicketTagGroup>(x => x.Id == SelectedTicket.LastSelectedTicketTag.Id,
                                                      x => x.TicketTags).SelectMany(x => x.TicketTags).OrderBy(x => x.Name).ToList();
                }
                else
                {
                    tags = AppServices.MainDataContext.SelectedDepartment.TicketTagGroups.Where(
                        x => x.Name == obj.Value.LastSelectedTicketTag.Name).SelectMany(x => x.TicketTags).ToList();
                }
                tags.Sort(new AlphanumComparator());
                TicketTags.AddRange(tags);

                if (SelectedTicket.IsTaggedWith(SelectedTicket.LastSelectedTicketTag.Name))
                {
                    TicketTags.Add(TicketTag.Empty);
                }
                if (TicketTags.Count == 1 && !_showFreeTagEditor)
                {
                    obj.Value.UpdateTag(SelectedTicket.LastSelectedTicketTag, TicketTags[0]);
                }
                RaisePropertyChanged("TagColumnCount");
                RaisePropertyChanged("IsFreeTagEditorVisible");
                RaisePropertyChanged("FilteredTextBoxType");
            }

            if (obj.Topic == EventTopicNames.SelectVoidReason)
            {
                ResetValues(obj.Value);
                Reasons.AddRange(AppServices.MainDataContext.Reasons.Values.Where(x => x.ReasonType == 0));
                if (Reasons.Count == 0)
                {
                    obj.Value.VoidSelectedItems(0);
                }
                RaisePropertyChanged("ReasonColumnCount");
            }

            if (obj.Topic == EventTopicNames.SelectGiftReason)
            {
                ResetValues(obj.Value);
                Reasons.AddRange(AppServices.MainDataContext.Reasons.Values.Where(x => x.ReasonType == 1));
                if (Reasons.Count == 0)
                {
                    obj.Value.GiftSelectedItems(0);
                }
                RaisePropertyChanged("ReasonColumnCount");
            }

            if (obj.Topic == EventTopicNames.SelectExtraProperty)
            {
                ResetValues(obj.Value);
                _showExtraPropertyEditor = true;
                RaisePropertyChanged("IsExtraPropertyEditorVisible");
                RaisePropertyChanged("IsPortionsVisible");
            }

            if (obj.Topic == EventTopicNames.EditTicketNote)
            {
                ResetValues(obj.Value);
                _showTicketNoteEditor = true;
                RaisePropertyChanged("IsTicketNoteEditorVisible");
            }
        }
Exemplo n.º 3
0
 public void AddReasons(List <ReasonScore> reasons)
 {
     Reasons.AddRange(reasons);
 }