protected void Page_Load(object sender, EventArgs e) { OrderID = Request.QueryString["Id"]; MenuID = Request.QueryString["mn"]; SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd2 = con.CreateCommand(); cmd2.CommandType = CommandType.Text; cmd2.CommandText = "Select * from Menu where Id like '%" + MenuID + "%'"; cmd2.ExecuteNonQuery(); DataTable dt2 = new DataTable(); SqlDataAdapter sda2 = new SqlDataAdapter(cmd2); sda2.Fill(dt2); int a = dt2.Rows.Count; //btnConfirm.Text = a.ToString(); //btnCancel.Text = MenuID; if (dt2.Rows.Count > 0) { StringBuilder html = new StringBuilder(); html.Append("<div style='width:100%; height:230px;'>"); html.Append("<img style='width:100%; height:auto' src='"); html.Append(dt2.Rows[0][6].ToString()); html.Append("' /></div>"); html.Append("<h3 class='label-menu'>"); html.Append(dt2.Rows[0][1].ToString()); html.Append("</h3>"); html.Append("<h3 class='label-desc' style='line-height:15px'>"); html.Append(dt2.Rows[0][2].ToString()); html.Append("</h3>"); html.Append("<h5 class='widthmax label-price'>RM"); html.Append(dt2.Rows[0][3].ToString()); html.Append("</h5>"); PlaceHolderItem.Controls.Add(new Literal { Text = html.ToString() }); } else { ; } con.Close(); //Order Info using (CreateOrder CO = new CreateOrder()) { double total = Convert.ToDouble(CO.DisplayTotalPrice(OrderID)); double sbtl = CO.retrieveMenuPrice(MenuID); lblTotal.Text = (total + sbtl).ToString(); lblsubtotal.Text = sbtl.ToString(); menupr = sbtl; } if (!IsPostBack) { using (CreateOrder CO = new CreateOrder()) { Dictionary <String, int> GetOrderedItems = CO.GetOrderedItems(OrderID); foreach (KeyValuePair <String, int> item in GetOrderedItems) { if (item.Key.Equals(MenuID)) { txtQty.SelectedIndex = (item.Value - 1); } } double newprice = menupr * Convert.ToDouble(txtQty.SelectedValue); lblsubtotal.Text = newprice.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { OrderID = Request.QueryString["id"]; Opr = Request.QueryString["opr"]; if (Opr == "view") { lblHeadView.Text = "Order No. " + OrderID; lblHeadView.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop2", "viewOnly();", true); } Dictionary <String, int> Items = new Dictionary <string, int>(); DataTable OrderInfo = new DataTable(); DataTable ItemOrderInfo = new DataTable(); using (CreateOrder CO = new CreateOrder()) { Items = CO.GetOrderedItems(OrderID); OrderInfo = CO.GetOrderInfo(OrderID); ItemOrderInfo = CO.ItemInfoOrder(Items); } StringBuilder htmlMenu = new StringBuilder(); StringBuilder htmlTotal = new StringBuilder(); StringBuilder htmlTotalQty = new StringBuilder(); int n = Items.Count; for (int i = 0; i < n; i++) { htmlMenu.Append("<div class='row2 borderbtm'>"); htmlMenu.Append("<div style='float:left; width:53%;padding-right:2%; height:100%;' >"); htmlMenu.Append("<img src='"); htmlMenu.Append(ItemOrderInfo.Rows[i][6].ToString()); htmlMenu.Append("' style='width:15%;height:auto;padding-top:20px;margin-right:10px; float:left' />"); htmlMenu.Append("<h2 class='label2'>"); htmlMenu.Append(ItemOrderInfo.Rows[i][1].ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("<div style='float:left;width:15%;height:100%;' >"); htmlMenu.Append("<h2 class='label2' >"); htmlMenu.Append(ItemOrderInfo.Rows[i][3].ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("<div style='float:left;width:15%;height:100%;' >"); htmlMenu.Append("<h2 class='label2' >"); htmlMenu.Append(Items[ItemOrderInfo.Rows[i][0].ToString()].ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("<div style='float:left;width:15%;height:100%;' >"); double pr = Convert.ToDouble(Items[ItemOrderInfo.Rows[i][0].ToString()].ToString()) * Convert.ToDouble(ItemOrderInfo.Rows[i][3].ToString()); htmlMenu.Append("<h2 class='label2' >"); htmlMenu.Append(pr.ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("</div>"); } PlaceHolderItems.Controls.Add(new Literal { Text = htmlMenu.ToString() }); htmlTotalQty.Append("<h2 class='label2 bold2'>"); htmlTotalQty.Append(OrderInfo.Rows[0][3].ToString()); htmlTotalQty.Append("</h2>"); htmlTotal.Append("<h2 class='label2 bold2'>RM"); htmlTotal.Append(OrderInfo.Rows[0][2].ToString()); htmlTotal.Append("</h2>"); PlaceHolderTotal.Controls.Add(new Literal { Text = htmlTotal.ToString() }); PlaceHolderTotQty.Controls.Add(new Literal { Text = htmlTotalQty.ToString() }); StringBuilder htmlOrderInfo = new StringBuilder(); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(Session["name"].ToString() + " " + Session["LName"].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][4].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][7].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][8].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("</div>"); htmlOrderInfo.Append("<h2 class='label3' style='float:left;width:60%'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][5].ToString()); htmlOrderInfo.Append("</h2>"); PlaceHolderOrderInfo.Controls.Add(new Literal { Text = htmlOrderInfo.ToString() }); }
protected void Page_Load(object sender, EventArgs e) { OrderID = Request.QueryString["id"]; Dictionary <String, int> Items = new Dictionary <string, int>(); DataTable OrderInfo = new DataTable(); DataTable ItemOrderInfo = new DataTable(); using (CreateOrder CO = new CreateOrder()) { Items = CO.GetOrderedItems(OrderID); OrderInfo = CO.GetOrderInfo(OrderID); ItemOrderInfo = CO.ItemInfoOrder(Items); } StringBuilder htmlMenu = new StringBuilder(); StringBuilder htmlTotal = new StringBuilder(); StringBuilder htmlTotalQty = new StringBuilder(); int n = Items.Count; for (int i = 0; i < n; i++) { htmlMenu.Append("<div class='row2 borderbtm'>"); htmlMenu.Append("<div style='float:left; width:53%;padding-right:2%; height:100%;' >"); htmlMenu.Append("<img src='"); htmlMenu.Append(ItemOrderInfo.Rows[i][6].ToString()); htmlMenu.Append("' style='width:15%;height:auto;padding-top:20px;margin-right:10px; float:left' />"); htmlMenu.Append("<h2 class='label2'>"); htmlMenu.Append(ItemOrderInfo.Rows[i][1].ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("<div style='float:left;width:15%;height:100%;' >"); htmlMenu.Append("<h2 class='label2' >"); htmlMenu.Append(ItemOrderInfo.Rows[i][3].ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("<div style='float:left;width:15%;height:100%;' >"); htmlMenu.Append("<h2 class='label2' >"); htmlMenu.Append(Items[ItemOrderInfo.Rows[i][0].ToString()].ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("<div style='float:left;width:15%;height:100%;' >"); double pr = Convert.ToDouble(Items[ItemOrderInfo.Rows[i][0].ToString()].ToString()) * Convert.ToDouble(ItemOrderInfo.Rows[i][3].ToString()); htmlMenu.Append("<h2 class='label2' >"); htmlMenu.Append(pr.ToString()); htmlMenu.Append("</h2>"); htmlMenu.Append("</div>"); htmlMenu.Append("</div>"); } PlaceHolderItems.Controls.Add(new Literal { Text = htmlMenu.ToString() }); htmlTotalQty.Append("<h2 class='label2 bold2'>"); htmlTotalQty.Append(OrderInfo.Rows[0][3].ToString()); htmlTotalQty.Append("</h2>"); htmlTotal.Append("<h2 class='label2 bold2'>RM"); htmlTotal.Append(OrderInfo.Rows[0][2].ToString()); htmlTotal.Append("</h2>"); PlaceHolderTotal.Controls.Add(new Literal { Text = htmlTotal.ToString() }); PlaceHolderTotQty.Controls.Add(new Literal { Text = htmlTotalQty.ToString() }); StringBuilder htmlOrderInfo = new StringBuilder(); String name; using (CreateOrder CO = new CreateOrder()) { name = CO.GetCustName(OrderInfo.Rows[0][1].ToString()); } htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(name); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][4].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][7].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("<h2 class='label3'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][8].ToString()); htmlOrderInfo.Append("</h2>"); htmlOrderInfo.Append("</div>"); htmlOrderInfo.Append("<h2 class='label3' style='float:left;width:60%'>"); htmlOrderInfo.Append(OrderInfo.Rows[0][5].ToString()); htmlOrderInfo.Append("</h2>"); PlaceHolderOrderInfo.Controls.Add(new Literal { Text = htmlOrderInfo.ToString() }); lblstatus.Text = OrderInfo.Rows[0][9].ToString(); }