private string getGoalText(int accountNum) { string result = ""; //accrues text to be returned throughout function DataAbstract DA = new DataAbstract(); DataTable goals = DA.returnIncompleteGoals(accountNum).Tables[0]; result += "Your current Goal Updates \n"; for (int j = 0; j < goals.Rows.Count; ++j) //iterate through all goals of account { DataRow g = goals.Rows[j]; int notificationCount = Convert.ToInt32(g.Field <object>("NotificationCount")); int goalID = Convert.ToInt32(g.Field <object>("GoalID")); string goalName = Convert.ToString(g.Field <object>("Name")); double currentAmt = Convert.ToDouble(g.Field <object>("CurrentAmt")); double totalAmt = Convert.ToDouble(g.Field <object>("TotalAmt")); double percent = currentAmt / totalAmt; Notifications N = new Notifications(); int notificationCountUpdate = N.Check("goals", percent * 100); if (notificationCountUpdate > notificationCount) { DA.updateNotificationGoals(goalID, notificationCountUpdate); string percentString = Convert.ToString(percent); percentString = percentString.Remove(percentString.IndexOf('.') + 2); string goalString = goalName + " has reached " + (percent * 100).ToString("N0") + "%\n"; result += goalString; } }//end of specific goal return(result); }
public void ribbonimageChoose(object sender, EventArgs e) //selects the current badge for your number of completed goals { Image x = (Image)sender; DataAbstract DA = new DataAbstract(); int completed_goals = DA.returnCompleteGoalsCount(Convert.ToInt32(Session["userID"])); if (completed_goals == 0) { //show "no goals completed yet" } else if (completed_goals >= 1 && completed_goals < 3) { //show " One Goal Completed " , green ribbon image x.Attributes["src"] = "images/ribbon1.png"; } else if (completed_goals >= 3 && completed_goals < 5) { //show " Three Goals Completed " , red ribbon image x.Attributes["src"] = "images/ribbon2.png"; } else if (completed_goals >= 5 && completed_goals < 10) { //show " 5 Goals Completed " , blue ribbon image x.Attributes["src"] = "images/ribbon3.png"; } else { //show " 10 Goals Completed " , gold ribbon image x.Attributes["src"] = "images/ribbon4.png"; } sender = x; }
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(); }
public void label_text(object sender, EventArgs e) //sets the label for the current badge level { DataAbstract DA = new DataAbstract(); int completed_goals = DA.returnCompleteGoalsCount(Convert.ToInt32(Session["userID"])); if (completed_goals == 0) { //show "no goals completed yet" Ribbon_Label.Text = "No goals completed"; } else if (completed_goals >= 1 && completed_goals < 3) { //show " One Goal Completed " , green ribbon image Ribbon_Label.Text = "You have completed your first goal!"; } else if (completed_goals >= 3 && completed_goals < 5) { //show " Three Goals Completed " , red ribbon image Ribbon_Label.Text = "You have completed 3 goals"; } else if (completed_goals >= 5 && completed_goals < 10) { //show " 5 Goals Completed " , blue ribbon image Ribbon_Label.Text = "You have completed 5 goals"; } else { //show " 10 Goals Completed " , gold ribbon image Ribbon_Label.Text = "You have completed 10 goals, great job!"; } }
protected void btn_notify_update_Click(object sender, EventArgs e) { DataAbstract DA = new DataAbstract(); int goal = 0, budget = 0, email = 0, text = 0; if (goal_notify.Checked) { goal = TRUE_FLAG; } if (budget_notify.Checked) { budget = TRUE_FLAG; } if (email_notifications.Checked) { email = TRUE_FLAG; } if (text_notifications.Checked) { text = TRUE_FLAG; } DA.updateNotifications(userID, goal, budget, email, text); }
//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"); }
protected void onClick(object sender, EventArgs e) { Button btn = sender as Button; string x = btn.CommandArgument; string n = username.Value; string p = password.Value; DataAbstract DA = new DataAbstract(); int authenticated = DA.login(n, p); if (authenticated > -1) { //The userID of matching username and password is stored globally as Session["userID"] // Session.Add("userID", authenticated); Session["userID"] = authenticated; Response.Redirect("~/Summary.aspx"); } //just a way to show authentication failed else { username.Value = "FAIL"; } }
public void toggleFavorite(object sender, CommandEventArgs e) { DataAbstract DA = new DataAbstract(); DataRow DR = DA.returnOneBudget(Convert.ToInt32(e.CommandArgument)).Tables[0].Rows[0]; bool pastFavor = Convert.ToBoolean(DR.Field <object>("Favorite")); DA.updateBudgetFavorite(Convert.ToInt32(e.CommandArgument), !pastFavor); }
public void GoalsList_DeleteGoal(object sender, ListViewDeleteEventArgs e) { ListViewItem goal = GoalsList.Items[e.ItemIndex]; //obtain copy of relevant goal int id = Convert.ToInt32(e.Keys["GoalID"]); DataAbstract DA = new DataAbstract(); DA.deleteGoal(id); Response.Redirect("~/Goals.aspx"); //reload to show changes }
public void BudgetList_DeleteGoal(object sender, ListViewDeleteEventArgs e) { ListViewItem goal = BudgetList.Items[e.ItemIndex]; int id = Convert.ToInt32(e.Keys["BudgetID"]); DataAbstract DA = new DataAbstract(); DA.deleteBudget(id); Response.Redirect("~/Budget.aspx"); }
static public void notifyOne(int userID) { Boolean notifyGoals; Boolean notifyBudgets; DataAbstract DA = new DataAbstract(); notifyBudgets = Convert.ToBoolean(DA.returnUser(userID).Tables[0].Rows[0].Field <object>("GoalsNotifications")); notifyGoals = Convert.ToBoolean(DA.returnUser(userID).Tables[0].Rows[0].Field <object>("BudgetsNotifications")); DataTable accounts = DA.returnAccounts(userID).Tables[0]; string emailMsg = "Report on your financial status \n"; for (int i = 0; i < accounts.Rows.Count; ++i) //iterate through all accounts of the user { long accountNum = Convert.ToInt64(accounts.Rows[i].Field <object>("AcctNumber")); //Section for proceessing Goal portion of email if (notifyGoals) { //emailMsg += getGoalText(accountNum); }//end of goals section //Section for processing Budget section of email if (notifyBudgets) { DataTable budgets = DA.returnBudgets(accountNum).Tables[0]; emailMsg += "\n\nYour current Budget Updates \n"; for (int j = 0; j < budgets.Rows.Count; ++j) { DataRow b = budgets.Rows[j]; int notificationCount = Convert.ToInt32(b.Field <object>("NotificationCount")); int budgetID = Convert.ToInt32(b.Field <object>("BudgetID")); string categoryName = DA.returnCategoryName(Convert.ToInt32(b.Field <object>("CategoryID"))); double currentAmt = Convert.ToDouble(b.Field <object>("CurrentAmt")); double maxAmt = Convert.ToDouble(b.Field <object>("MaxAmt")); double percent = currentAmt / maxAmt; Notifications N = new Notifications(); int notificationCountUpdate = N.Check("budget", percent * 100); if (notificationCountUpdate > notificationCount) { DA.updateNotificationBudgets(budgetID, notificationCountUpdate); string budgetString = categoryName + " has reached " + (percent * 100).ToString("N0") + "%\n"; emailMsg += budgetString; } }//end of budgets } string[] m = emailMsg.Trim().Split(); Notifications Note = new Notifications(); Note.sendEmail(emailMsg, accountNum.ToString()); }//end of specific account }
public static string[,] getPieValues(long account) { DataAbstract DA = new DataAbstract(); DateTime DT = System.DateTime.Now; DateTime before = DT.AddMonths(-1); DataSet accountData = DA.returnAccounts(userID); System.Data.DataTable accountsTable = accountData.Tables[0]; //table holding all account entries for the user //object accountObject = accountsTable.Rows[0].Field<object>("AcctNumber"); //long accountNumber = Convert.ToInt64(accountObject); DataSet catData = DA.returnCategories(userID); System.Data.DataTable catTable = catData.Tables[0]; int resLength = catTable.Rows.Count; string[,] result = new string[resLength, 3]; double totalTransactions = 0; for (int i = 0; i < catTable.Rows.Count; ++i) //get name and total spent for each category { object catIDData = catTable.Rows[i].Field <object>("CategoryID"); object nameData = catTable.Rows[i].Field <object>("Name"); int catID = Convert.ToInt32(catIDData); string category = Convert.ToString(nameData); DateTime start = DateTime.Now.AddMonths(-1); DateTime end = DateTime.Now; //double catSum = DA.returnTransactionCategoryBoundTotals(catID, account, start, end); //one month span //TEMPORARY RANGE WITH USEABLE DATA double catSum = DA.returnTransactionCategoryBoundTotals(catID, account, Convert.ToDateTime("12/1/2016"), Convert.ToDateTime("1/1/2017")); //other span totalTransactions += catSum; result[i, 0] = category; result[i, 1] = Convert.ToString(catSum); } //end of for loop //result has names and totals of each category double degreeCheck = 0; for (int i = 0; i < catTable.Rows.Count; ++i) //get degrees of pie chart for each category { double catSum = Convert.ToDouble(result[i, 1]); double percent = catSum / totalTransactions; if (catSum == 0) { percent = 0; } double degrees = percent * 360; result[i, 2] = Convert.ToString(Math.Round(degrees)); degreeCheck += degrees; } return(result); }
static public void notifyAll() { DataAbstract DA = new DataAbstract(); DataTable userIDs = DA.returnAllUserIDs().Tables[0]; for (int rows = 0; rows < userIDs.Rows.Count; ++rows) { int user = Convert.ToInt32(userIDs.Rows[rows].Field <object>("UserID")); notifyOne(user); }//end of userID }
public void SetData(string scene, string id, DataAbstract d) { SceneData s; sceneData.TryGetValue(scene, out s); if (s == null) { s = new SceneData(); sceneData.Add(scene, s); } s.SetData(id, d); }
protected void Page_PreRender(object sender, EventArgs e) { 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 (Convert.ToInt64(Session["account"]) == 0) { 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; } BudgetDS = DA.returnBoundedBudgets(Convert.ToInt64(Session["account"]), d1, d2); //Sets the source for the listview BudgetList.DataSource = BudgetDS; BudgetList.DataBind(); //LoadSubjects(); DataTable accounts = DA.returnAccounts(userID).Tables[0]; DropDownList DDL = AccountList; DDL.Items.Insert(0, new ListItem("Select Account", "0")); DDL.DataSource = accounts; DDL.DataTextField = "AcctNumber"; DDL.DataValueField = "AcctNumber"; DDL.DataBind(); DataTable categories = DA.returnCategories(userID).Tables[0]; DropDownList DDL2 = CategorySelect; DDL2.Items.Insert(0, new ListItem("Select Category", "0")); DDL2.DataSource = categories; DDL2.DataTextField = "Name"; DDL2.DataValueField = "CategoryID"; DDL2.DataBind(); }
public void getCategories(object sender, EventArgs e) { DataAbstract DA = new DataAbstract(); DataTable categories = DA.returnCategories(userID).Tables[0]; DropDownList DDL = CategorySelect; DDL = (DropDownList)sender; DDL.Items.Insert(0, new ListItem("Select Category", "0")); DDL.DataSource = categories; DDL.DataTextField = "Name"; DDL.DataValueField = "CategoryID"; //DDL.DataBind(); DDL.ID = "EditCategorySelect"; }
//handles ListViewUpdateEvent //pulls data bound in the Edit Template and calls abstract layer to change database //Date formats with slashes or dashes work. $ icons in number field replaces with blank spaces public void GoalsList_ItemUpdating(Object sender, ListViewUpdateEventArgs e) { DataAbstract DA = new DataAbstract(); long accountNum = Convert.ToInt64(e.NewValues["AcctNumber"]); //same account as before update string name = Convert.ToString(e.NewValues["Name"]); double amt = Convert.ToDouble(e.NewValues["TotalAmt"].ToString().Replace('$', ' ')); string des = Convert.ToString(e.NewValues["Description"]); DateTime newDate = Convert.ToDateTime(e.NewValues["EndDate"].ToString().Replace('-', '/')); int gID = Convert.ToInt32(e.Keys["GoalID"]); DA.updateGoalEndDate(gID, newDate, accountNum); DA.updateGoalName(gID, name, accountNum); DA.updateGoalTotalAmt(gID, amt, accountNum); Response.Redirect("~/Goals.aspx"); }
public void getAccounts(object sender, EventArgs e) { DataAbstract DA = new DataAbstract(); DataTable accounts = DA.returnAccounts(userID).Tables[0]; DropDownList DDL = AccountList; DDL = (DropDownList)sender; DDL.Items.Insert(0, new ListItem("Select Account", "0")); DDL.DataSource = accounts; DDL.DataTextField = "AcctNumber"; DDL.DataValueField = "AcctNumber"; //DDL.DataBind(); DDL.ID = "EditAccountList"; //sender = DDL; }
public void editCategory(object sender, CommandEventArgs e) { int cat = Convert.ToInt32(ChangeCategoryDD.SelectedItem.Value); int id = Convert.ToInt32(Session["TransID"]); DataAbstract DA = new DataAbstract(); if (Convert.ToString(ChangeCategoryDD.SelectedItem.Text) == "Other") { string userCat = CustomCategory.Text; int uid = Convert.ToInt32(Session["userID"]); DA.addCategory(userCat, uid); cat = DA.returnCategoryID(userCat, uid); } long acct = Convert.ToInt32(Session["account"]); DA.updateTransactionCategory(id, cat, acct); Response.Redirect("Wallet.aspx"); }
public void imageChoose(object sender, EventArgs e) { Image x = (Image)sender; int id = Convert.ToInt32(x.Attributes["Text"]); DataAbstract DA = new DataAbstract(); DataRow DR = DA.returnOneBudget(id).Tables[0].Rows[0]; bool fav = Convert.ToBoolean(DR.Field <object>("favorite")); if (fav) { x.Attributes["src"] = "images/faveTrue.png"; } else { x.Attributes["src"] = "images/faveFalse.png"; } sender = x; }
public void ListViewUpdate(object sender, ListViewUpdateEventArgs e) { ListViewItem item = ((ListView)sender).Items[Convert.ToInt32(e.ItemIndex)]; DropDownList Accounts = (DropDownList)item.FindControl("EditAccountList"); DropDownList Categories = (DropDownList)item.FindControl("EditCategorySelect"); DataAbstract DA = new DataAbstract(); int id = Convert.ToInt32(e.Keys["BudgetID"]); int catID = Convert.ToInt32(Categories.SelectedValue); long account = Convert.ToInt64(Accounts.SelectedValue); double max = Convert.ToDouble(e.NewValues["MaxAmt"]); string dateString = Convert.ToString(e.NewValues["EndDate"]); DateTime endDate = Convert.ToDateTime(dateString); DA.updateBudget(id, Convert.ToInt64(Session["Account"]), catID, endDate, max); Response.Redirect("~/Budget.aspx"); }
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(); } }
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; } } }
//DateTime now = DateTime.Now; //DateTime later = DateTime.Now.AddMonths(1); protected void Page_Load(object sender, EventArgs e) { 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 (Convert.ToInt64(Session["account"]) == 0) { 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; } }
//called by button clicked by user //uses bound data along with abstract layer calls to update database public void addFundsClick(object sender, CommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); System.Diagnostics.Debug.WriteLine(id); DataAbstract DA = new DataAbstract(); DataRow DR = DA.returnOneGoal(id).Tables[0].Rows[0]; double prev = Convert.ToDouble(DR.Field <object>("CurrentAmt")); Button addBtn = sender as Button; //finding listview item, finding textbox value ListViewItem lvi = addBtn.NamingContainer as ListViewItem; //gets listViewItem containing the clicked button TextBox tb = lvi.FindControl("AddAmt") as TextBox; string tbs = tb.Text; if (tbs != "") { double toAdd = Convert.ToDouble(tbs); double newAmount = prev + toAdd; DA.updateGoalCurrentAmount(id, newAmount, Convert.ToInt64(Session["account"])); Response.Redirect("~/Goals.aspx"); } }
protected void Page_PreRender(object sender, EventArgs e) { 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; } GoalDS = DA.returnFavorites("Goal", Convert.ToInt64(Session["account"])); //Sets the source for the listview FaveGoalsList.DataSource = GoalDS; FaveGoalsList.DataBind(); BudgetDS = DA.returnFavorites("Budget", Convert.ToInt64(Session["account"])); //Sets the source for the listview FaveBudgetsList.DataSource = BudgetDS; FaveBudgetsList.DataBind(); hfAcctNum.Value = Convert.ToString(Session["account"]); getPieValues(Convert.ToInt64(Session["account"])); }
private void LoadSubjects() { DataAbstract DA = new DataAbstract(); DataTable categories = DA.returnCategories(userID).Tables[0]; DataTable accounts = DA.returnAccounts(userID).Tables[0]; //Set sources for the dropdowns and associate the text and value // based on the datatable fields CategorySelect.DataSource = categories; CategorySelect.DataTextField = "Name"; CategorySelect.DataValueField = "CategoryID"; CategorySelect.DataBind(); AccountList.DataSource = accounts; AccountList.DataTextField = "AcctNumber"; AccountList.DataValueField = "AcctNumber"; AccountList.DataBind(); CategorySelect.Items.Insert(0, new ListItem("Select Category", "0")); AccountList.Items.Insert(0, new ListItem("Select Account", "0")); }
public void addBudgetClick(Object sender, EventArgs e) { DataAbstract DA = new DataAbstract(); int categoryID = Convert.ToInt32(CategorySelect.SelectedValue); //REAL ONE WILL USE INDEX OF DROP-DOWN? long accountNum = Convert.ToInt64(AccountList.SelectedValue); //uses the session to recieve the account double amount = Convert.ToDouble(BudgetAmtField.Text); //holds amount of the goal //CHECK LINE BELOW FOR PROPER VALUES DateTime endDate = Convert.ToDateTime(EndDate.Text.Replace('-', '/')); DateTime startDate = Convert.ToDateTime(StartDate.Text.Replace('-', '/')); //ADD CODE TO GET CHECKBOX VALUE int favorited = 0; //CheckBox CB = new CheckBox(); //REPLACE THIS WITH CHECKBOX VALUE!! //if (CB.Checked) favorited = 1; DA.addBudget(accountNum, categoryID, startDate, endDate, amount, favorited); //Reset form data after button click. Form data was resent upon refresh without this. Session["ViewState"] = null; Response.Redirect("Budget.aspx"); }
protected void Page_PreRender() { if (!IsPostBack) { DataAbstract DA = new DataAbstract(); if (Convert.ToInt32(Session["userID"]) != 0) { userID = Convert.ToInt32(Session["userID"]); DataSet userData = DA.returnUser(userID); //gets the user DataTable userTable = userData.Tables[0]; object goal = userTable.Rows[0].Field <object>("GoalsNotifications"); object budget = userTable.Rows[0].Field <object>("BudgetsNotifications"); goal_notify.Checked = Convert.ToBoolean(goal); budget_notify.Checked = Convert.ToBoolean(budget); 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 (Convert.ToInt64(Session["account"]) == 0) { Session["account"] = Convert.ToInt64(s); //saves the first account as the default account during the session } } else { Session["userID"] = 1; //temporary solution for demo 3/19/2017 Session["account"] = 211111110; DataSet userData = DA.returnUser(userID); //gets the user DataTable userTable = userData.Tables[0]; object goal = userTable.Rows[0].Field <object>("GoalsNotifications"); object budget = userTable.Rows[0].Field <object>("BudgetsNotifications"); object email = userTable.Rows[0].Field <object>("EmailNotifications"); object text = userTable.Rows[0].Field <object>("TextNotifications"); goal_notify.Checked = Convert.ToBoolean(goal); budget_notify.Checked = Convert.ToBoolean(budget); email_notifications.Checked = Convert.ToBoolean(email); text_notifications.Checked = Convert.ToBoolean(text); } DataTable accounts = DA.returnAccounts(userID).Tables[0]; DropDownList DDL = acctSelect; DDL.Items.Insert(0, new ListItem("Select Account", "0")); DDL.DataSource = accounts; DDL.DataTextField = "AcctNumber"; DDL.DataValueField = "AcctNumber"; DDL.DataBind(); ListItem LVI = DDL.Items.FindByValue(Convert.ToString(Session["account"])); if (LVI != null) { int index = DDL.Items.IndexOf(LVI); acctSelect.SelectedIndex = index; } currAcct.Text = "Current account: " + Session["account"].ToString(); } }
public void SetData(DataAbstract data) { GameManager.instance.saveManager.SetData(scene, uniqueID, data); }