protected void btnUpdateCake_Click(object sender, EventArgs e)
        {
            string picExt;
            string cakePic;

            //Cake cake = DatabaseRepositories.findCake(inputCakeName.Text);
            Cake cake = DatabaseRepositories.findCake(inputCakeName.Text);

            if (editCake == null)
            {
                errorText.Text = "Cake Does Not Exist";
            }
            else
            {
                if (inputCakeName.Text == "")
                {
                    errorText.Text = "Input Cake Name";
                }
                else if (inputCakeName.Text != editCake.CakeName && cake != null)
                {
                    errorText.Text = "Cake Name Already Exist";
                }
                else if (inputPrice.Text == "")
                {
                    errorText.Text = "Cake Price Must Not Empty";
                }
                else if (inputStock.Text == "")
                {
                    errorText.Text = "Cake Stock Must Not Empty & Greater Than 0";
                }
                else if (Int32.Parse(inputStock.Text) <= 0)
                {
                    errorText.Text = "Cake Stock Must Not Empty & Greater Than 0";
                }
                else
                {
                    if (this.uploadPicture.HasFile)
                    {
                        //picExt = uploadPicture.FileName.Substring(uploadPicture.FileName.Length - 4);

                        picExt = System.IO.Path.GetExtension(uploadPicture.FileName).ToLower();

                        if (picExt == ".jpg" || picExt == ".png")
                        {
                            this.uploadPicture.SaveAs(Server.MapPath("~/") + inputCakeName.Text + picExt);
                            cakePic = inputCakeName.Text + picExt;

                            string cakeName  = inputCakeName.Text;
                            int    cakePrice = Int32.Parse(inputPrice.Text);
                            int    cakeStock = Int32.Parse(inputStock.Text);

                            List <Cake> c   = DatabaseRepositories.getAllCake(editCake.CakeName);
                            int         row = DatabaseRepositories.updateCake(c, cakeName, cakePrice, cakeStock, cakePic);
                        }
                        else
                        {
                            errorText.Text = "Image Ekstension Must be .jpg or .png";
                        }
                    }
                    else
                    {
                        string cakeName  = inputCakeName.Text;
                        int    cakePrice = Int32.Parse(inputPrice.Text);
                        int    cakeStock = Int32.Parse(inputStock.Text);
                        cakePic = null;

                        List <Cake> c   = DatabaseRepositories.getAllCake(editCake.CakeName);
                        int         row = DatabaseRepositories.updateCake(c, cakeName, cakePrice, cakeStock, cakePic);
                    }

                    Response.Redirect("Cake.aspx");
                }
            }
        }
        protected void btnAddCake_Click(object sender, EventArgs e)
        {
            string picExt;
            string cakePic;

            Cake cake = DatabaseRepositories.findCake(inputCakeName.Text);

            if (cake == null)
            {
                if (inputCakeName.Text == "")
                {
                    errorText.Text = "Input Cake Name";
                }
                else if (inputPrice.Text == "")
                {
                    errorText.Text = "Cake Price Must Not Empty";
                }
                else if (inputStock.Text == "")
                {
                    errorText.Text = "Cake Stock Must Not Empty & Greater Than 0";
                }
                else if (Int32.Parse(inputStock.Text) <= 0)
                {
                    errorText.Text = "Cake Stock Must Not Empty & Greater Than 0";
                }
                else
                {
                    if (this.uploadPicture.HasFile)
                    {
                        picExt = uploadPicture.FileName.Substring(uploadPicture.FileName.Length - 4);
                        if (picExt == ".jpg" || picExt == ".png")
                        {
                            this.uploadPicture.SaveAs(Server.MapPath("~/") + inputCakeName.Text + picExt);
                            cakePic = inputCakeName.Text + picExt;

                            string cakeName  = inputCakeName.Text;
                            int    cakePrice = Int32.Parse(inputPrice.Text);
                            int    cakeStock = Int32.Parse(inputStock.Text);

                            Cake c   = CakeFactory.create(cakeName, cakePrice, cakeStock, cakePic);
                            int  row = DatabaseRepositories.addCake(c);

                            if (row > 0)
                            {
                                errorText.ForeColor = System.Drawing.Color.Blue;
                                errorText.Text      = "Add Cake Success";
                            }
                            else
                            {
                                errorText.Text = "Add Cake Failed";
                            }
                        }
                        else
                        {
                            errorText.Text = "Image Ekstension Must be .jpg or .png";
                        }
                    }
                    else
                    {
                        string cakeName  = inputCakeName.Text;
                        int    cakePrice = Int32.Parse(inputPrice.Text);
                        int    cakeStock = Int32.Parse(inputStock.Text);
                        cakePic = null;

                        Cake c   = CakeFactory.create(cakeName, cakePrice, cakeStock, cakePic);
                        int  row = DatabaseRepositories.addCake(c);

                        if (row > 0)
                        {
                            errorText.ForeColor = System.Drawing.Color.Blue;
                            errorText.Text      = "Add Cake Success, No Picture Added";
                        }
                        else
                        {
                            errorText.Text = "Add Cake Failed";
                        }
                    }
                }
            }
            else
            {
                errorText.Text = "Cake Name Already Exist";
            }
        }