public SaveTagResponse LeadScore_SaveTag(SaveTagRequest request) { Logger.Current.Verbose("Request to save the tag."); Tag tag = Mapper.Map <TagViewModel, Tag>(request.TagViewModel); isTagValid(tag); Tag persistedTag = tagRepository.SaveContactTag(request.TagViewModel.ContactId, request.TagViewModel.TagName, request.TagViewModel.TagID, request.TagViewModel.AccountID, request.TagViewModel.CreatedBy); unitOfWork.Commit(); addToTopic(persistedTag.Id, request.TagViewModel.AccountID, request.TagViewModel.ContactId, request.TagViewModel.CreatedBy, true); //persistedTag.TagNameAutoComplete.Output = persistedTag.LeadScoreTag == true ? persistedTag.TagName + " *" : persistedTag.TagName; indexingService.IndexTag(persistedTag); request.TagViewModel.TagID = persistedTag.Id; SaveTagResponse response = new SaveTagResponse(); response.TagViewModel = request.TagViewModel; return(response); }
public SaveTagResponse MergeTag(SaveTagRequest request) { Logger.Current.Verbose("Request to merge the tags."); SaveTagResponse tagResponse = new SaveTagResponse(); bool isAssociatedWithWorkflow = tagRepository.isAssociatedWithWorkflows(new int[] { request.TagViewModel.sourceTagID }); bool isAssociatedWithLeadScoreRules = tagRepository.isAssociatedWithLeadScoreRules(new int[] { request.TagViewModel.sourceTagID }); tagResponse.IsAssociatedWithLeadScoreRules = isAssociatedWithLeadScoreRules; tagResponse.IsAssociatedWithWorkflows = isAssociatedWithWorkflow; if (isAssociatedWithLeadScoreRules || isAssociatedWithWorkflow) { return(tagResponse); } return(Merge(request.TagViewModel)); }
public SaveTagResponse SaveTag(SaveTagRequest request) { Logger.Current.Verbose("Request to save the tag."); Tag tag = Mapper.Map <TagViewModel, Tag>(request.TagViewModel); isTagValid(tag); if (tag.Id == 0 && request.TagViewModel.ContactId == 0) { IsDuplicateTag(tag); } Tag persistedTag = tagRepository.SaveContactTag(request.TagViewModel.ContactId, request.TagViewModel.TagName, request.TagViewModel.TagID, request.TagViewModel.AccountID, request.TagViewModel.CreatedBy); unitOfWork.Commit(); addToTopic(persistedTag.Id, request.TagViewModel.AccountID, request.TagViewModel.ContactId, request.TagViewModel.CreatedBy, true); if (request.TagViewModel.ContactId != 0) { contactService.ContactIndexing(new ContactIndexingRequest() { ContactIds = new List <int>() { request.TagViewModel.ContactId }, Ids = new Dictionary <int, bool>() { { request.TagViewModel.ContactId, true } }.ToLookup(o => o.Key, o => o.Value) }); } //persistedTag.TagNameAutoComplete.Output = persistedTag.LeadScoreTag == true ? persistedTag.TagName + " *" : persistedTag.TagName; indexingService.IndexTag(persistedTag); request.TagViewModel.TagID = persistedTag.Id; SaveTagResponse response = new SaveTagResponse(); response.TagViewModel = request.TagViewModel; return(response); }
public JsonResult ContinueMerging(string tagViewModel) { TagViewModel viewModel = JsonConvert.DeserializeObject <TagViewModel>(tagViewModel); viewModel.AccountID = UserExtensions.ToAccountID(this.Identity); SaveTagRequest request = new SaveTagRequest() { TagViewModel = viewModel }; SaveTagResponse response = tagService.ContinueMergeTag(request); return(Json(new { success = true, response = new { IsInvolvedInLeadScore = response.IsAssociatedWithLeadScoreRules, IsInvolvedInWorkflows = response.IsAssociatedWithWorkflows } }, JsonRequestBehavior.AllowGet)); }
public JsonResult MergeTag(string tagViewModel) { TagViewModel viewModel = JsonConvert.DeserializeObject <TagViewModel>(tagViewModel); viewModel.AccountID = UserExtensions.ToAccountID(this.Identity); Logger.Current.Informational("Logging Tag Information while merging tags: TagID " + viewModel.TagID + ", SourceTagId: " + viewModel.sourceTagID); SaveTagRequest request = new SaveTagRequest() { TagViewModel = viewModel }; SaveTagResponse response = tagService.MergeTag(request); return(Json(new { success = true, response = new { IsInvolvedInLeadScore = response.IsAssociatedWithLeadScoreRules, IsInvolvedInWorkflows = response.IsAssociatedWithWorkflows } }, JsonRequestBehavior.AllowGet)); }
public SaveTagResponse ContinueMergeTag(SaveTagRequest request) { Logger.Current.Informational("Request received for continuing the merge tags"); return(Merge(request.TagViewModel)); }