I need help with this project. This project is in C program. Please Help me with
ID: 3766943 • Letter: I
Question
I need help with this project. This project is in C program. Please Help me with Maintainance menu options: add,delete, modify, and save.
Create a multi-file program that incorporates the functionality and allows the user to maintain the data in the file. Options in the main menu allow the user to: 1) display all pizzas, 2) display all pizzas by a specific style, 3) display a specific pizza by name, 4) display pizzas under a specific calorie count (for large size), 5) sort the data by name, 6) sort the data by calories, 7) maintain the pizza information, and 9) exit. Allow the user to repeatedly select menu options before selecting to exit.
Options in the maintainence menu allow the user to: 1) add information for a pizza, 2) modify pizza information, 3) delete information for a pizza, 4) save pizza information to a file, and 9) exit. (Place the code in a separate source file.)
Create functions for each of the menu options.
Include a comment before each function to document its processing, parameters and return value.
Notes:
Include a comment containing your name, course, date, and file name at the beginning of each source file
Properly indent the source code and provide comments before each function describing the parameters, return value, and processing
Create a project containing multiple source and header files
Use functions, arrays, pointers, strings, structures, and files in your program.
The file:
Stuffed|5-Meat|Red|Canadian Bacon, Pepperoni, Sausage, Bacon, Ground Beef|460|490
Gourmet|Angus Steak & Roasted Garlic|Creamy Garlic|Angus Steak, Roasted Garlic, Mushrooms, Green Onions, Parmesan|330|370
Stuffed|Chicago-Style|Red|Salami, Pepperoni, Sausage, Ground Beef, Mixed Onions, Tomatoes, Green Onions|450|490
Stuffed|Chicken Bacon|Creamy Garlic|Chicken, Bacon, Tomatoes, Mixed Onions|450|480
Gourmet|Chicken Bacon Artichoke|Creamy Garlic|Chicken, Bacon, Artichoke Hearts, Spinach, Parmesan, Zesty Herbs|350|400
Signature|Chicken Garlic|Creamy Garlic|Chicken, Tomatoes, Green Onions, Herbs & Cheese|340|380
Signature|Cowboy|Red|Pepperoni, Sausage, Mushrooms, Black Olives, Herbs & Cheese|370|410
Signature|Garden Veggie|Red|Mushrooms, Black Olives, Mixed Onions, Green Peppers, Tomatoes|270|310
Gourmet|Gourmet Vegetarian|Creamy Garlic|Spinach, Zucchini, Mushrooms, Artichoke Hearts, Tomatoes, Mixed Onions, Herbs & Cheese|320|360
Gourmet|Herb Chicken Mediterranean|Olive Oil & Garlic|Herb Chicken, Spinach, Sun-dried Tomatoes, Feta, Zesty Herbs|330|380
Signature|Murphy's Combo|Red|Salami, Pepperoni, Sausage, Mushrooms, Mixed Onions, Black Olives|350|400
Signature|Papa's All Meat|Red|Canadian Bacon, Salami, Pepperoni, Sausage, Ground Beef|350|400
Signature|Papa's Favorite|Red|Pepperoni, Sausage, Ground Beef, Mushrooms, Mixed Onions, Green Peppers, Black Olives|350|400
Gourmet|Spicy Fennel Sausage|Creamy Garlic|Spicy Fennel Sausage, Sun-dried Tomatoes, Mushrooms, Spinach, Parmesan|350|410
Explanation / Answer
{
if (!IsPostBack)
{
BindEmployeeDetails();
}
}
protected void BindEmployeeDetails()
{
con.Open();
SqlCommand cmd = new SqlCommand("Select * from Employee_Details", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
if (ds.Tables[0].Rows.Count > 0)
{
gvDetails.DataSource = ds;
gvDetails.DataBind();
}
else
{
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
gvDetails.DataSource = ds;
gvDetails.DataBind();
int columncount = gvDetails.Rows[0].Cells.Count;
gvDetails.Rows[0].Cells.Clear();
gvDetails.Rows[0].Cells.Add(new TableCell());
gvDetails.Rows[0].Cells[0].ColumnSpan = columncount;
gvDetails.Rows[0].Cells[0].Text = "No Records Found";
}
}
protected void gvDetails_RowEditing(object sender, GridViewEditEventArgs e)
{
gvDetails.EditIndex = e.NewEditIndex;
BindEmployeeDetails();
}
protected void gvDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int userid = Convert.ToInt32(gvDetails.DataKeys[e.RowIndex].Value.ToString());
string username = gvDetails.DataKeys[e.RowIndex].Values["UserName"].ToString();
TextBox txtcity = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtcity");
TextBox txtDesignation = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtDesg");
con.Open();
SqlCommand cmd = new SqlCommand("update Employee_Details set City='" + txtcity.Text +"',Designation='" + txtDesignation.Text + "' where UserId=" + userid, con);
cmd.ExecuteNonQuery();
con.Close();
lblresult.ForeColor = Color.Green;
lblresult.Text = username + " Details Updated successfully";
gvDetails.EditIndex = -1;
BindEmployeeDetails();
}
protected void gvDetails_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
gvDetails.EditIndex = -1;
BindEmployeeDetails();
}
protected void gvDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int userid = Convert.ToInt32(gvDetails.DataKeys[e.RowIndex].Values["UserId"].ToString());
string username = gvDetails.DataKeys[e.RowIndex].Values["UserName"].ToString();
con.Open();
SqlCommand cmd = new SqlCommand("delete from Employee_Details where UserId=" + userid, con);
int result = cmd.ExecuteNonQuery();
con.Close();
if (result == 1)
{
BindEmployeeDetails();
lblresult.ForeColor = Color.Red;
lblresult.Text = username + " details deleted successfully";
}
}
protected void gvDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName.Equals("AddNew"))
{
TextBox txtUsrname = (TextBox)gvDetails.FooterRow.FindControl("txtftrusrname");
TextBox txtCity = (TextBox)gvDetails.FooterRow.FindControl("txtftrcity");
TextBox txtDesgnation = (TextBox) gvDetails.FooterRow.FindControl("txtftrDesignation");
con.Open();
SqlCommand cmd =
new SqlCommand(
"insert into Employee_Details(UserName,City,Designation) values('" + txtUsrname.Text + "','" +
txtCity.Text + "','" + txtDesgnation.Text + "')", con);
int result= cmd.ExecuteNonQuery();
con.Close();
if(result==1)
{
BindEmployeeDetails();
lblresult.ForeColor = Color.Green;
lblresult.Text = txtUsrname.Text + " Details inserted successfully";
}
else
{
lblresult.ForeColor = Color.Red;
lblresult.Text = txtUsrname.Text + " Details not inserted";
}
}
}