protected void Page_Load(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); SqlDataReader reader; int num = 0; string GroupNo, MenuName = "", ImagePath, MenuPrice, MenuDescription, Mode; if (Request.QueryString["Menu_Name"] != null) { MenuName = Request.QueryString["Menu_Name"]; } if (Request.QueryString["Menu_Group"] != null) { GroupNo = Request.QueryString["Menu_Group"]; Label_Groupno.Text = GroupNo; num = Convert.ToInt32(GroupNo.ToString()); } reader = alayer.GetAllMenuTableFromDB(num, MenuName); if (reader != null) { while (reader.HasRows) { MenuName = reader.GetName(0); MenuPrice = reader.GetName(1); while (reader.Read()) { MenuName = reader.GetString(0); MenuPrice = reader.GetString(1); ImagePath = reader.GetString(2); MenuDescription = reader.GetString(3); ImagePath = ImagePath.Trim(); MenuDescription = MenuDescription.Trim(); Label3.Text = MenuName; Image1.ImageUrl = ImagePath; txtMenuName.Text = MenuName; txtMenuPrice.Text = MenuPrice; Session["ImagePath"] = ImagePath; txtMenuDescription.Text = MenuDescription; } reader.NextResult(); } } else { Response.Write("<script>alert('Can not get data from database');window.location='ViewUserPage.aspx';</script>"); return; } reader.Close(); }
public CTable CreateCTableObject() { CTable o = new CTable(""); o.SetFieldValue("EXT_FLAG", "A"); o.SetFieldValue("SELECTION_TYPE", SelectionType); o.SetFieldValue("ITEM_ID", ItemID); o.SetFieldValue("ITEM_NAME_THAI", ItemName); o.SetFieldValue("ITEM_CODE", ItemCode); o.SetFieldValue("ITEM_CATEGORY_ID", ItemCategoryID); o.SetFieldValue("SERVICE_ID", ServiceID); o.SetFieldValue("SERVICE_NAME", ServiceName); o.SetFieldValue("SERVICE_CODE", ServiceCode); o.SetFieldValue("CODE", Code); o.SetFieldValue("NAME", Name); o.SetFieldValue("VOUCHER_ID", si.VoucherID); o.SetFieldValue("VOUCHER_NAME", si.VoucherName); o.SetFieldValue("VOUCHER_CODE", si.VoucherNo); o.SetFieldValue("FREE_TEXT", si.FreeText); String flag = "N"; if (IsTray) { flag = "Y"; } o.SetFieldValue("IS_TRAY", flag); String pricedFlag = "N"; if (IsPriced) { pricedFlag = "Y"; } o.SetFieldValue("IS_PRICED", pricedFlag); o.SetFieldValue("TOTAL_AMOUNT", TotalAmount.ToString()); o.SetFieldValue("DISCOUNT", Discount.ToString()); o.SetFieldValue("AMOUNT", Amount.ToString()); o.SetFieldValue("QUANTITY", Quantity.ToString()); o.SetFieldValue("BASKET_TYPE", ((int)BasketType).ToString()); o.SetFieldValue("BUNDLE_AMOUNT", BundledAmount.ToString()); o.SetFieldValue("GROUP_NO", GroupNo.ToString()); o.SetFieldValue("SEQUENCE", Sequence.ToString()); o.SetFieldValue("PROMOTION_CODE", Sequence.ToString()); o.SetFieldValue("PROMOTION_NAME", Sequence.ToString()); o.SetFieldValue("DISPLAY_CATEGORY", DisplayCategory.ToString()); return(o); }