| | |
Microsoft Visual Studio 2005 web
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 13
Reputation:
Solved Threads: 0
This is what I have written so far for my homework.
No, I am not asking for someone to do my homework just to help me with what I have so far. This is a Restaurant menu created for a web site, I am very close to getting it finished, just need help in getting out a few bugs. My course is in C# using Visual Studio
Thank you,
Wade
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
private double[] AppetizerCost = { 0.00, 5.95, 6.95, 8.95, 8.95, 10.95, 12.95, 6.95 };
private double[] MainCost = { 0.00, 15.95, 13.95, 13.95, 11.95, 19.95, 20.95, 18.95, 13.95, 14.95 };
private double[] DessertCost = { 0.00, 5.95, 3.95, 5.95, 4.95, 5.95 };
private double[] BeverageCost = { 0.00, 1.95, 1.50, 1.25, 2.95, 2.50, 1.50 };
protected void Page_Load(object sender, EventArgs e)
{
double cost = 0.00;
if (AppetizerDropDown.SelectedIndex != -1)
cost = AppetizerCost[AppetizerDropDown.SelectedIndex];
if (DropDownMain.SelectedIndex != -1)
cost += MainCost[DropDownMain.SelectedIndex];
if (DropDownDessert.SelectedIndex != -1)
cost += DessertCost[DropDownDessert.SelectedIndex];
if (DropDownBev.SelectedIndex != -1)
cost += BeverageCost[DropDownBev.SelectedIndex];
labelSubTotal.Text = String.Format("{0:C}", cost);
labelTax.Text = String.Format("{0:C}", cost * .07);
labelTotal.Text = String.Format("{0:C}", cost * 1.07);
}
protected void ButtonClear_Click(object sender, EventArgs e)
{
AppetizerDropDown.SelectedIndex = -1;
DropDownMain.SelectedIndex = -1;
DropDownDessert.SelectedIndex = -1;
DropDownBev.SelectedIndex = -1;
}
}
No, I am not asking for someone to do my homework just to help me with what I have so far. This is a Restaurant menu created for a web site, I am very close to getting it finished, just need help in getting out a few bugs. My course is in C# using Visual Studio
Thank you,
Wade
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
private double[] AppetizerCost = { 0.00, 5.95, 6.95, 8.95, 8.95, 10.95, 12.95, 6.95 };
private double[] MainCost = { 0.00, 15.95, 13.95, 13.95, 11.95, 19.95, 20.95, 18.95, 13.95, 14.95 };
private double[] DessertCost = { 0.00, 5.95, 3.95, 5.95, 4.95, 5.95 };
private double[] BeverageCost = { 0.00, 1.95, 1.50, 1.25, 2.95, 2.50, 1.50 };
protected void Page_Load(object sender, EventArgs e)
{
double cost = 0.00;
if (AppetizerDropDown.SelectedIndex != -1)
cost = AppetizerCost[AppetizerDropDown.SelectedIndex];
if (DropDownMain.SelectedIndex != -1)
cost += MainCost[DropDownMain.SelectedIndex];
if (DropDownDessert.SelectedIndex != -1)
cost += DessertCost[DropDownDessert.SelectedIndex];
if (DropDownBev.SelectedIndex != -1)
cost += BeverageCost[DropDownBev.SelectedIndex];
labelSubTotal.Text = String.Format("{0:C}", cost);
labelTax.Text = String.Format("{0:C}", cost * .07);
labelTotal.Text = String.Format("{0:C}", cost * 1.07);
}
protected void ButtonClear_Click(object sender, EventArgs e)
{
AppetizerDropDown.SelectedIndex = -1;
DropDownMain.SelectedIndex = -1;
DropDownDessert.SelectedIndex = -1;
DropDownBev.SelectedIndex = -1;
}
}
Last edited by nmnative; Nov 28th, 2007 at 4:23 pm.
•
•
Join Date: Nov 2007
Posts: 13
Reputation:
Solved Threads: 0
Sorry, here is the body of the file also. This might help.
<body>
<form id="form1" runat="server">
<div>
<br />
<strong>Appetizers</strong> <asp
ropDownList ID="AppetizerDropDown"
runat="server" AutoPostBack="True" OnSelectedIndexChanged="Page_Load" Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Buffalo Wings</asp:ListItem>
<asp:ListItem>Buffalo Fingers</asp:ListItem>
<asp:ListItem>Potato Skins</asp:ListItem>
<asp:ListItem>Nachos</asp:ListItem>
<asp:ListItem>Mushroom Caps</asp:ListItem>
<asp:ListItem>Shrimp Cocktail</asp:ListItem>
<asp:ListItem>Chips and Salsa</asp:ListItem>
</asp
ropDownList><br />
<br />
<strong>Main Course
<asp
ropDownList ID="DropDownMain" runat="server" OnSelectedIndexChanged="Page_Load"
Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Seafood Alfredo</asp:ListItem>
<asp:ListItem>Chicken Alfredo</asp:ListItem>
<asp:ListItem>Chicken Picatta</asp:ListItem>
<asp:ListItem>Turkey Club</asp:ListItem>
<asp:ListItem>Lobster Pie</asp:ListItem>
<asp:ListItem>Prime Rib</asp:ListItem>
<asp:ListItem>Shrimp Scampi</asp:ListItem>
<asp:ListItem>Turkey Dinner</asp:ListItem>
<asp:ListItem>Stuffed Chicken</asp:ListItem>
</asp
ropDownList><br />
<br />
Dessert
<asp
ropDownList ID="DropDownDessert" runat="server" OnSelectedIndexChanged="Page_Load"
Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Apple Pie</asp:ListItem>
<asp:ListItem>Sundae</asp:ListItem>
<asp:ListItem>Carrot Cake</asp:ListItem>
<asp:ListItem>Mud Pie</asp:ListItem>
<asp:ListItem>Apple Crisp</asp:ListItem>
</asp
ropDownList><br />
<br />
Beverages
<asp
ropDownList ID="DropDownBev" runat="server" OnSelectedIndexChanged="Page_Load"
Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Soda</asp:ListItem>
<asp:ListItem>Tea</asp:ListItem>
<asp:ListItem>Coffee</asp:ListItem>
<asp:ListItem>Mineral Water</asp:ListItem>
<asp:ListItem>Juice</asp:ListItem>
<asp:ListItem>Milk</asp:ListItem>
</asp
ropDownList><br />
<br />
Sub Total <asp:Label ID="labelSubTotal"
runat="server" Text="$0.00"></asp:Label>
<br />
<br />
Tax (.07%)
<asp:Label ID="labelTax" runat="server" Text="$0.00"></asp:Label><br />
<br />
Total
<asp:Label ID="labelTotal" runat="server" Text="$0.00"></asp:Label><br />
<br />
<asp:Button ID="ButtonClear" runat="server" OnClick="ButtonClear_Click" Text="Clear Items" /></strong></div>
</form>
</body>
<body>
<form id="form1" runat="server">
<div>
<br />
<strong>Appetizers</strong> <asp
ropDownList ID="AppetizerDropDown"runat="server" AutoPostBack="True" OnSelectedIndexChanged="Page_Load" Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Buffalo Wings</asp:ListItem>
<asp:ListItem>Buffalo Fingers</asp:ListItem>
<asp:ListItem>Potato Skins</asp:ListItem>
<asp:ListItem>Nachos</asp:ListItem>
<asp:ListItem>Mushroom Caps</asp:ListItem>
<asp:ListItem>Shrimp Cocktail</asp:ListItem>
<asp:ListItem>Chips and Salsa</asp:ListItem>
</asp
ropDownList><br /><br />
<strong>Main Course
<asp
ropDownList ID="DropDownMain" runat="server" OnSelectedIndexChanged="Page_Load"Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Seafood Alfredo</asp:ListItem>
<asp:ListItem>Chicken Alfredo</asp:ListItem>
<asp:ListItem>Chicken Picatta</asp:ListItem>
<asp:ListItem>Turkey Club</asp:ListItem>
<asp:ListItem>Lobster Pie</asp:ListItem>
<asp:ListItem>Prime Rib</asp:ListItem>
<asp:ListItem>Shrimp Scampi</asp:ListItem>
<asp:ListItem>Turkey Dinner</asp:ListItem>
<asp:ListItem>Stuffed Chicken</asp:ListItem>
</asp
ropDownList><br /><br />
Dessert
<asp
ropDownList ID="DropDownDessert" runat="server" OnSelectedIndexChanged="Page_Load"Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Apple Pie</asp:ListItem>
<asp:ListItem>Sundae</asp:ListItem>
<asp:ListItem>Carrot Cake</asp:ListItem>
<asp:ListItem>Mud Pie</asp:ListItem>
<asp:ListItem>Apple Crisp</asp:ListItem>
</asp
ropDownList><br /><br />
Beverages
<asp
ropDownList ID="DropDownBev" runat="server" OnSelectedIndexChanged="Page_Load"Width="125px">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Soda</asp:ListItem>
<asp:ListItem>Tea</asp:ListItem>
<asp:ListItem>Coffee</asp:ListItem>
<asp:ListItem>Mineral Water</asp:ListItem>
<asp:ListItem>Juice</asp:ListItem>
<asp:ListItem>Milk</asp:ListItem>
</asp
ropDownList><br /><br />
Sub Total <asp:Label ID="labelSubTotal"
runat="server" Text="$0.00"></asp:Label>
<br />
<br />
Tax (.07%)
<asp:Label ID="labelTax" runat="server" Text="$0.00"></asp:Label><br />
<br />
Total
<asp:Label ID="labelTotal" runat="server" Text="$0.00"></asp:Label><br />
<br />
<asp:Button ID="ButtonClear" runat="server" OnClick="ButtonClear_Click" Text="Clear Items" /></strong></div>
</form>
</body>
A couple of comments:
1. send me the files to shaulf@yahoo.com and I will go over them...
2. Use try catch block
3. I use some abbreviation for the controls named like dd for dropdown...ddMain, ddSecond etc'.
4. I would place the prices in the web.config - prices tend to change frequently
1. send me the files to shaulf@yahoo.com and I will go over them...
2. Use try catch block
3. I use some abbreviation for the controls named like dd for dropdown...ddMain, ddSecond etc'.
4. I would place the prices in the web.config - prices tend to change frequently
Shaul
•
•
Join Date: Nov 2007
Posts: 13
Reputation:
Solved Threads: 0
Should I set up an Access database for this menu?
Such as the appetizers, main course... , but leave the prices in an array.
Or should I also set the prices up in a database too.
I will set this up if this happens to be the right way to go and then post back if I
run into any problems. Again I am not asking for anyone to do my
homework for me, just to steer me in the right direction.
Thank you
Such as the appetizers, main course... , but leave the prices in an array.
Or should I also set the prices up in a database too.
I will set this up if this happens to be the right way to go and then post back if I
run into any problems. Again I am not asking for anyone to do my
homework for me, just to steer me in the right direction.
Thank you
•
•
•
•
Should I set up an Access database for this menu?
Such as the appetizers, main course... , but leave the prices in an array.
Or should I also set the prices up in a database too.
I will set this up if this happens to be the right way to go and then post back if I
run into any problems. Again I am not asking for anyone to do my
homework for me, just to steer me in the right direction.
Thank you
•
•
Join Date: Nov 2007
Posts: 13
Reputation:
Solved Threads: 0
•
•
•
•
If you do decide to use a database, keep all the data together or else it would become a mess to keep it all together. Personally, I'd use a SQL Express database, but I'm familiar with SQL and I've not used Access so there's a huge bias there. For something this small, you could just leave it in the code as well.
For the exercise we are supposed to use Microsoft Visual Web Developer 2008 Express Edition, well the professor urged us to use it anyway. I am still using Visual Studio 2005.
I am just having problems getting the items to add as they are selected. We did this same exercise first just using C# and now for our next assignment we have to incorporate this into a web site.
I am very close to finishing but I am just stuck on getting the prices to add up correctly. If anyone can help on this I will e mail the code. All I am looking for is a clue as to what I need to fix, not for anyone to do the fix for me. I do like to solve things out, but I am really stuck on this.
Thank you for the reply Infarction
![]() |
Similar Threads
- Request for VB.NET 2005 and ASP.NET Tutorials (IT Professionals' Lounge)
- visual c++ 2003 (C++)
- Programming FAQ - Updated 1/March/2005 (Computer Science)
- Visual C++/ CLI Developer (Software Development Job Offers)
- Web.config File (C#)
- The Visual Studio® 2005 Standard Edition (C++)
- MS Visual Studio/Getting jobs?? (C++)
- How to remove cool web search (Viruses, Spyware and other Nasties)
- A question on the visual studio suite... (Computer Science)
- Hot Offers and "Computer infected with spyware, download..." (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: Thread's colliding?
- Next Thread: Ratio in C# HOW??
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# c#gridviewcolumn chat check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel expression file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener localization mandelbrot math mouseclick mysql networking operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






