private NotesViewModel getNotesViewModel() { NotesViewModel notesViewModel = new NotesViewModel(); notesViewModel.NotesList = null; List <NotesData> objNotes = NotesData.GetNoteList(Convert.ToInt32(Session["userid"])); if (objNotes != null) { for (int i = 0; i < objNotes.Count; i++) { NotesModel notesModel = new NotesModel(); notesModel.Note = objNotes[i].UserNote; notesModel.NoteID = objNotes[i].NoteID; notesModel.UpdatedDate = objNotes[i].UpdatedDate; notesModel.CreatedDate = objNotes[i].CreatedDate; notesModel.UserName = Session["username"].ToString(); if (notesViewModel.NotesList == null) { new List <NotesModel>(); } notesViewModel.NotesList.Add(notesModel); } } return(notesViewModel); }
public static Task SaveNotesToJson(NotesData newData) { string jsonNotice = JsonConvert.SerializeObject(newData); File.WriteAllText(jsonFilePath, jsonNotice); return(Task.CompletedTask); }
/// <summary> /// Deletes the forever. /// </summary> /// <param name="notes">The notes.</param> /// <param name="key">The key.</param> /// <param name="uid">The id.</param> public async void DeleteForever(NotesData notes, string key, string uid) { try { if (notes.IsCollaborated == false) { //// Deletes the notes from the firebase await this.firebase.Child("Persons").Child(uid).Child("Notes").Child(key).DeleteAsync(); } else { var users = await firebase.Child("Persons").OnceAsync <SignUpUserData>(); foreach (var items in users) { var noteCollabrator = await firebase.Child("Persons").Child(items.Key).Child("Notes").OnceAsync <NotesData>(); foreach (var item in noteCollabrator) { if (item.Key == notes.Key) { await this.firebase.Child("Persons").Child(items.Key).Child("Notes").Child(key).DeleteAsync(); } } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public ActionResult AddNote(NotesModel model) { if (string.IsNullOrWhiteSpace(model.Note)) { ViewBag.error = "Empty Note"; return(View("NoteList", getNotesViewModel())); } NotesData notesData = new NotesData(); notesData.UserID = Convert.ToInt32(Session["userid"]); notesData.UserNote = model.Note; notesData.NoteID = model.NoteID; try { ((IPersistable)notesData).Save(); } catch (Exception ex) { ViewBag.error = "Error in Save : " + ex.ToString(); return(View("NoteList", getNotesViewModel())); } return(View("NoteList", getNotesViewModel())); }
/// <summary> /// Gets the notes data. /// </summary> /// <param name="key">The key.</param> /// <param name="uid">The id.</param> /// <returns>returns Task</returns> public async Task <NotesData> GetNotesData(string key, string uid) { //// Returns the notes from the firebase NotesData notes = await this.firebase.Child("Persons").Child(uid).Child("Notes").Child(key).OnceSingleAsync <NotesData>(); return(notes); }
private void NotesDataSaveToJson(NotesData data) { // Path Setting : Application.dataPath/SongDatas/[songName]/NotesData.txt string path = Path.Combine(Application.dataPath, "SongDatas"); // Directory : SongDatas if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // Directory : [songName] path = Path.Combine(path, GameInfo.songName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // File : NotesData.txt path = Path.Combine(path, "NotesData" + ".txt"); // Data To Json String string jsonInfo = JsonUtility.ToJson(data, true); // Json String Save in text file File.WriteAllText(path, jsonInfo); Debug.Log("寫入完成"); Debug.Log("dataPath: " + path); }
public HttpResponseMessage Get(string login, string password) { Entities entities = new Entities(); List <Note> notes = entities.GetNotes(login, password); //Convert the notes entity into a more "NotesData" more friendly for JSON var resp = new HttpResponseMessage(HttpStatusCode.OK); if (notes != null) { List <NotesData> md = new List <NotesData>(); foreach (var item in notes) { NotesData nd = new NotesData() { NoteId = item.Id, Name = item.Title, Content = item.Text }; md.Add(nd); } resp.Content = new StringContent(JsonConvert.SerializeObject(md), Encoding.UTF8, "text/plain"); } return(resp); }
/// <summary> /// Application developers can override this method to provide behavior when the back button is pressed. /// </summary> /// <returns> /// To be added. /// </returns> protected override bool OnBackButtonPressed() { try { FirebaseHelper firebaseHelper = new FirebaseHelper(); //// Adds notes to the firebase NotesData notes = new NotesData() { Title = txtTitle.Text, Notes = txtNotes.Text, ColorNote = this.noteColor, LabelData = new List <string>() }; this.firebaseHelper.AddNote(notes); //// If it is successfull displays mesaage this.DisplayAlert("Success", "Notes added successfully", "ok"); base.OnBackButtonPressed(); } catch (Exception e) { Console.WriteLine(e.Message); } return(false); }
private void modify_Click(object sender, EventArgs e) { Modify d = Modify.GetModify(); PictureBox b = sender as PictureBox; Json j = new Json(); string ID = b.Name.Split('_')[1]; NotesData n = j.getNote(ID); try { TextBox Title = d.Controls.Find("Title", true)[0] as TextBox; Title.Text = n.Title; TextBox Note = d.Controls.Find("Note", true)[0] as TextBox; Note.Text = n.Note; Label label = d.Controls.Find("label1", true)[0] as Label; label.Text = n.ID.ToString(); } catch { throw new Exception(); } d.Show(); this.Close(); this.Dispose(); //else //{ // DialogResult result = MessageBox.Show("修改失败", "操作提示", MessageBoxButtons.OKCancel); //} }
/// <summary> /// Handles the CheckChanged event of the CheckBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private async void CheckBox_CheckChanged(object sender, EventArgs e) { var checkbox = (CheckBox)sender; //// Checks if the checkbox is checked if (checkbox.IsChecked) { //// Assigns color to the checkbox when ticked checkbox.Color = Color.Black; //// Gets the description of the checkbox when checked string item = checkbox.Text; //// Gets the currents user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Gets the notes data choosen NotesData notes = await this.firebaseHelper.GetNotesData(this.key, userid); notes.LabelData.Add(item); this.noteModel = new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData }; //// Updates it to the firebase this.firebaseHelper.AddLabelToNotes(this.key, this.noteModel); } }
/// <summary> /// Handles the Clicked event of the Delete control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void Delete_Clicked(object sender, EventArgs e) { try { FirebaseHelper firebaseHelper = new FirebaseHelper(); //// Gets the current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Delets the data from trash and from database NotesData notes = new NotesData() { Title = txtTitle.Text, Notes = txtNotes.Text, ColorNote = this.noteColor, LabelData = this.labelList, Area = this.area, IsCollaborated = this.collaborate, Key = this.val }; firebaseHelper.DeleteForever(notes, this.val, userid); } catch (Exception err) { Console.WriteLine(err.Message); } }
/// <summary> /// Updates the pin data. /// </summary> public async void UpdatePinData() { try { FirebaseHelper firebaseHelper = new FirebaseHelper(); //// Gets current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); ////Gets the notes data NotesData notesData = await firebaseHelper.GetNotesData(this.value, userid); txtTitle.Text = notesData.Title; txtNotes.Text = notesData.Notes; this.noteColor = notesData.ColorNote; this.listLabel = notesData.LabelData; this.area = notesData.Area; this.BackgroundColor = Color.FromHex(SetColor.GetHexColor(notesData)); this.collaborate = notesData.IsCollaborated; } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// Application developers can override this method to provide behavior when the back button is pressed. /// </summary> /// <returns> /// To be added. /// </returns> protected override bool OnBackButtonPressed() { try { FirebaseHelper firebaseHelper = new FirebaseHelper(); //// Gets current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Updates the notes whenUpdateNotes method is called NotesData notes = new NotesData() { Title = txtTitle.Text, Notes = txtNotes.Text, ColorNote = this.noteColor, LabelData = this.listLabel, Area = this.area, IsCollaborated = this.collaborate, Key = this.value }; firebaseHelper.UpdateNotes(notes, this.value, userid); } catch (Exception e) { Console.WriteLine(e.Message); } return(base.OnBackButtonPressed()); }
public static GameObject CreateNotesObject(GameObject notesPrefab, NotesData notesData) { GameObject obj = Instantiate <GameObject>(notesPrefab); NotesBehaviour notes = obj.GetComponent <NotesBehaviour>(); notes.NotesData = notesData; return(obj); }
public void Start() { notesData = GetComponentInChildren <NotesData>(); data = new[] { 0, 0, 0, 0, 1, 1, 1, 1 }; manager.musician = this; observer = GetComponentInParent <BeatObserver>(); observer.WhenBeat += AdvanceAnim; }
private void Awake() { StartCoroutine(LoadImageFromFile()); notesDataToLoad = NotesDataLoadedFromJson(); SetLoadedDataToAllRecorder(); }
private void OnSaveBtnClicked() { notesDataToSave = new NotesData(); #region data notesDataToSave.circleNote_Single1 = ListToArray(circleRecorders[0].singleNote); notesDataToSave.circleNote_Single2 = ListToArray(circleRecorders[1].singleNote); notesDataToSave.circleNote_Single3 = ListToArray(circleRecorders[2].singleNote); notesDataToSave.circleNote_Single4 = ListToArray(circleRecorders[3].singleNote); notesDataToSave.circleNote_Single5 = ListToArray(circleRecorders[4].singleNote); notesDataToSave.singleNote1 = ListToArray(noteRecorders[0].singleNote); notesDataToSave.longNoteStart1 = ListToArray(noteRecorders[0].longNoteStart); notesDataToSave.longNoteEnd1 = ListToArray(noteRecorders[0].longNoteEnd); notesDataToSave.singleNote2 = ListToArray(noteRecorders[1].singleNote); notesDataToSave.longNoteStart2 = ListToArray(noteRecorders[1].longNoteStart); notesDataToSave.longNoteEnd2 = ListToArray(noteRecorders[1].longNoteEnd); notesDataToSave.singleNote3 = ListToArray(noteRecorders[2].singleNote); notesDataToSave.longNoteStart3 = ListToArray(noteRecorders[2].longNoteStart); notesDataToSave.longNoteEnd3 = ListToArray(noteRecorders[2].longNoteEnd); notesDataToSave.singleNote4 = ListToArray(noteRecorders[3].singleNote); notesDataToSave.longNoteStart4 = ListToArray(noteRecorders[3].longNoteStart); notesDataToSave.longNoteEnd4 = ListToArray(noteRecorders[3].longNoteEnd); notesDataToSave.singleNote5 = ListToArray(noteRecorders[4].singleNote); notesDataToSave.longNoteStart5 = ListToArray(noteRecorders[4].longNoteStart); notesDataToSave.longNoteEnd5 = ListToArray(noteRecorders[4].longNoteEnd); #endregion NotesDataSaveToJson(notesDataToSave); //-------------------------------------------- SongData data = new SongData(); data.songName = GetComponent <Recorder>().songSelected; data.songBPM = RecordConductor.instance.songBPM; data.songLength = RecordConductor.instance.songAudioSource.clip.length; data.songDifficulty = SongDifficulty.Hard; data.maxCombo = MaxCombo(); data.maxScore = MaxCombo() * 500; SongDataSaveToJson(data); //-------------------------------------------- }
private async void Store(Note note, Action AsynFunc) { var dbNote = new NotesData { Text = note.Text, Media = new List <Media>() }; database.Insert(dbNote); foreach (var media in note.Media) { string url; var extension = Path.GetExtension("../Documents/" + media.Name); if (extension.StartsWith(".")) { extension = extension.Substring(1); } using (var httpClient = new HttpClient()) { using (var fileStream = File.OpenRead("../Documents/" + media.Name)) { var content = new StreamContent(fileStream); content.Headers.Add("Content-Type", MimeTypesHelper.MimeTypes[extension]); content.Headers.Add("x-ms-blob-type", "BlockBlob"); using (var uploadResponse = await httpClient.PutAsync(media.Location, content)) { var request = new RestRequest("api/dossier/{dosierId}/Notes/{noteId}/media/{id}", Method.PUT); request.RequestFormat = DataFormat.Json; request.AddUrlSegment("noteId", note.Id.ToString()); request.AddUrlSegment("dosierId", database.getCurrentDossier().ToString()); request.AddUrlSegment("id", media.Id.ToString()); request.AddHeader("Authorization", "bearer " + database.accessToken); request.AddBody(media); var resp = client.Execute <NoteMedia>(request); var noteMedia = new Media { mediaId = resp.Data.Id, Name = resp.Data.Name, Location = resp.Data.Location }; dbNote.Media.Add(noteMedia); database.Update(dbNote); } } } } AsynFunc(); }
public IHttpActionResult PutNotesData(string id, NotesData notesData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if ((notesData.GuidID == null || notesData.GuidID == new Guid())) { return(BadRequest("Invalid notes key values")); } Guid guidOutput; if (Guid.TryParse(notesData.GuidID.ToString(), out guidOutput) == true) { //Check if latest Notes exists prior to updating the version //NotesData note = VerifyNotesTimestamp(notesData.GuidID); //if (note.UpdateDate > notesData.UpdateDate || notesData.UpdateDate == null) //{ // return BadRequest("update date mismatch"); //} notesData.UpdateDate = DateTime.Now; db.Entry(notesData).State = EntityState.Modified; } else { return(BadRequest("Invalid Note key")); } try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NotesDataExists(id, notesData.GuidID)) { return(NotFound()); } else { return(BadRequest("Error in updating notes")); } } return(Content(HttpStatusCode.Created, notesData)); }
private async void SaveButton(object sender, EventArgs e) { var collabPerson = txtMail.Text; var users = await firebase.Child("Persons").OnceAsync <SignUpUserData>(); IList <string> mail = new List <string>(); string uid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); foreach (var items in users) { if (items.Key.ToString() != uid) { var email = await firebase.Child("Persons").Child(items.Key).Child("userinfo").OnceAsync <SignUpUserData>(); foreach (var item in email) { var emailDetails = item.Object.Email; // var emailId = item.Key; id = items.Key; if (txtMail.Text == emailDetails) { //lstEmails.ItemsSource = emailDetails; NotesData notes = await this.firebaseHelper.GetNotesData(this.value, uid); //// Updates the notes when DeleteNotes method is called notes = new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData, Latitude = notes.Latitude, Longitude = notes.Longitude, Area = notes.Area, IsCollaborated = true }; await firebase.Child("Persons").Child(this.id).Child("Notes").Child(value).PutAsync(new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData, IsCollaborated = true }); await firebase.Child("Persons").Child(uid).Child("Notes").Child(value).PutAsync(new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData, IsCollaborated = true }); } } } } }
private void Awake() { songsInFolder = GetAllSongsFromFolder(); notesDataToLoad = NotesDataLoadedFromJson(songsInFolder[0]); recorderSongData = SongDataLoadedFromJson(songsInFolder[0]); RecordConductor.instance.songBPM = recorderSongData.songBPM; StartCoroutine(SetAudioFromFileToConductor(songsInFolder[0])); SetLoadedDataToAllRecorder(); }
/// <summary> /// Handles the Clicked event of the ImageButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ImageButton_Clicked(object sender, EventArgs e) { NotesData notes = new NotesData() { Title = txtTitle.Text, Notes = txtNotes.Text, ColorNote = this.noteColor, LabelData = this.listLabel, Area = this.area, IsCollaborated = this.collaborate, }; PopupNavigation.Instance.PushAsync(new PopTaskView(this.value, notes)); }
/// <summary>This class return notes object based on noteID</summary> /// <param name="noteID">int</param> /// <returns>User object</returns> public static List <NotesData> ReadNoteList(int userID) { // Create Instance of Connection and Command Object SqlConnection myConnection = new SqlConnection(ConnectionString.GetConnectionString()); SqlCommand myCommand = new SqlCommand("spGetNotesList", myConnection); // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter param = new SqlParameter("@intUserID", SqlDbType.Int, 4); param.Value = userID; myCommand.Parameters.Add(param); myConnection.Open(); SqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); List <NotesData> list = null; NotesData data = null; try { while (myReader.Read()) { if (list == null) { list = new List <NotesData>(); } data = new NotesData(); data.NoteID = (int)myReader["intNoteID"]; data.UserID = (int)myReader["intUserID"]; data.UserNote = (string)myReader["strUserNote"]; data._createdDate = (DateTime)myReader["dteCreatedDate"]; data._updatedDate = (DateTime)myReader["dteUpdatedDate"]; list.Add(data); } } finally { if (myReader != null) { myReader.Close(); } } return(list); }
/// <summary> /// Handles the Clicked event of the Button control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private async void Button_Clicked(object sender, EventArgs e) { FirebaseHelper firebaseHelper = new FirebaseHelper(); //// Gets the current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); NotesData notesData = await firebaseHelper.GetNotesData(this.value, userid); await Share.RequestAsync(new ShareTextRequest { Text = notesData.Notes, Title = "Share Text" }); await PopupNavigation.Instance.PopAsync(true); }
public IHttpActionResult PostNotesData(NotesData notesData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //We are creating new note for userid. so no mote data should be provided. if (string.IsNullOrEmpty(notesData.UserID)) { return(BadRequest("Invalid key values")); } //if (!NotesDataExists(notesData.UserID)) //{ // return BadRequest("User doesn't exists"); //} if (notesData.GuidID == new Guid()) { notesData.GuidID = Guid.NewGuid(); } notesData.UpdateDate = DateTime.Now; notesData.Createdate = DateTime.Now; db.NotesDatas.Add(notesData); try { db.SaveChanges(); } catch (DbUpdateException) { if (NotesDataExists(notesData.UserID, notesData.GuidID)) { return(Conflict()); } else { throw; } } return(Content(HttpStatusCode.Created, notesData)); //CreatedAtRoute("DefaultApi", new { id = notesData.UserID }, notesData); }
/// <summary> /// Adds the location area. /// </summary> /// <param name="key">The key.</param> /// <param name="notes">The notes.</param> /// <param name="address">The address.</param> public async void AddLocationArea(string key, NotesData notes, string address, string latitude, string longitude) { //// Gets the current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Updates the notesdata by fetching the loaction from the user await this.firebase.Child("Persons").Child(userid).Child("Notes").Child(key).PutAsync(new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData, Latitude = latitude, Longitude = longitude, Area = address }); }
//初期化関数 private void Init() { data_TITLE = null; data_SUBTITLE = null; data_AUDIO = null; data_ARTIST = null; data_OFFSET = 0f; data_BPM = new List <BPMS>(); data_KEY = 0; data_DIFFICULT = null; data_LEVEL = 0; data_STOP = new List <STOPS>(); data_GIMMICK = new List <GIMMICKS>(); data_MOVETYPE = 0; notesData = new NotesData(); }
/// <summary> /// archive data. /// </summary> public async void UnArchiveData() { FirebaseHelper firebaseHelper = new FirebaseHelper(); //// Gets the current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Gets all notes data from firebase NotesData notesData = await firebaseHelper.GetNotesData(this.val, userid); txtTitle.Text = notesData.Title; txtNotes.Text = notesData.Notes; this.noteColor = notesData.ColorNote; this.labelList = notesData.LabelData; this.area = notesData.Area; this.BackgroundColor = Color.FromHex(SetColor.GetHexColor(notesData)); this.collabarate = notesData.IsCollaborated; }
/// <summary> /// Adds the label to notes. /// </summary> /// <param name="key">The key.</param> /// <param name="notes">The notes.</param> public void AddLabelToNotes(string key, NotesData notes) { try { //// Gets the current user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Adds the label to the notes choosen this.firebase.Child("Persons").Child(userid).Child("Notes").Child(key).PutAsync(new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData, Area = notes.Area }); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// Adds the note. /// </summary> /// <param name="notes">The notes.</param> public void AddNote(NotesData notes) { try { //// Getting the user id var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId(); //// Adding notes given id this.firebase.Child("Persons").Child(userid).Child("Notes").PostAsync(new NotesData() { Title = notes.Title, Notes = notes.Notes, ColorNote = notes.ColorNote, LabelData = notes.LabelData, Area = notes.Area }); } catch (Exception ex) { Console.WriteLine(ex.Message); } }