Beispiel #1
0
        //EnableSortingAndPagingCallbacks to minimize postbacks?
        private void SortGridView(string sortExpression, string direction)
        {
            GridBAL booksLogic = new GridBAL();
            //DataView myDataView = new DataView(booksLogic.GetData());
            DataView myDataView = new DataView();

            if (ViewState["username"].ToString() == "")
            {
                if (Convert.ToByte(ViewState["filter"]) == 1)
                {
                    myDataView = booksLogic.GetData(Convert.ToByte(ViewState["filter"])).AsDataView();
                }
                else
                {
                    myDataView = booksLogic.GetData().AsDataView();
                }
            }
            else
            {
                myDataView = booksLogic.GetDataByUsername(ViewState["username"].ToString()).AsDataView();
            }


            myDataView.Sort      = sortExpression + direction;
            BooksGrid.DataSource = myDataView;
            BooksGrid.DataBind();
        }
Beispiel #2
0
        protected void TakenBooks_Click(object sender, EventArgs e)
        {
            ViewState["filter"] = 0;
            if (Session["email"] != null)
            {
                ViewState["username"] = (string)(Session["email"]);
            }
            else
            {
                ViewState["username"] = "";
            }
            //ViewState["username"] = "******";

            GridBAL booksLogic = new GridBAL();

            if (ViewState["username"].ToString() != "")
            {
                BooksGrid.DataSource = booksLogic.GetDataByUsername(ViewState["username"].ToString());
                BooksGrid.DataBind();
            }
            else
            {
                TestLabel.Text = "You are not logged in";
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //BooksBAL booksLogic = new BooksBAL();
            GridBAL booksLogic = new GridBAL();

            BooksGrid.DataSource = booksLogic.GetData();
            BooksGrid.DataBind();
        }
Beispiel #4
0
        protected void AvailableBooks_Click(object sender, EventArgs e)
        {
            ViewState["filter"]   = 1;
            ViewState["username"] = "";
            GridBAL booksLogic = new GridBAL();

            BooksGrid.DataSource = booksLogic.GetData(Convert.ToByte(ViewState["filter"]));
            BooksGrid.DataBind();
        }