protected void Button_Save_Click(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); alayer.ModifyUserInformation(txtUserID.Text, txtUserPasswd.Text, txtUserName.Text, txtUserEmail.Text, txtUserMobile.Text); Response.Write("<script>alert('User information modify success');window.location='ViewUserPage.aspx';</script>"); }
protected void btnDelete_Click1(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); alayer.DeleteMainDisplayMenu(); Response.Write("<script> alert('All checked items are deleted');</script>"); }
protected void btnSave_Click(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); btnModify.Visible = true; btnSave.Visible = false; int groupnom = 0; if (txtMenuName.Text == "") { Response.Write("<script>alert('You have to input filename');</script>"); return; } else if (txtMenuPrice.Text == "") { Response.Write("<script>alert('You have to input menu price');</script>"); return; } else if (ImageUpload.PostedFile.FileName == "") { Response.Write("<script>alert('You have to input menu image');</script>"); return; } else if (txtMenuDescription.Text == "") { Response.Write("<script>alert('You have to input menu description');</script>"); return; } else { groupnom = Convert.ToInt32(Label_Groupno.Text); alayer.ModifyMenuInformation(groupnom, txtMenuName.Text, txtMenuPrice.Text, ImageUpload.PostedFile.FileName, txtMenuDescription.Text); Response.Write("<script>alert('Menu information is changed');</script>"); } }
protected void OnDeleteItem(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); Button btn = (Button)sender; alayer.DeleteCartMenu(btn.CommandName); Response.Write("<script>alert('Selected menu is deleted');</script>"); BindListView(); }
public void BindListView() { ConnectDatabase alayer = new ConnectDatabase(); DataTable dt; string GroupNo = ""; int num = 0; if (Request.QueryString["Menu_Group"] != null) { GroupNo = Request.QueryString["Menu_Group"]; Session["ClickGroup"] = GroupNo; num = Convert.ToInt32(GroupNo); } txtMenuGroup.Text = GroupNo; switch (num) { case 1: GroupNo = "Salad table"; break; case 2: GroupNo = "RiceRoll table"; break; case 3: GroupNo = "FullPackage table"; break; case 4: GroupNo = "Rice table"; break; case 5: GroupNo = "SideDish table"; break; case 6: GroupNo = "Sandwich table"; break; } btnAddMenu.Text = "Add to " + GroupNo; dt = alayer.GetViewMenuTableFromDB(num); if (dt != null) { MenuList.DataSource = dt; MenuList.DataBind(); } else { Response.Write("<script>alert('Can not use database table');window.location='ViewManagerPage.aspx';</script>"); return; } }
protected void Page_Load(object sender, EventArgs e) { SqlDataReader reader; string UserID, UserPasswd, UserName, UserEmail, UserMobile; ConnectDatabase alayer = new ConnectDatabase(); if (Request.Cookies["UserID"] == null) { Response.Write("<script>alert('You have to resister or login');window.location='UserLogin.aspx';</script>"); } else { HttpCookie acookie = Request.Cookies["UserID"]; String temp = acookie.Values["UserID"]; reader = alayer.GetUserImformation(temp); while (reader.HasRows) { UserID = reader.GetName(0); UserPasswd = reader.GetName(1); while (reader.Read()) { UserID = reader.GetString(0); UserPasswd = reader.GetString(1); UserName = reader.GetString(2); UserEmail = reader.GetString(3); UserMobile = reader.GetString(4); if (txtUserID.Text == "") { txtUserID.Text = UserID; } if (txtUserPasswd.Text == "") { txtUserPasswd.Text = UserPasswd; } if (txtUserName.Text == "") { txtUserName.Text = UserName; } if (txtUserEmail.Text == "") { txtUserEmail.Text = UserEmail; } if (txtUserMobile.Text == "") { txtUserMobile.Text = UserMobile; } } reader.NextResult(); } } }
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(); }
protected void Page_Load(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); SqlDataReader reader; int i = 0; string MenuName, GroupNo, path1; if (Session["CheckCount"] != null) { i = Convert.ToInt32(Session["CheckCount"]); if (i > 0) { return; } } Session["ImageNum"] = ""; reader = alayer.GetMainDisplaytMenu(); if (reader != null) { if (!reader.HasRows) { Response.Write("<script>alert('There is no image in DisplayMenu Table');</script>"); return; } while (reader.HasRows) { MenuName = reader.GetName(0); GroupNo = reader.GetName(1); while (reader.Read()) { MenuName = reader.GetString(0); GroupNo = reader.GetString(1); path1 = reader.GetString(2); path1 = path1.Trim(); if (path1 != "") { ViewMainDisplayMenu(i, GroupNo, MenuName, path1); i++; } } reader.NextResult(); } Session["ImageNum"] = Convert.ToString(i); } else { Response.Write("<script>alert('Can not use database table');window.location='ViewManagerPage.aspx';</script>"); return; } }
public void BindListView() { ConnectDatabase alayer = new ConnectDatabase(); DataTable dt; if (Request.Cookies["UserID"] == null) { Response.Write("<script>alert('You have to register or login');window.location='UserLogin.aspx';</script>"); } dt = alayer.GetViewCartMenuTableFromDB(); CartView.DataSource = dt; CartView.DataBind(); }
protected void OnOrderItem(object sender, EventArgs e) { string UserID = ""; ConnectDatabase alayer = new ConnectDatabase(); Button btn = (Button)sender; if (Request.Cookies["UserID"] != null) { HttpCookie acookie = Request.Cookies["UserID"]; UserID = acookie.Values["UserID"]; } alayer.SaveCartMenuToOrder(UserID, btn.CommandName, btn.CommandArgument); Response.Write("<script>alert('Selected menu is ordered');</script>"); }
protected void btnDelete_Click(object sender, EventArgs e) { int groupnom = 0; ConnectDatabase alayer = new ConnectDatabase(); if (txtMenuName.Text == "") { Response.Write("<script>alert('You have to input filename');</script>"); return; } else { groupnom = Convert.ToInt32(Label_Groupno.Text); alayer.DeleteOneItemFromTable(groupnom, txtMenuName.Text); Response.Write("<script>alert('Delete success');</script>"); } }
public void SaveSelectedMainDisplayMenu(string num, string name) { ConnectDatabase alayer = new ConnectDatabase(); int checkcount = 0; if (Session["CheckCount"] != null && !Session["CheckCount"].ToString().Equals("")) { checkcount = Convert.ToInt32(Session["CheckCount"]); } if (name != null && num != null) { alayer.SaveSelectedMainDisplayMenu(num, name); } checkcount++; Label2.Text = Convert.ToString(checkcount); Session["CheckCount"] = Convert.ToString(checkcount); }
protected void btnAddMainMenu_Click(object sender, EventArgs e) { int count = 0, gnum = 0; string path; ConnectDatabase alayer = new ConnectDatabase(); if (Session["ClickGroup"] != null) { gnum = Convert.ToInt32(Session["ClickGroup"]); } if (Session["ImageNum"] != null) { count = Convert.ToInt32(Session["ImageNum"]); } if (count == 8) { Response.Write("<script>alert('Can not add image anymore');</script>"); return; } path = CopyFile(); if (path != "") { if (alayer.CheckMainDisplayMenuImage(txtMenuName.Text)) { Response.Write("<script>alert('Same image has aready existed');</script>"); } else { alayer.SaveMainDisplayMenu(Session["ClickGroup"].ToString(), txtMenuName.Text, path); Session["ImageNum"] = count + 1; } Response.Write("<script>alert('Adding image success!!!');</script>"); BindListView(); ClearViewAddMenu(); } else { Response.Write("<script>alert('You have to input filename again');</script>"); return; } }
protected void Button_Register_Click(object sender, EventArgs e) { ConnectDatabase aLayer = new ConnectDatabase(); if (aLayer.CheckUserID(txtUserID.Text)) { Response.Write("<script>alert('Same UserID aleady exit!!');</script>"); } else { if (aLayer.SaveUserInformation(txtUserID.Text, txtUserPasswd.Text, txtUserName.Text, txtUserEmail.Text, txtUserMobile.Text)) { Response.Write("<script>alert('Register Success ^^');window.location = 'UserLogin.aspx';</script>"); return; } else { Response.Write("<script>alert('Can not use database table');window.location = 'ViewUserPage.aspx';</script>"); return; } } }
protected void btnLogin_Click(object sender, EventArgs e) { ConnectDatabase aLayer = new ConnectDatabase(); if (aLayer.CheckUserID(txtUserID.Text)) { if (aLayer.CheckUser_Passwd(txtUserPasswd.Text)) { if (txtUserID.Text == "Admin") { if (txtUserPasswd.Text == "Admin") { Response.Write("<script>alert('Move to Manager Page');window.location = 'ViewManagerPage.aspx';</script>"); } } else { HttpCookie acookie = new HttpCookie("UserID"); acookie.Values["UserID"] = txtUserID.Text; acookie.Expires.AddDays(30); Session["User_ID"] = txtUserID.Text; Response.Cookies.Add(acookie); Response.Write("<script>alert('Your login success');window.location = 'ViewUserPage.aspx';</script>"); } } else { ClearTextBox(); Response.Write("<script>alert('Can not find password');</script>"); } } else { ClearTextBox(); Response.Write("<script>alert('Can not find User ID');</script>"); } }
protected void btnGoCart_Click(object sender, EventArgs e) { ConnectDatabase alayer = new ConnectDatabase(); int num = 0; if (Request.Cookies["UserID"] == null) { Response.Write("<script>alert('You have to register or login');window.location='UserLogin.aspx';</script>"); return; } num = Convert.ToInt32(txtCount.Text.ToString()); if (num == 0) { Response.Write("<script>alert('Do not choose menu. Please choosing menu count');</script>"); return; } else { alayer.SaveCartMenu(Label_Groupno.Text, txtMenuName.Text, Session["ImagePath"].ToString(), txtCount.Text, txtMenuPrice.Text); Response.Write("<script>alert('This menu save the cart');window.location='ViewCart.aspx';</script>"); Session["ImagePath"] = ""; } }
public void BindListView() { ConnectDatabase alayer = new ConnectDatabase(); DataTable dt; string GroupNo; int num = 0; if (Request.QueryString["Menu_Group"] != null) { GroupNo = Request.QueryString["Menu_Group"]; Session["ClickGroup"] = GroupNo; num = Convert.ToInt32(GroupNo); } dt = alayer.GetViewMenuTableFromDB(num); if (dt != null) { MenuList.DataSource = dt; MenuList.DataBind(); } else { Response.Write("<script>alert('Can not use database table');window.location='ViewUserPage.aspx';</script>"); } }