Example #1
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        NotesBLL notes = new NotesBLL();

        TimeKeeper.NotesDataTable note = notes.GetNoteByUserID((int)Session["UserID"]);

        if (NoteLabel.Text == "Empty")
        {
            if (notes.AddNote((int)Session["UserID"], NotesTextBox.Text))
            {
                NoteLabel.Text         = "Why? " + NoteLabel.Text.ToString();
                NotesTextBox.BackColor = System.Drawing.Color.White;
            }
            else
            {
                NoteLabel.Text = "Could not create a new note for today!";
            }
        }
        else
        {
            if (NotesTextBox.Text.ToString().Length == 0)
            {
                notes.DeleteNote((int)Session["NoteID"]);
            }
            else if (notes.UpdateNote((int)Session["UserID"], NotesTextBox.Text, (int)Session["NoteID"]))
            {
                NoteLabel.Text         = "Note updated!";
                NotesTextBox.BackColor = System.Drawing.Color.White;
            }
            else
            {
                NoteLabel.Text = "Could not update the note!";
            }
        }
    }
Example #2
0
    public void ShowNote(DateTime selectedDate)
    {
        NotesBLL notes = new NotesBLL();

        TimeKeeper.NotesDataTable note = notes.GetNoteByUserID((int)Session["UserID"]);

        string noteTitle = "Your Notes:";

        if (note.Count > 0)
        {
            NotesLabel.Visible = true;

            TimeKeeper.NotesRow row = note[0];

            Session["NoteID"] = row.NotesId;

            if (note.NoteTextColumn.ToString().Length > 0)
            {
                NotesLabel.Text = "<div id=\"notebox\"><h4>" + noteTitle + "</h4>" + row.NoteText.Replace("\n", "<br />") + "</div>";
            }
        }
        else
        {
            NotesLabel.Visible = false;
        }
    }
Example #3
0
    public bool AddNote(int userID, string noteText)
    {
        //Create a new NoteRow instance
        TimeKeeper.NotesDataTable Notes = new TimeKeeper.NotesDataTable();
        TimeKeeper.NotesRow note = Notes.NewNotesRow();

        note.UserId = userID;
        note.NoteText = noteText;

        //Add the new note
        Notes.AddNotesRow(note);
        int rowsAffected = Adaptor.Update(Notes);

        //Return true if precisely one row was inserted, otherwise false
        return rowsAffected == 1;
    }
Example #4
0
	public bool AddNote(int userID, string noteText)
	{
		//Create a new NoteRow instance
		TimeKeeper.NotesDataTable Notes = new TimeKeeper.NotesDataTable();
		TimeKeeper.NotesRow note = Notes.NewNotesRow();

		note.UserId = userID;
		note.NoteText = noteText;

		//Add the new note
		Notes.AddNotesRow(note);
		int rowsAffected = Adaptor.Update(Notes);

		//Return true if precisely one row was inserted, otherwise false
		return rowsAffected == 1;
	}
Example #5
0
	public bool UpdateNote(int userID, string noteText, int noteID)
	{
		TimeKeeper.NotesDataTable notes = Adaptor.GetNoteByNoteID(noteID);
		if (notes.Count == 0)
			return false;

		TimeKeeper.NotesRow note = notes[0];

		note.UserId = userID;
		note.NoteText = noteText;

		//Add the new note
		int rowsAffected = Adaptor.Update(note);

		//Return true if precisely one row was inserted, otherwise false
		return rowsAffected == 1;
	}
Example #6
0
    public void ShowNote()
    {
        NotesBLL notes = new NotesBLL();

        TimeKeeper.NotesDataTable note = notes.GetNoteByUserID((int)Session["UserID"]);

        if (note.Count > 0)
        {
            TimeKeeper.NotesRow row = note[0];

            Session["NoteID"] = row.NotesId;

            if (note.NoteTextColumn.ToString().Length > 0)
            {
                NotesTextBox.Text = row.NoteText.ToString();
            }
        }
        else
        {
            NotesTextBox.Text = String.Empty;
            NoteLabel.Text    = "Empty";
        }
    }