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

        todos.GetTodosByUserID((int)Session["userID"]);

        TodosGridView.DataBind();
    }
示例#2
0
        private void GetTodoList()
        {
            // connect to EF DB
            using (TodoContext db = new TodoContext())
            {
                // query the TodoList Table using EF and LINQ
                var TodoData = (from allTodo in db.Todos
                                select allTodo);

                // bind the result to the TodoList GridView
                TodosGridView.DataSource = TodoData.ToList();
                TodosGridView.DataBind();
            }
        }
        /**
         * <summary>
         * This method gets the Todo data from the DB
         * </summary>
         *
         * @method GetTodos
         * @returns {void}
         */
        protected void GetTodos()
        {
            // connect to EF
            using (TodoConnection db = new TodoConnection())
            {
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();

                // query the Todos Table using EF and LINQ
                var Todos = (from allTodos in db.Todos
                             select allTodos);

                // bind the result to the GridView
                TodosGridView.DataSource = Todos.AsQueryable().OrderBy(SortString).ToList();
                TodosGridView.DataBind();
            }
        }
        private void fillTodos(string col, string ascDesc)
        {
            var userStore   = new UserStore <IdentityUser>();
            var userManager = new UserManager <IdentityUser>(userStore);
            var user        = userManager.FindById(HttpContext.Current.User.Identity.GetUserId());

            using (TodoContext db = new TodoContext()) {
                string SortString = col + " " + ascDesc;

                var todos = (from _todos in db.Todos where _todos.TodoUserEmail == user.Email select _todos);

                TodoCount.Text = Convert.ToString(todos.AsQueryable().Count());

                TodosGridView.DataSource = todos.AsQueryable().OrderBy(SortString).ToList();
                TodosGridView.DataBind();
            }
        }