Ejemplo n.º 1
0
 public void AddNoteToDB(Entities.Note note)
 {
     note.content = note.content.Replace('\'', '"');
     Entities.Note loadNote = manager.SearchIssueNote(note.issueNumber);
     if (loadNote != null)
     {
         manager.UpdateNote(note);
     }
     else
     {
         manager.AddNote(note);
     }
 }
Ejemplo n.º 2
0
        public NoteOperationResponse Post([FromBody]  NoteOperationRequest request)
        {
            var result = new NoteOperationResponse()
            {
                OperationStatus = NoteOperationStatus.CreatorNotFound
            };

            if (_creatorsManager.Exists(request.Id))
            {
                result.OperationStatus = _notesManager.AddNote(request.Id, request.Content);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> AddNote([FromBody] NoteAdd noteModel)
        {
            if (!ModelState.IsValid)
            {
                return(_outputFactory.CreateJsonFail(ModelState));
            }

            var user = await _userManager.GetUserAsync(User);

            var addValid = _notesValidator.ValidateAddNote(noteModel, user);

            if (addValid.IsSuccess)
            {
                var note = await _notesMng.AddNote(addValid.NoteToAdd);

                return(Json(_outputFactory.CreateNote(note, noteModel.SecretKey)));
            }
            else
            {
                addValid.ErrorsToModelState(ModelState);
                return(Json(_outputFactory.CreateJsonFail(ModelState)));
            }
        }
Ejemplo n.º 4
0
        public void Confirm()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Note))
                {
                    throw new ArgumentNullException("Note cannot be empty");
                }

                if (!string.IsNullOrWhiteSpace(Constants.Note_ID))
                {
                    var note = _notesManager.Get_NoteByID <Notes>(Constants.Note_ID);
                    if (note != null)
                    {
                        note.Subject     = Subject;
                        note.Description = Note;

                        _notesManager.UpdateNote(note);
                        MessagingCenter.Send <NotesCreatorViewModel, Notes>(this, _UpdateNote, note);
                    }
                    else
                    {
                        var obj = new Notes();
                        obj.Contact_ID_Ref  = Constants.InMemory_ContactID;
                        obj.Content_ID_Ref  = Guid.NewGuid().ToString();
                        obj.Description     = Note;
                        obj.Subject         = Subject;
                        obj.Sys_Creation    = DateTime.Now;
                        obj.Sys_Transaction = DateTime.Now;

                        _notesManager.AddNote(obj);
                        MessagingCenter.Send <NotesCreatorViewModel, Notes>(this, _SendNote, obj);
                    }
                }
                else
                {
                    var obj = new Notes();
                    obj.Contact_ID_Ref  = Constants.InMemory_ContactID;
                    obj.Content_ID_Ref  = Guid.NewGuid().ToString();
                    obj.Description     = Note;
                    obj.Subject         = Subject;
                    obj.Sys_Creation    = DateTime.Now;
                    obj.Sys_Transaction = DateTime.Now;

                    _notesManager.AddNote(obj);
                    MessagingCenter.Send <NotesCreatorViewModel, Notes>(this, _SendNote, obj);
                }

                //Pop to previous page
                if (navigation != null)
                {
                    navigation.GoBackAsync(true);
                }
            }
            catch (Exception ex)
            {
                string eMessage    = string.Empty;
                string eStackTrace = string.Empty;

                if (ex.InnerException != null)
                {
                    eMessage    = ex.InnerException.Message;
                    eStackTrace = ex.InnerException.StackTrace;
                }
                else
                {
                    eMessage    = ex.Message;
                    eStackTrace = ex.StackTrace;
                }

                var mEx = new Exceptions(logging, eMessage, eStackTrace);
                if (mEx != null)
                {
                    mEx.HandleException(mEx, logging);
                }

                //Output a dialogue here
                if (dialogue != null)
                {
                    dialogue.ShowAlert("mmm...Something went wrong", mEx.Message);
                }
            }
        }
Ejemplo n.º 5
0
 public void AddNote(Note note)
 {
     notesManager.AddNote(note);
 }