Наследование: ExtensibleDataObject
Пример #1
0
        public SaveNoteResponse InsertNote(SaveNoteRequest request)
        {
            Logger.Current.Verbose("Request for inserting Note");
            Logger.Current.Informational("Note details:" + request.NoteViewModel.NoteDetails);
            Note note = Mapper.Map <NoteViewModel, Note>(request.NoteViewModel);

            isNoteValid(note);
            noteRepository.Insert(note);
            Note newNote = unitOfWork.Commit() as Note;

            foreach (Tag tag in note.Tags.Where(t => t.Id == 0))
            {
                if (tag.Id == 0)
                {
                    Tag savedTag = tagRepository.FindBy(tag.TagName, request.AccountId);
                    indexingService.IndexTag(savedTag);
                    accountService.ScheduleAnalyticsRefresh(savedTag.Id, (byte)IndexType.Tags);
                }
            }

            note.Id = newNote.Id;
            if (request.NoteViewModel.Contacts != null && request.NoteViewModel.Contacts.Count() > 0)
            {
                var noteContactIds = request.NoteViewModel.Contacts.Select(c => c.Id).ToList();
                List <LastTouchedDetails> details = new List <LastTouchedDetails>();
                foreach (var id in noteContactIds)
                {
                    LastTouchedDetails detail = new LastTouchedDetails();
                    detail.ContactID       = id;
                    detail.LastTouchedDate = DateTime.UtcNow;
                    details.Add(detail);
                }
                updateLastTouchedInformation(details);
                contactService.ContactIndexing(new ContactIndexingRequest()
                {
                    ContactIds = noteContactIds, Ids = noteContactIds.ToLookup(o => o, o => { return(true); })
                });
            }

            if (note.SelectAll == false)
            {
                this.addToTopic(note, request.AccountId);
            }

            return(new SaveNoteResponse()
            {
                NoteViewModel = new NoteViewModel()
                {
                    NoteId = newNote.Id
                }
            });
        }
Пример #2
0
        /// <summary>
        /// <para>Performs the My Trade Me Method:
        /// Creates or updates the note on a listing. POST
        /// </para>
        /// REQUIRES AUTHENTICATION.
        /// </summary>
        /// <param name="request">SaveNoteRequest.</param>
        /// <returns>XDocument: NoteResponse.</returns>
        public XDocument AddNote(SaveNoteRequest request)
        {
            if (_myTradeMe == null)
            {
                _myTradeMe = new MyTradeMeMethods(_connection);
            }

            return _myTradeMe.AddNote(request);
        }
Пример #3
0
        /// <summary>
        /// <para>Performs the My Trade Me Method:
        /// Creates or updates the note on a listing. POST
        /// </para>
        /// REQUIRES AUTHENTICATION.
        /// </summary>
        /// <param name="request">SaveNoteRequest.</param>
        /// <returns>XDocument: NoteResponse.</returns>
        public XDocument AddNote(SaveNoteRequest request)
        {
            var query = String.Format(Constants.Culture, "{0}/{1}{2}", Constants.MY_TRADEME, Constants.NOTES, Constants.XML);

            return(_connection.Post(request, query));
        }
 /// <summary>
 /// <para>Performs the My Trade Me Method:
 /// Creates or updates the note on a listing. POST
 /// </para>
 /// REQUIRES AUTHENTICATION.
 /// </summary>
 /// <param name="request">SaveNoteRequest.</param>
 /// <returns>XDocument: NoteResponse.</returns>
 public XDocument AddNote(SaveNoteRequest request)
 {
     var query = String.Format(Constants.Culture, "{0}/{1}{2}", Constants.MY_TRADEME, Constants.NOTES, Constants.XML);
     return _connection.Post(request, query);
 }