//initialisation function--all notes for a song are generated at the beginning private void GenerateNotes() { string thisNotesCombo = ""; int combinationStepper = 0; for (int i = 0; i < thisSong.GetLength(0); i++) { for (int j = 0; j < thisSong.GetLength(1); j++) { //Starting index 0, we will not be pressing anything anything on the second and fourth beats of a measure, so just put null at that space if (j == 1 || j == 3) { thisSong[i, j] = null; } else { GameObject newNote = Instantiate(notePrefab, noteObjectsParent); NewNote newNoteScript = newNote.gameObject.GetComponent <NewNote>(); //set the properties of each note newNoteScript.SetBeat(j + 1); //must be +1 because the beats are counted from 1~4 newNoteScript.SetMeasure(i + 2); //must be +2 because SimpleClock is set up so that the measures start counting at 2 newNoteScript.SetSprite(thisSongSequence[combinationStepper], noteObjectsParent.transform.position, fretFeedbackScript.gameObject.GetComponent <Transform>().transform.position); //add the note to the 2D array, the combination to the correct combination list thisSong[i, j] = newNote; //newNoteScript.PrintEveryProperty(); thisNotesCombo = ""; combinationStepper++; } } } }
public override void EditObject() { if (base.AllowEdit == false) { base.notAllowEditAction(); return; } DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; Note note = new Note(editId); NewNote frm = new NewNote(note); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateNotes(note); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(editId); MessageBox.Show("Службова оновлена", "Оновлення службової", MessageBoxButtons.OK, MessageBoxIcon.Information); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }
public override void CreateNewObject() { if (base.AllowEdit == false) { base.notAllowEditAction(); return; } NewNote frm = new NewNote(null); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if ((result == DialogResult.OK) && (frm.Note != null)) { bool dbResult = DBContext.InsertNotes(frm.Note); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(frm.Note.Id); MessageBox.Show("Створена нова службова за № " + frm.Note.Id.ToString(), "Строверення службової", MessageBoxButtons.OK, MessageBoxIcon.Information); } AppFuncs.saveToDBResult(dbResult); } frm.Dispose(); base.CreateNewObject(); }
/// <summary> /// Handle the logic to edit note /// </summary> /// <param name="param"></param> async private void EditNote(object param) { var editNote = new NewNote(); editNote.SetNote(SelectedNote); await Navigation.PushAsync(editNote); }
private void UpdateExceptionNewValues(bool bChangeAct, bool bChangePdocno, string newAct, string newPDocNo) { var ChangeField = ""; if (bChangeAct && bChangePdocno) { ChangeField = "ACT changed from " + exception.ACT + " to " + newAct + "/r/n" + "PDOCNO changed from " + PDocNo + " to " + newPDocNo; PDocNo = newPDocNo; } else if (bChangeAct) { ChangeField = "ACT changed from " + exception.ACT + " to " + newAct; } else if (bChangePdocno) { ChangeField = "PDOCNO changed from " + PDocNo + " to " + newPDocNo.Trim(); PDocNo = newPDocNo.Trim(); } //responsenotes information more than 1000 characters will not update the exceptions table. NewNote = NewNote + "\r" + ChangeField + "\r" + exception.RESPONSENOTES.ReplaceNull("").Trim(); if (NewNote.Length > 1000) { NewNote = NewNote.Left(999); } UpdateException(exception, "C", notes.returnVal7, notes.returnVal3, NewNote, ""); }
public void NewNote(string a = "New note", string b = null, string c = null) { NewNote newNote = new NewNote(); newNote.Location = new System.Drawing.Point(400, 100); this.Controls.Add(newNote); newNote.BringToFront(); }
public IActionResult Post([FromBody] NewNote newNote) { if (string.IsNullOrWhiteSpace(newNote.Text)) { return(BadRequest()); } return(Ok(_repository.AddNewNote(newNote))); }
public IHttpActionResult PutAddNote(Guid id, Guid noteId, NewNote note) { if (!ModelState.IsValid) return BadRequest(ModelState); repo_.UpdateClientNote(id, noteId, note.Text); return GetClient(id); } // PutAddNote
/// <inheritdoc /> public Note AddNewNote(NewNote newNote) { var id = !Notes.Any() ? 1 : Notes.Max(n => n.Id) + 1; var note = new Note(id, newNote.Text); Notes.Add(note); return(note); }
/// <summary> /// 增加一条笔记 /// </summary> /// <param name="note"></param> /// <returns></returns> public OneNote CreateNote(NewNote note) { var oneNote = (OneNote)note; oneNote.UserId = CurrentPrincipal.UserId; CurrentDB.OneNoteTable.Add(oneNote); CurrentDB.SaveChanges(); return(note); }
} // PutAddNote private IHttpActionResult addNote(Guid id, NewNote note, NoteType type) { if (!ModelState.IsValid) return BadRequest(ModelState); note.Type = type; repo_.AddClientNote(id, note); return GetClient(id); } // addNotes
/// <inheritdoc/> public Note AddNewNote(NewNote newNote) { using (var context = new NotesContext()) { var note = new Note(0, newNote.Text); context.Notes.Add(note); context.SaveChanges(); return(note); } }
} // DeleteClient public Client AddClientNote(Guid clientid, NewNote note) { var client = clients.Find(clientid); if (client.Notes == null) client.Notes = new List<NoteData>(); client.Notes.Add(note.noteData()); Commit(client); return Client(client.Id); } // AddClientNote
public async Task <IActionResult> Create(NewNote newNote) { if (ModelState.IsValid) { var note = newNote.ToNote(); await _noteService.Create(note); return(RedirectToAction("Details", new { note.Id })); } return(View(newNote)); }
/// <summary> /// 添加笔记 /// </summary> /// <param name="bookId"></param> /// <param name="content"></param> /// <param name="title"></param> /// <returns></returns> public JsonResult AddNote(NewNote note) { if (!ModelState.IsValid) { return(Json(ModelState)); } var oneNote = notebookservice.CreateNote(note); return(Json(oneNote)); }
public async Task PostEmptyNoteReturnsBadRequest() { InMemoryNotesRepository.Notes.Clear(); var newNote = new NewNote { Text = "" }; var bodyContent = new StringContent(JsonConvert.SerializeObject(newNote), Encoding.Default, "application/json"); var response = await _client.PostAsync("/api/notes", bodyContent); Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); }
public IHttpActionResult PostClient(NewClient newClient) { if (!ModelState.IsValid) return BadRequest(ModelState); Client client = repo_.AddNewClient(newClient); client = repo_.AddClientNote(client.Id, NewNote.ClientCreated()); if (!String.IsNullOrWhiteSpace(newClient.Referrer)) client = repo_.AddClientNote(client.Id, new NewNote("Referred by " + newClient.Referrer)); return Ok(client); } // PostClient
public void PostsToTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new NotesClient(connection); var newNote = new NewNote("content"); client.Create(newNote); connection.Received().Post <Note>(Arg.Is <Uri>(u => u.ToString() == "notes"), Arg.Is <NewNote>(d => d.Content == "content")); }
public IHttpActionResult PostClient(NewClient newClient) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Client client = repo_.AddNewClient(newClient); client = repo_.AddClientNote(client.Id, NewNote.ClientCreated()); return(Ok(client)); } // PostClient
public IHttpActionResult PutClient(Guid id, ClientUpdate client) { if (!ModelState.IsValid) return BadRequest(ModelState); if (id != client.Id) return BadRequest(); repo_.Update(client); repo_.AddClientNote(id, NewNote.Log("Updated details")); return GetClient(id); } // PutClient
//function that resets all variables and restarts the rhythm game public void RestartRhythmGame() { //freeze all coroutines Context.CallCoroutine("StopAll"); //rest the clock SimpleClock.Instance.songSource.Stop(); SimpleClock.Instance.SetBPM(138); phase1 = true; phase2 = false; noteCounter = 0; strikes = 0; //reset the fret Context.fretFeedbackScript.SetFret(Context.thisSongSequence[noteCounter]); Context.fretFeedbackScript.ResetFret(); //reset all notes. //notes are not destroyed when they reach the goal, they just turn invisible and teleport somewhere irrelevant, so restarting the rhythm game is just resetting their position for (int i = 0; i < Context.thisSong.GetLength(0); i++) { for (int j = 0; j < Context.thisSong.GetLength(1); j++) { //index out of bounds exception somewhere :' ( if (Context.thisSong[i, j] != null) { NewNote thisNoteScript = Context.thisSong[i, j].gameObject.GetComponent <NewNote>(); thisNoteScript.ResetNote(false, false); } } } //reset hp sprites Context.lifeSpritesController.localScale = new Vector3(0f, 0f, 1f); foreach (GameObject lifeSprite in Context.lifeSprites) { lifeSprite.gameObject.SetActive(true); } Context.ChangeBackground(false, true); started = false; //reset the phaseWindow to Resting, restart with the special case TransitionTo <Phase1>(); Context.orbitterScript.StopRotation(); Context.orbitterScript.ResetPosition(); }
public string FinishCode1(string faxNotes, string faxNotes2, string newAddrName) { var strCuffMemo = NewNote.ReplaceApostrophes(); var allProcess = "Send the FAX ASAP"; if (exception.ERR_CODE == "P040" && exception.ERR_CODE == "P041" || exception.ERR_CODE == "P042") { theMsg = ""; var rtnNot = GetNotificationByExId(exception.EX_ID); //string lcSql = "select * from notifications where ex_id = '" + exception.EX_ID + "'"; if (rtnNot.Count == 0) // _TALLY = 0 { theMsg = "Notification not found. Please Recycle"; } //Uses Address Name from screen...Needs to be passed in now if (String.IsNullOrWhiteSpace(theMsg)) { if (rtnNot[0].ADDNAME.ReplaceNull("") != newAddrName) { //Need user input to determine whether to continue theMsg = "Additional Contact Names have been changed. Do you want to update?"; //a = MESSAGEBOX("Additional Contact Names have been changed. Do you want to update?", 36, "Update names") } } return(theMsg); } else { //FOR THE NOTIFICATION EXCEPTIONS ONLY!!! if (faxNotes != faxNotes2) { exception.FAXNOTES = faxNotes; UpdateNotificationByEXIDToPending(exception.EX_ID); allProcess = "Change Notification FaxNote"; InsertTranshist(exception, "", faxNotes, allProcess, PrepCode); } else { UpdateNotificationByEXIDToPending(exception.EX_ID); } allProcess = "Send the FAX ASAP"; InsertTranshist(exception, "", faxNotes, allProcess, PrepCode); notes.returnVal1 = "SENDASAP"; } return(""); }
public async Task <ActionResult <Note> > PostNote(NewNote note) { Note newNote = new Note(); newNote.Title = note.Title; newNote.Text = note.Text; newNote.Created = DateTime.Now; _context.Note.Add(newNote); await _context.SaveChangesAsync(); return(CreatedAtAction("GetNote", new { id = newNote.Id }, newNote)); }
public async Task PostNewNoteReturnsNoteWithNewId() { InMemoryNotesRepository.Notes.Clear(); var newNote = new NewNote { Text = "test" }; var bodyContent = new StringContent(JsonConvert.SerializeObject(newNote), Encoding.Default, "application/json"); var response = await _client.PostAsync("/api/notes", bodyContent); response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); var resultNote = JsonConvert.DeserializeObject <Note>(responseString); Assert.AreNotEqual(0, resultNote.Id); Assert.AreEqual("test", resultNote.Text); }
public async Task <IActionResult> PostAsync(NewNote newNote) { if (await _noteRepository.GetUserAsync(newNote.AuthorId) is Core.User author) { var note = new Core.Note { Author = author, Text = newNote.Text, Tags = newNote.Tags }; Core.Note result = await _noteRepository.AddNoteAsync(note); Note resource = Mapper.MapNote(result); return(CreatedAtAction(nameof(GetByIdAsync), new { id = note.Id }, resource)); } ModelState.AddModelError(nameof(newNote.AuthorId), "User does not exist"); return(BadRequest(ModelState)); }
public async Task CanCreate() { var pipedrive = Helper.GetAuthenticatedClient(); var fixture = pipedrive.Note; var newNote = new NewNote("content"); newNote.DealId = 1; var note = await fixture.Create(newNote); Assert.NotNull(note); var retrieved = await fixture.Get(note.Id); Assert.NotNull(retrieved); // Cleanup await fixture.Delete(note.Id); }
public async Task CanDelete() { var pipedrive = Helper.GetAuthenticatedClient(); var fixture = pipedrive.Note; var newNote = new NewNote("new-content"); newNote.DealId = 1; var note = await fixture.Create(newNote); var createdNote = await fixture.Get(note.Id); Assert.NotNull(createdNote); await fixture.Delete(createdNote.Id); var deletedNote = await fixture.Get(createdNote.Id); Assert.False(deletedNote.ActiveFlag); }
public async Task CanEdit() { var pipedrive = Helper.GetAuthenticatedClient(); var fixture = pipedrive.Note; var newNote = new NewNote("new-content"); newNote.DealId = 1; var note = await fixture.Create(newNote); var editNote = note.ToUpdate(); editNote.Content = "updated-content"; var updatedNote = await fixture.Edit(note.Id, editNote); Assert.Equal("updated-content", updatedNote.Content); // Cleanup await fixture.Delete(updatedNote.Id); }
private void txtSuggestions_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ListBox senderListBox = sender as ListBox; string text; if (txtSuggestions.ItemsSource != null) { txtSuggestions.Visibility = Visibility.Collapsed; if (txtSuggestions.SelectedIndex != -1) { text = txtSuggestions.SelectedItem.ToString(); if (!NewNote.Text.EndsWith(" ")) { NewNote.Text = NewNote.Text.Remove(NewNote.Text.LastIndexOf(' ') + 1); } NewNote.AppendText(text + " "); NewNote.Focus(); NewNote.SelectionStart = NewNote.Text.Length; } } }
public async Task <IHttpActionResult> FileUpload(Guid id) { if (!Request.Content.IsMimeMultipartContent()) { return(BadRequest()); } var provider = GetMultipartProvider(); var result = await Request.Content.ReadAsMultipartAsync(provider); var fileData = result.FileData.First(); var fileName = fileData.Headers.ContentDisposition.FileName; fileName = fileName.Replace("\"", "").Replace("'", ""); var note = NewNote.FileUpload(fileName); await saveUpload(id, note.Id, fileData); repo_.AddClientNote(id, note); return(GetClient(id)); } // FileUpload