private void UpdateTicketTag(Ticket ticket, TicketTagGroup tagGroup, TicketTag ticketTag)
 {
     _ticketService.UpdateTag(ticket, tagGroup, ticketTag);
     EventServiceFactory.EventService.PublishEvent(EventTopicNames.ActivatePosView);
 }
Beispiel #2
0
        public void UpdateTag(TicketTagGroup tagGroup, TicketTag ticketTag)
        {
            Model.SetTagValue(tagGroup.Name, ticketTag.Name);
            if (tagGroup.Numerator != null)
            {
                Model.TicketNumber = "";
                AppServices.MainDataContext.UpdateTicketNumber(Model, tagGroup.Numerator);
            }

            if (ticketTag.AccountId > 0)
                AppServices.MainDataContext.AssignCustomerToTicket(Model,
                    Dao.SingleWithCache<Customer>(x => x.Id == ticketTag.AccountId));

            ClearSelectedItems();

            var tagData = new TicketTagData { Action = tagGroup.Action, TagName = tagGroup.Name, TagValue = ticketTag.Name, NumericValue = tagGroup.NumericTags || tagGroup.PriceTags ? Convert.ToDecimal(ticketTag.Name) : 0 };

            RuleExecutor.NotifyEvent(RuleEventNames.TicketTagSelected,
                        new
                        {
                            Ticket = Model,
                            tagData.TagName,
                            tagData.TagValue,
                            tagData.NumericValue,
                            TicketTag = Model.Tag
                        });

            tagData.PublishEvent(EventTopicNames.TagSelectedForSelectedTicket);
        }
 private void OnTicketTagSelected(TicketTag obj)
 {
     UpdateTicketTag(SelectedTicket, SelectedTicketTagData, obj);
 }
 private void OnUpdateFreeTag(string obj)
 {
     var tag = new TicketTag { Name = FreeTag };
     FreeTag = string.Empty;
     UpdateTicketTag(SelectedTicket, SelectedTicketTagData, tag);
 }
 private void OnUpdateFreeTag(string obj)
 {
     var cachedTag = AppServices.MainDataContext.SelectedDepartment.TicketTagGroups.Single(
         x => x.Id == SelectedTicket.LastSelectedTicketTag.Id);
     Debug.Assert(cachedTag != null);
     var ctag = cachedTag.TicketTags.SingleOrDefault(x => x.Name.ToLower() == FreeTag.ToLower());
     if (ctag == null && cachedTag.SaveFreeTags)
     {
         using (var workspace = WorkspaceFactory.Create())
         {
             var tt = workspace.Single<TicketTagGroup>(x => x.Id == SelectedTicket.LastSelectedTicketTag.Id);
             Debug.Assert(tt != null);
             var tag = tt.TicketTags.SingleOrDefault(x => x.Name.ToLower() == FreeTag.ToLower());
             if (tag == null)
             {
                 tag = new TicketTag { Name = FreeTag };
                 tt.TicketTags.Add(tag);
                 workspace.Add(tag);
                 workspace.CommitChanges();
             }
         }
     }
     SelectedTicket.UpdateTag(SelectedTicket.LastSelectedTicketTag, new TicketTag { Name = FreeTag });
     FreeTag = string.Empty;
 }
 private void OnTicketTagSelected(TicketTag obj)
 {
     SelectedTicket.UpdateTag(SelectedTicket.LastSelectedTicketTag, obj);
 }
 public TicketTagViewModel(TicketTag model)
 {
     Model = model;
 }
Beispiel #8
0
        public void UpdateTag(Ticket ticket, TicketTagGroup tagGroup, TicketTag ticketTag)
        {
            ticket.SetTagValue(tagGroup.Name, ticketTag.Name);

            if (tagGroup.FreeTagging && tagGroup.SaveFreeTags)
            {
                SaveFreeTicketTag(tagGroup.Id, ticketTag.Name);
            }

            var tagData = new TicketTagData
            {
                Ticket = ticket,
                TicketTagGroup = tagGroup,
                TagName = tagGroup.Name,
                TagValue = ticketTag.Name
            };

            _applicationState.NotifyEvent(RuleEventNames.TicketTagSelected,
                        new
                        {
                            Ticket = ticket,
                            tagData.TagName,
                            tagData.TagValue,
                            NumericValue = tagGroup.IsNumeric ? Convert.ToDecimal(ticketTag.Name) : 0,
                            TicketTag = ticket.GetTagData()
                        });
        }
Beispiel #9
0
 public void UpdateTag(Ticket ticket, TicketTagGroup tagGroup, TicketTag ticketTag)
 {
     UpdateTag(ticket, tagGroup, ticketTag.Name);
 }