private static void SetEventToSetCursor(MadcaDisplay display, NoteBook noteBook, IReadOnlyEditorStatus status) { var box = display.PictureBox; var env = display.EditorLaneEnvironment; box.MouseMove += (s, e) => { if (status.EditorMode != EditorMode.Edit) { box.Cursor = Cursors.Default; return; } if (!GetSelectedNote(e.Location, display, noteBook, out var note)) { box.Cursor = Cursors.Default; return; } var area = note.SelectedNoteArea(e.Location, env); if (area == SelectedNoteArea.Left || area == SelectedNoteArea.Right) { box.Cursor = Cursors.SizeWE; return; } if (area == SelectedNoteArea.Center) { box.Cursor = Cursors.SizeAll; return; } box.Cursor = Cursors.Default; }; }
public async Task <int> DeleteNoteBook(int id) { NoteBook noteBook = await GetNoteBook(id); _repository.Delete(noteBook); return(await _repository.Save()); }
public async Task <IHttpActionResult> PutNoteBook(int id, NoteBook noteBook) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != noteBook.NoteBookId) { return(BadRequest()); } db.Entry(noteBook).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoteBookExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private static NoteBookDTO NoteBookToDTO(NoteBook noteBook) { NoteBookDTO noteBookDTO = new NoteBookDTO(); // Initialize NoteBookDTO noteBookDTO.id = noteBook.Id; noteBookDTO.title = noteBook.Title; if (noteBook.NoteLists == null) { noteBookDTO.noteLists = null; } else { List <NoteListDTO> noteListDTOs = new List <NoteListDTO>(); // Convert NoteLists to NoteListDTOs, and add to noteListDTOs foreach (NoteList noteList in noteBook.NoteLists) { noteListDTOs.Add(NoteListToDTO(noteList)); } noteBookDTO.noteLists = noteListDTOs.ToArray(); } return(noteBookDTO); }
protected void Save_Btn(object sender, EventArgs e) { if (string.IsNullOrEmpty(base.Request.QueryString["nid"])) { NoteBookInfo noteBookInfo = new NoteBookInfo(); noteBookInfo.AddTime = DateTime.Now; noteBookInfo.Bodys = this.Bodys.Value; noteBookInfo.DepName = this.DepName; noteBookInfo.RealName = this.RealName; noteBookInfo.UserID = Convert.ToInt32(this.Uid); noteBookInfo.Subject = this.Subject.Value; NoteBook.Init().Add(noteBookInfo); } else { NoteBookInfo noteBookInfo = this.ViewState["ni"] as NoteBookInfo; noteBookInfo.AddTime = DateTime.Now; noteBookInfo.Bodys = this.Bodys.Value; noteBookInfo.Subject = this.Subject.Value; NoteBook.Init().Update(noteBookInfo); } string str = HttpContext.Current.Server.HtmlEncode("您好!记事便笺保存成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=../Manage/Common/NoteBook_List.aspx&tip=" + str); }
public async Task <IActionResult> DeleteNoteBook(long noteBookId) { NoteBook noteBook = await _context.NoteBooks .Include(nb => nb.NoteLists) .FirstOrDefaultAsync(nb => nb.Id == noteBookId); if (noteBook == null) { return(NotFound()); } foreach (NoteList noteList in noteBook.NoteLists) { // Create new note obj with Notes loaded. NoteList noteListObj = await _context.NoteLists .Include(nl => nl.Notes) .FirstOrDefaultAsync(nl => nl.Id == noteList.Id); if (noteListObj == null) { return(NotFound()); } foreach (Note note in noteListObj.Notes) { _context.Notes.Remove(note); } _context.NoteLists.Remove(noteListObj); } _context.NoteBooks.Remove(noteBook); await _context.SaveChangesAsync(); return(NoContent()); }
public async Task <NoteBook> CreateNoteBook(NoteBook noteBook) { _repository.AddAnEntityAsync(noteBook); await _repository.Save(); return(noteBook); }
public ActionResult EditNote(long?id) { string userEmail = User.Identity.Name; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Note note = dataRepository.NoteRepository.GetNoteById((long)id, User.Identity.Name); if (note == null) { return(HttpNotFound()); } NoteBook aNotebook = dataRepository.NotebookRepository.GetNotebookByEmail(userEmail); if (aNotebook.CurrentNote == null || aNotebook.CurrentNote != id) { aNotebook.CurrentNote = id; dataRepository.NotebookRepository.UpdateNotebook(userEmail, aNotebook); dataRepository.NotebookRepository.Save(); } return(View("EditNote", note)); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { var query = (String)navigationParameter; var list = NotesDataSource.Search(query); this.pageTitle.Text = string.Format("Results for \"{0}\"", query); var nb = new NoteBook(); foreach (NoteDataCommon note in list) { switch (note.Type) { case DataModel.NoteTypes.Food: nb.FoodSection.Add(note); break; case DataModel.NoteTypes.ToDo: nb.ToDoSection.Add(note); break; default: nb.NotesSection.Add(note); break; } } this.DefaultViewModel["Groups"] = nb.Sections; }
private static void SetEventToPutNote( MadcaDisplay display, NoteBook noteBook, IReadOnlyList <IReadOnlyScore> scores, OperationManager opManager, IReadOnlyEditorStatus status) { var box = display.PictureBox; var laneEnv = display.EditorLaneEnvironment; box.MouseDown += (s, e) => { if (status.EditorMode != EditorMode.Add || status.NoteMode == NoteMode.Hold || status.NoteMode == NoteMode.Field) { return; } var area = laneEnv.GetEditorLaneRegion(e.Location); if (area == EditorLaneRegion.Lane && e.Button == MouseButtons.Left) { var res = PositionConverter.ConvertRealToVirtual(laneEnv, e.Location, status.BeatStride, scores, out Position position); if (!res) { return; } var note = MyUtil.NoteFactory(position.Lane, position.Timing, new NoteSize(status.NoteSize), status.NoteMode); if (note is null) { return; } // HACK: この辺の処理どうしようかな opManager.AddAndInvokeOperation(new AddShortNoteOperation(noteBook, note)); } }; }
public MainPage() { this.InitializeComponent(); _noteBook = NoteBook.getInstance(); _cardsToShow = new List <Card>(); if (SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility == AppViewBackButtonVisibility.Visible) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } _questionShowing = true; // Do stuff here to set the dropdownList values etc topicChooser.ItemsSource = _noteBook.getTopicNames(); if (_noteBook.getTopicCount() != 0) { topicChooser.SelectedIndex = _noteBook.getCurrentTopicNum(); _previousIndex = 0; _currentTopic = _noteBook.getTopic((string)topicChooser.SelectedItem); _cardsToShow = _currentTopic.getAllCards(); _currentCard = _cardsToShow.Count - 1; } if (_currentTopic != null) { changeCards(); } // Add a subscriber to the loaded action for whenever the app loads Loaded += initializeScreen; }
public async void HasRenamed(NoteBook notebook) { //using(SQLiteConnection connection=new SQLiteConnection(DataBaseHelper.dbfile)) //{ // var updatedresult=DataBaseHelper.Update<NoteBook>(notebook); // if (updatedresult) // { // IsEditing = false; // getNoteBooks(); // } // else // { // Console.WriteLine("Error in updating notebook"); // } //} try { await App.MobileServiceClient.GetTable <NoteBook>().UpdateAsync(notebook); IsEditing = false; getNoteBooks(); } catch (Exception e) { Console.WriteLine("Error in updating Notebook" + e.Message); } }
public async Task <ActionResult <NoteBook> > AddNewNoteBook(NoteBook noteBook, int count) { try { noteBook.ReleaseDate = DateTime.Now; await _context.NoteBooks.AddAsync(noteBook); await _context.SaveChangesAsync(); List <NoteBookSerial> noteBookSerials = new List <NoteBookSerial>(); for (int i = 1; i <= count; i++) { noteBookSerials.Add(new NoteBookSerial { NoteBookId = noteBook.Id, QRcode = Guid.NewGuid() }); } await _context.NoteBookSerials.AddRangeAsync(noteBookSerials); await _context.SaveChangesAsync(); foreach (var item in noteBookSerials) { item.NoteBook = null; } noteBook.NoteBookFeatures = null; noteBook.NoteBookSerials = noteBookSerials; return(Ok(noteBook)); } catch (Exception ex) { throw; } }
public void TestGetAllNotebooks() { // Arrange var service = new Mock <NoteBookService>(); List <Note> notebookOneNotes = new List <Note>(); NoteBook noteBookOne = new NoteBook() { Id = 1, Title = "First Notebook", Notes = notebookOneNotes }; notebookOneNotes.Add(new Note { Id = 1, Text = "Note One", Notebook = noteBookOne, NoteBookId = 1 }); notebookOneNotes.Add(new Note { Id = 2, Text = "Note Two", Notebook = noteBookOne, NoteBookId = 1 }); List <Note> notebookTwoNotes = new List <Note>(); NoteBook noteBookTwo = new NoteBook() { Id = 2, Title = "Second Notebook", Notes = notebookTwoNotes }; notebookTwoNotes.Add(new Note { Id = 3, Text = "Note Three", Notebook = noteBookTwo, NoteBookId = 2 }); notebookTwoNotes.Add(new Note { Id = 4, Text = "Note Four", Notebook = noteBookTwo, NoteBookId = 2 }); List <NoteBook> notebooks = new List <NoteBook>(); notebooks.Add(noteBookOne); notebooks.Add(noteBookTwo); Task <List <NoteBook> > taskNoteBookList = Task <List <NoteBook> > .Factory.StartNew(() => notebooks); service.Setup(service => service.GetAllNoteBooks()).Returns(taskNoteBookList); List <NoteBookWithoutNotesDto> expected = new List <NoteBookWithoutNotesDto>(); expected.Add(new NoteBookWithoutNotesDto() { Id = 1, Title = "First Notebook" }); expected.Add(new NoteBookWithoutNotesDto() { Id = 2, Title = "Second Notebook" }); // Act NoteBookController noteBookController = new NoteBookController(logger, service.Object, imapper); var actual = noteBookController.GetAllNoteBooksAsync(); // Assert Assert.AreEqual(expected, actual.Result); }
/// <summary> /// 「書き込む」ボタン実行時処理。 /// </summary> /// <param name="parameter">コマンドパラメータ。常に null。</param> /// <remarks> /// 入力された日時とメモを DB に書き込んだ後、 DB テーブルの新たな内容を /// 取得するためのデータオブジェクトを生成し直してデータグリッドに反映する /// ということをやっている、らしいですよ。 /// </remarks> private void OnWrite(object parameter) { using (var book = new NoteBook()) { book.AppendNote(NoteDateTime.DateTimeValue.Value, note_detail); } DateTimeNotes = new NoteListType(); }
private void Show() { NoteBookInfo byId = NoteBook.Init().GetById(Convert.ToInt32(base.Request.QueryString["nid"])); this.Bodys.Value = byId.Bodys; this.Subject.Value = byId.Subject; this.ViewState["ni"] = byId; }
public NoteBook CreateBook(string title) { using (var context = _contextManager.GetContext()) { var book = new NoteBook(title); context.Add(book); context.SaveChanges(); return book; } }
void Awake() { #region singleton if(instance == null) { instance = this; } else if(instance != this) { Destroy(gameObject); } #endregion #region component initializations pause = GetComponent<PauseMenu>(); notebook = gameObject.GetComponentInChildren<NoteBook>(); movement = GetComponent<MovementManager> (); interaction = GetComponent<InteractionManager> (); #endregion }
void Awake() { #region singleton if(instance == null) { instance = this; } else if(instance != this) { Destroy(gameObject); } #endregion clueManager = GameObject.FindGameObjectWithTag("ClueManager").GetComponent<ClueManager>(); interaction = GameObject.FindGameObjectWithTag("Player").GetComponent<InteractionManager>(); }