Beispiel #1
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEdit_Click_1(object sender, EventArgs e)
        {
            ToDoItem ItemToUpdate = (ToDoItem)dgToDos.CurrentRow.DataBoundItem;

            ToDoItemDB.UpdateDescription(ItemToUpdate.ToDoItemID, txtDescrip.Text);
            RepopulateToDos();
        }
Beispiel #2
0
        /// <summary>
        /// DELETE deletes a item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            ToDoItem ItemToDelete = (ToDoItem)dgToDos.CurrentRow.DataBoundItem;

            ToDoItemDB.Delete(ItemToDelete);
            RepopulateToDos();
        }
Beispiel #3
0
        /// <summary>
        /// READ loading/repopulating our data grid
        /// </summary>

        private void RepopulateToDos()
        {
            this.allToDos      = ToDoItemDB.GetAllToDoItems();
            dgToDos.DataSource = allToDos;
            /// hides columns that the user does not need to see.
            this.dgToDos.Columns["CategoryID"].Visible = false;
            this.dgToDos.Columns["ToDoItemID"].Visible = false;
        }
Beispiel #4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddToDo_Click_1(object sender, EventArgs e)
        {
            ToDoItem NewToDo       = new ToDoItem(null, 1, txtDescrip.Text);
            bool     successOrFail = ToDoItemDB.Create(NewToDo);

            successChecker(successOrFail);
            RepopulateToDos();
        }