示例#1
0
        protected void Update_Click(object sender, EventArgs e)
        {
            String imgPath = "";

            if (FileUpload1.HasFile)
            {
                String FileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName).Substring(1);

                String filePath = Request.PhysicalApplicationPath + "images";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                filePath += @"\menu" + menuID + "." + FileExtension;
                imgPath   = "./images/menu" + menuID + "." + FileExtension;

                FileUpload1.SaveAs(filePath);
            }
            else
            {
                imgPath = "./images/menu0.jpg";
            }

            String strCheckbox = "0";

            if (cbPromotion.Checked)
            {
                strCheckbox = "1";
            }

            db.UpdateMenu(menuID, tbMenuName.Text, Double.Parse(tbMenuPrice.Text), tbMenuDesc.Text, strCheckbox, Double.Parse(tbPromoPrice.Text), imgPath);
            db.closeConnection();
            Response.Redirect("Menu.aspx?shopID=" + shopID);
        }
示例#2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            db = new DbLayer();

            int    shopID  = db.getMaxShopID() + 1;
            String imgPath = "";

            if (FileUpload1.HasFile)
            {
                String filePath = Request.PhysicalApplicationPath + "images";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                filePath += @"\shop" + shopID + ".jpg";
                imgPath   = "./images/shop" + shopID + ".jpg";

                FileUpload1.SaveAs(filePath);
            }
            else
            {
                imgPath = "./images/shop0.jpg";
            }

            db.insertShop(shopID, tbShopName.Text, tbShopSubName.Text, tbShopInformation.Text, tbShopAddress.Text, tbShopPhone.Text, DropDownList1.Text, imgPath);
            db.closeConnection();
            Response.Redirect("Restaurant.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            shopID = int.Parse(Request.Params[0]);
            if (shopID <= 0)
            {
                Response.Redirect("Default.aspx");
            }

            DbLayer       dao    = new DbLayer();
            SqlDataReader reader = dao.GetAllMenu(shopID);

            lbTest.Text += "<table style='border: 1px #000000 solid;'>";
            lbTest.Text += " <tr style='background-color: yellow'> <th> Menu ID </th> <th> Menu Name </th> <th> Menu Price </th> <th> Menu Desc </th> <th> Image </th> </tr>";

            while (reader.Read())
            {
                lbTest.Text += "<tr style='background-color: #bfbeb8'>";
                lbTest.Text += "<td> " + reader.GetInt32(0) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(2) + "</td>";
                lbTest.Text += "<td> " + reader.GetDouble(3) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(4) + "</td>";
                lbTest.Text += "<td><img src='" + reader.GetString(5) + "' width='100px' height='100px' /></td>";
                lbTest.Text += "</tr>";
            }

            lbTest.Text += " </table>";
            reader.Close();
            dao.closeConnection();
        }
示例#4
0
        protected void Search_Click(object sender, EventArgs e)
        {
            DbLayer       dao    = new DbLayer();
            SqlDataReader reader = dao.GetAllShop(DropDownList1.Text, tbSearch.Text);

            lbTest.Text = "";

            lbTest.Text += "<table style='border: 1px #000000 solid;'>";
            lbTest.Text += " <tr style='background-color: yellow'> <th> Shop ID </th> <th> Shop Name </th> <th> Shop SubName </th> <th> Shop Introduce </th> <th> Shop Address </th> <th> Shop Phone </th> <th> Shop Region </th> <th> Image </th> <th> EDIT </th> <th> DELETE </th> <th> VIEW MENU </th> </tr>";

            while (reader.Read())
            {
                lbTest.Text += "<tr style='background-color: #bfbeb8'>";
                lbTest.Text += "<td> " + reader.GetInt32(0) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(1) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(2) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(3) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(4) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(5) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(6) + "</td>";
                lbTest.Text += "<td><img src='" + reader.GetString(7) + "' width='100px' height='100px' /></td>";
                lbTest.Text += "<td style='text-align:center;'> <a href=UpdateShop.aspx?shopID=" + reader.GetInt32(0) + "> EDIT </td>";
                lbTest.Text += "<td style='text-align:center;'> <a href=DeleteShop.aspx?shopID=" + reader.GetInt32(0) + "> DELETE </td>";
                lbTest.Text += "<td style='text-align:center;'> <a href=menu.aspx?shopID=" + reader.GetInt32(0) + "> GO </td>";
                lbTest.Text += "</tr>";
            }

            lbTest.Text += " </table>";
            reader.Close();
            dao.closeConnection();
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            String imgPath = "";

            if (FileUpload1.HasFile)
            {
                String FileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName).Substring(1);

                String filePath = Request.PhysicalApplicationPath + "images";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                filePath += @"\shop" + shopID + "." + FileExtension;
                imgPath   = "./images/shop" + shopID + "." + FileExtension;

                FileUpload1.SaveAs(filePath);
            }
            else
            {
                imgPath = "./images/shop0.jpg";
            }

            db.UpdateShop(shopID, tbShopName.Text, tbShopSubName.Text, tbShopInformation.Text, tbShopAddress.Text, tbShopPhone.Text, DropDownList1.Text, imgPath);
            db.closeConnection();
            Response.Redirect("Restaurant.aspx");
        }
示例#6
0
        protected void btnCheckOut_Click(object sender, EventArgs e)
        {
            DbLayer dao = new DbLayer();

            dao.deleteAllFavourite(strCookieNmae);
            dao.closeConnection();
            Response.Redirect("Favourites.aspx");
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                userName = Request.Cookies["user"].Value;

                if (!userName.Equals("*****@*****.**"))
                {
                    Response.Redirect("~/Default.aspx");
                }
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            if (!this.IsPostBack)
            {
                DbLayer       dao    = new DbLayer();
                SqlDataReader reader = dao.GetAllShop(DropDownList1.Text, tbSearch.Text);

                lbTest.Text += "<table style='border: 1px #000000 solid;'>";
                lbTest.Text += " <tr style='background-color: yellow'> <th> Shop ID </th> <th> Shop Name </th> <th> Shop SubName </th> <th> Shop Introduce </th> <th> Shop Address </th> <th> Shop Phone </th> <th> Shop Region </th> <th> Image </th> <th> EDIT </th> <th> DELETE </th> <th> VIEW MENU </th> </tr>";

                while (reader.Read())
                {
                    lbTest.Text += "<tr style='background-color: #bfbeb8'>";
                    lbTest.Text += "<td> " + reader.GetInt32(0) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(1) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(2) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(3) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(4) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(5) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(6) + "</td>";
                    lbTest.Text += "<td><img src='" + reader.GetString(7) + "' width='100px' height='100px' /></td>";
                    lbTest.Text += "<td style='text-align:center;'> <a href=UpdateShop.aspx?shopID=" + reader.GetInt32(0) + "> EDIT </td>";
                    lbTest.Text += "<td style='text-align:center;'> <a href=DeleteShop.aspx?shopID=" + reader.GetInt32(0) + "> DELETE </td>";
                    lbTest.Text += "<td style='text-align:center;'> <a href=menu.aspx?shopID=" + reader.GetInt32(0) + "> GO </td>";
                    lbTest.Text += "</tr>";
                }

                lbTest.Text += " </table>";
                reader.Close();
                dao.closeConnection();
            }
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                userName = Request.Cookies["user"].Value;

                if (!userName.Equals("*****@*****.**"))
                {
                    Response.Redirect("~/Default.aspx");
                }
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            DbLayer       dao    = new DbLayer();
            SqlDataReader reader = dao.GetAllUser();

            lbTest.Text += "<table style='border: 1px #000000 solid;'>";
            lbTest.Text += " <tr height='60px' style='background-color: yellow'> <th> User ID </th> <th> User Name </th> <th> User Email </th> <th> User Connection Count </th> <th> User Region </th> <th> EDIT USER </th> <th> EDIT PASSWORD </th> <th> DELETE </th> </tr>";
            while (reader.Read())
            {
                lbTest.Text += "<tr height='60px' style='background-color: #bfbeb8'>";
                lbTest.Text += "<td> " + reader.GetInt32(0) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(3) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(1) + "</td>";
                lbTest.Text += "<td style='text-align:center;'> " + reader.GetInt32(4) + "</td>";
                lbTest.Text += "<td> " + reader.GetString(5) + "</td>";
                lbTest.Text += "<td> <a href=UpdateUser.aspx?userID=" + reader.GetInt32(0) + "> EDIT USER </td>";
                lbTest.Text += "<td> <a href=UpdateUserPwd.aspx?userID=" + reader.GetInt32(0) + "> EDIT PASSWORD </td>";
                lbTest.Text += "<td> <a href=DeleteUser.aspx?userID=" + reader.GetInt32(0) + "> DELETE </td>";
                lbTest.Text += "</tr>";
            }

            lbTest.Text += " </table>";
            reader.Close();
            dao.closeConnection();
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                strCookieNmae = Request.Cookies["user"].Value;
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            //if (!this.IsPostBack)
            {
                DbLayer       dao    = new DbLayer();
                SqlDataReader reader = dao.GetAllFavourite(strCookieNmae);

                lbTest.Text += "<table style='border: 1px #000000 solid;'>";
                lbTest.Text += " <tr><td colspan='7' height='60px' style='font-size:x-large;text-align: center;color: blue;'><strong>" + strCookieNmae + " Favourite List</strong></td></tr> ";
                lbTest.Text += " <tr style='background-color: yellow'> <th> Shop Name </th> <th> Shop SubName </th> <th> Shop Introduce </th> <th> Shop Address </th> <th> Shop Phone </th> <th> Shop Image </th> <th> DELETE </th> </tr>";

                while (reader.Read())
                {
                    lbTest.Text += "<tr style='background-color: #bfbeb8'>";
                    lbTest.Text += "<td> " + reader.GetString(0) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(1) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(2) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(3) + "</td>";
                    lbTest.Text += "<td> " + reader.GetString(4) + "</td>";
                    lbTest.Text += "<td><img src='" + reader.GetString(5) + "' width='100px' height='100px' /></td>";
                    lbTest.Text += "<td style='text-align:center;'> <a href=DeleteFavourite.aspx?favouriteID=" + reader.GetInt32(6) + "> DELETE </td>";
                    lbTest.Text += "</tr>";
                }

                lbTest.Text += " </table>";
                reader.Close();
                dao.closeConnection();
            }
        }
示例#10
0
 protected void Delete_Click(object sender, EventArgs e)
 {
     db.deleteFavourite(favouriteID);
     db.closeConnection();
     Response.Redirect("Favourites.aspx");
 }
 protected void Delete_Click(object sender, EventArgs e)
 {
     db.DeleteMenu(menuID);
     db.closeConnection();
     Response.Redirect("Menu.aspx?shopID=" + shopID);
 }
示例#12
0
 protected void Delete_Click(object sender, EventArgs e)
 {
     db.DeleteShop(shopID);
     db.closeConnection();
     Response.Redirect("Restaurant.aspx");
 }
示例#13
0
 protected void Delete_Click(object sender, EventArgs e)
 {
     db.DeleteUser(userID);
     db.closeConnection();
     Response.Redirect("Customer.aspx");
 }