protected void SelectedFoodsGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { DataAccess data = new DataAccess(); data.changeFoodQuantityFromSession(e.RowIndex, e.NewValues["Quantity"].ToString()); //Make sure a normal update command isn't issued e.Cancel = true; SelectedFoodsGridView.EditIndex = -1; //Rebind the gridview SelectedFoodsGridView.DataBind(); }
protected void AddButton_Click(object sender, EventArgs e) { // save the choice to session da.saveFoodToSession(Convert.ToInt16(ListBox1.SelectedValue)); // insert objects into gridview SelectedFoodsGridView.DataBind(); // return to previous view MultiView1.ActiveViewIndex = 1; setActiveViewIndex(MultiView1.ActiveViewIndex); }
/* * protected void btnPrintContract_Click(object sender, EventArgs e) * { * ExportOps eops = new ExportOps(); * * StringBuilder contract = new StringBuilder(); * * contract.Append("<b>Eating Contract</b>"+Environment.NewLine + Environment.NewLine); * contract.Append(" I, "); * contract.Append((string)Session["personName"]); * contract.Append(", promise to try my best to reach my major goal of "); * contract.Append(lblContractMajorGoal.Text); * contract.Append(" by "); * contract.Append(lblContractMinorGoal.Text); * contract.Append(Environment.NewLine); * contract.Append(" This is because "); * //contract.Append(da.GetMinorGoalWhy(System.Convert.ToInt32((string)Session["EatingArea"]), ((int[])Session["goals"])[0])); * contract.Append(lblContractWhy.Text); * contract.Append(Environment.NewLine + Environment.NewLine + Environment.NewLine); * contract.Append("__________________ __________________" + Environment.NewLine); * contract.Append(" Your Signature Friend's Signature " + Environment.NewLine); * contract.Append(Environment.NewLine + Environment.NewLine + Environment.NewLine); * contract.Append("__________________" + Environment.NewLine); * contract.Append("Parent's Signature "); * * //eops.AddPageW(contract.ToString(), 1, 1, 500); * eops.PDFAddPage(); * eops.PDFAddFormattedTextArea(contract.ToString(), 1); * * eops.PDFDocumentTitle = "EatFit Contract"; * eops.PDFDocumentAuthor = "College of Agricultural and Environmental Sciences Dean's Office"; * * eops.ExportToPDF(); * } */ /* * protected void btnPrintContract_Click(object sender, EventArgs e) * { * ExportOps eops = new ExportOps(); * * StringBuilder contract = new StringBuilder(); * contract.Append("<table border=0 cellpadding=2 cellspacing=0 align=center width=440><tr><td style=\"width: 520px\">"); * contract.Append("<table border=\"1\" width=100% cellpadding=2 cellspacing=0 align=center>"); * contract.Append(" <tr>"); * contract.Append(" <td width=\"440\" height=\"59\" colspan=\"2\">"); * contract.Append(" <img src=\"images/eating_contract2.jpg\" width=440 height=\"59\" id=\"imgEatingContractTitle\" >"); * contract.Append(" </td></tr>"); * contract.Append(" <tr>"); * contract.Append(" <td width=\"100%\" class=\"cinfo3\" colspan=\"2\" style=\"font-size: 12pt; height: 100px; font-family: Verdana;\"><br>"); * contract.Append(" "); * contract.Append(" I, <span class=bold>"); * contract.Append((string)Session["personName"]); * contract.Append("</span>, promise to try my best to reach my"); * contract.Append(" major goal"); * contract.Append(" of <span class=bold>"); * contract.Append(lblContractMajorGoal.Text); * contract.Append("</span> by <span class=bold>"); * contract.Append(lblContractMinorGoal.Text); * contract.Append("</span><br />"); * contract.Append(" "); * contract.Append(" This is because <span class=bold>"); * contract.Append(lblContractWhy.Text); * contract.Append("</span>"); * contract.Append(" <br /> </td>"); * contract.Append(" </tr>"); * contract.Append(" <tr>"); * contract.Append(" <td width=\"50%\" class=\"cinfo3\" align=\"center\" style=\"font-size: 12pt; height: 90px\"><span class=bold>__________________</span><br>"); * contract.Append(" Your Signature</td>"); * contract.Append(" <td width=\"50%\" class=\"cinfo3\" align=\"center\" style=\"font-size: 12pt; height: 90px\"><span class=bold style=\"font-size: 12pt\">__________________</span><br>"); * contract.Append(" Friend's Signature</td>"); * contract.Append(" </tr>"); * contract.Append(" <tr>"); * contract.Append(" <td width=\"50%\" class=\"cinfo3\" align=\"center\" style=\"font-size: 12pt\"><br><span class=bold>"); * contract.Append(" __________________</span><br>"); * contract.Append(" Parent's Signature</td>"); * contract.Append(" <td width=\"50%\" class=\"cinfo3\" align=\"middle\" style=\"font-size: 12pt\"> </td>"); * contract.Append(" </tr>"); * contract.Append("</table>"); * contract.Append("</td></tr></table>"); * eops.PDFAddPage(); * eops.PDFAddFormattedTextArea(contract.ToString(), 1); * * eops.PDFDocumentTitle = "EatFit Contract"; * eops.PDFDocumentAuthor = "College of Agricultural and Environmental Sciences Dean's Office"; * * eops.ExportToPDF(); * } */ protected void SelectedFoodsGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataAccess data = new DataAccess(); //Delete the row from the session data.removeFoodFromSession(e.RowIndex); //Make sure a normal delete command isn't issued e.Cancel = true; //Rebind the data to the new session dataset SelectedFoodsGridView.DataBind(); }
protected void resetAnalysis(object sender, EventArgs e) { // reset all session variables Session["foodVars"] = null; Session["personName"] = null; Session["habits"] = null; Session["user"] = null; // and re-empty the select foods grid SelectedFoodsGridView.DataBind(); // I do not want this happening anymore, since I'm using // an authenticated user. // reset all buttons /* * NameBox.Text = ""; * AgeDropDown.DataBind(); * AgeDropDown.SelectedIndex = 10; */ // fixme, clear out the editfoodgridview foreach (ListItem x in GoalsLists.Items) { x.Selected = false; } // Clear out the habits questions: dlistEatingHabitsQ1.SelectedIndex = 0; dlistEatingHabitsQ2.SelectedIndex = 0; dlistEatingHabitsQ3.SelectedIndex = 0; rbtnlistEatingHabitsQ4.SelectedIndex = -1; rbtnlistEatingHabitsQ5.SelectedIndex = -1; // Clear out the eating area button: rbtnlistEatingArea.SelectedIndex = -1; // Clear out the minor goals button: MinorGoalList.SelectedIndex = -1; // return us to the first page MultiView1.ActiveViewIndex = (int)PageViewType.ProfileInformation; setActiveViewIndex(MultiView1.ActiveViewIndex); }