예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataAbstract DA = new DataAbstract();
        DateTime     d1 = new DateTime(2016, 11, 14);
        DateTime     d2 = new DateTime(2017, 5, 15);

        //DA.updateGoalAmt(19, 200.00, 211111110);
        //DA.updateGoalEndDate(19, d2, 211111110);
        //DA.updateGoalTotalAmt(19, 10000.00,211111110);
        //DA.updateGoalName(19, "pet dog", 211111110);
        DA.addGoal(3011111130, "Summer Vacation", 3100.00, d2, "Monthly", 125, "trip to Mars");
        //DA.returnGoals(211111110);
        //DA.create_Category("Travel");
        //DA.updateTransactionCategory(320, 9, 211111110);
        //DA.addBudget(211111110, 1, d1, d2, 300.00, 1);
        //DA.deleteBudget(10);
        int    cat = DA.returnCompleteGoalsCount(211111110);
        double t__ = DA.returnTransactionCategoryBoundTotals(2, 211111110, d1, d2);

        System.Diagnostics.Debug.WriteLine("goals count = " + cat);
        DA.returnCategoryName(1);



        DataSet t1 = new DataSet();

        t1 = DA.returnTransactionsSearch(211111110, d1, d2, "bes");
        GridView1.DataSource = t1;
        GridView1.DataBind();
    }
예제 #2
0
    //called by button clicked in addGoal modal
    //gets data bound in ListViewItem Edit View
    //uses that data with abstract layer to update database
    public void addGoalClick(Object sender,
                             EventArgs e)
    {
        DataAbstract DA                  = new DataAbstract();
        string       name                = GoalIDUserInput.Text;
        long         accountNum          = Convert.ToInt64(Session["account"]);     //uses the session to recieve the account
        double       amount              = Convert.ToDouble(GoalAmtUserInput.Text); //holds amount of the goal
        string       desc                = GoalDescUserInput.Text;                  //optional description of the goal
        int          transRadioSelection = PaymentOptions.SelectedIndex;

        string transactionType = PaymentOptions.SelectedItem.Attributes["ID"];
        double toAdd           = 0; //the percentage or dollar amount to be added each time
        string dateString      = GoalDateUserInput.Text.Replace('-', '/').Trim();

        dateString = dateString.Replace(' ', '/');
        DateTime endDate = Convert.ToDateTime(GoalDateUserInput.Text);

        if (transactionType == "Percentage")
        {
            toAdd = Convert.ToDouble(PercentageInput.Text);
        }

        if (transactionType == "FlatRate")
        {
            toAdd = Convert.ToDouble(FlatRateInput.Text);
        }

        //acctNumber name totalAmount, datetime, transType, TransAmt
        DA.addGoal(accountNum, name, amount, endDate, transactionType, toAdd, desc);

        //Reset form data after button click. Form data was resent upon refresh without this.
        Session["ViewState"] = null;
        Response.Redirect("Goals.aspx");
    }