예제 #1
0
    public void searchTransactions(object sender, EventArgs e)
    {
        DataAbstract DA        = new DataAbstract();
        DateTime     d1        = new DateTime(2000, 1, 1);
        DateTime     d2        = new DateTime(2100, 12, 12);
        string       searchkey = Search.Text;

        if (searchkey != "" && searchkey != "Search")
        {
            transactions = DA.returnTransactionsSearch(Convert.ToInt64(Session["account"]), d1, d2, searchkey);
            TransactionsList.DataSource = transactions;
            TransactionsList.DataBind();
        }
        if (searchkey == "All" || searchkey == "all")
        {
            transactions = DA.returnTransactions(Convert.ToInt64(Session["account"]));
            TransactionsList.DataSource = transactions;
            TransactionsList.DataBind();
        }
    }
예제 #2
0
    protected void Page_PreRender()
    {
        if (!IsPostBack)
        {
            DataAbstract DA = new DataAbstract();
            if (Convert.ToInt32(Session["userID"]) != 0)
            {
                userID = Convert.ToInt32(Session["userID"]);
                DataSet accountData = DA.returnAccounts(userID);               //gets all accounts
                System.Data.DataTable accountsTable = accountData.Tables[0];   //table holding all account entries for the user
                object s = accountsTable.Rows[0].Field <object>("AcctNumber"); //sets the default account to the first of the user's accounts. LIKELY CHANGE LATER.
                if (Session["account"] == null)
                {
                    Session["account"] = Convert.ToInt64(s);                    //saves the first account as the default account during the session
                }
                userID = Convert.ToInt16(Session["userID"]);                    //saves the Session userID to the variable on this page
            }
            else
            {
                Session["userID"]  = 1; //temporary solution for demo 3/19/2017
                Session["account"] = 211111110;
            }
            // long, datetime, datetime int, int
            transactions = DA.returnTransactions(Convert.ToInt64(Session["account"]));
            TransactionsList.DataSource = transactions;
            TransactionsList.DataBind();
            int uid = Convert.ToInt32(Session["userID"]);
            ChangeCategoryDD.Items.Insert(0, new ListItem("Select Account", "0"));
            ChangeCategoryDD.DataSource     = DA.returnCategories(uid);
            ChangeCategoryDD.DataTextField  = "Name";
            ChangeCategoryDD.DataValueField = "CategoryID";
            ChangeCategoryDD.DataBind();

            ListItem LVI = ChangeCategoryDD.Items.FindByValue("6");     //set listview selected to 'other' on load
            if (LVI != null)
            {
                int index = ChangeCategoryDD.Items.IndexOf(LVI);
                ChangeCategoryDD.SelectedIndex = index;
            }
        }
    }