protected void SubmitLinkButton_Click(object sender, EventArgs e)
    {
        TodosBLL todos = new TodosBLL();

        TimeKeeper.TodosDataTable todo = todos.GetTodosByUserID((int)Session["userID"]);
        TimeKeeper.TodosRow       row  = todo[0];

        if (todos.AddTodo(TodoItemTextBox.Text, Convert.ToDateTime(DueDateTextBox.Text), false, Convert.ToDateTime(DueDateTextBox.Text), (int)Session["userID"], 0))
        {
            EntryViewLabel.Text = "Todo Item has been added.";
        }
        else
        {
            EntryViewLabel.Text = "Error: Not able to add todo item.";
        }
    }
Beispiel #2
0
    public bool AddTodo(string todoItem, DateTime dueDate, bool complete, DateTime completeDate, int userID, int projectID)
    {
        //Create a new TodoRow instance
        TimeKeeper.TodosDataTable Todos = new TimeKeeper.TodosDataTable();
        TimeKeeper.TodosRow       todo  = Todos.NewTodosRow();

        todo.TodoItem      = todoItem;
        todo.DueDate       = dueDate;
        todo.Complete      = complete;
        todo.CompletedDate = completeDate;
        todo.UserID        = userID;
        todo.ProjectID     = projectID;

        //Add the new todo
        Todos.AddTodosRow(todo);
        int rowsAffected = Adaptor.Update(Todos);

        //Return true if precisely one row was inserted, otherwise false
        return(rowsAffected == 1);
    }
Beispiel #3
0
    public bool UpdateTodo(string todoItem, DateTime dueDate, bool complete, DateTime completeDate, int userID, int projectID, int todoID)
    {
        TimeKeeper.TodosDataTable todos = Adaptor.GetTodoByTodoID(todoID);
        if (todos.Count == 0)
        {
            return(false);
        }

        TimeKeeper.TodosRow todo = todos[0];

        todo.TodoItem      = todoItem;
        todo.DueDate       = dueDate;
        todo.Complete      = complete;
        todo.CompletedDate = completeDate;
        todo.UserID        = userID;
        todo.ProjectID     = projectID;

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

        //Return true if precisely one row was inserted, otherwise false
        return(rowsAffected == 1);
    }