Example #1
0
        protected void ButtonUPlate_Click1(object sender, EventArgs e)
        {
            byte[] photo;


            HttpPostedFile photoArchive = InsertPhotoU.PostedFile;
            int            photoLength  = photoArchive.ContentLength;

            photo = new byte[photoLength];
            photoArchive.InputStream.Read(photo, 0, photoLength);

            string base64String = Convert.ToBase64String(photo, 0, photoLength);

            Image1.ImageUrl = String.Format(@"data:image/jpeg;base64,{0}", base64String);
            try
            {
                if (CheckBoxEnabledU.Checked)
                {
                    bll.ModifiyPlate(TextBoxID.Text, TextBoxNameU.Text, TextBoxFullDescriptionU.Text, TextBoxPriceU.Text, ref photo, "s", TextBoxTimeToPrepareU.Text);
                    Response.Redirect("CRUDPlates.aspx");
                }
                else
                {
                    bll.ModifiyPlate(TextBoxID.Text, TextBoxNameU.Text, TextBoxFullDescriptionU.Text, TextBoxPriceU.Text, ref photo, "n", TextBoxTimeToPrepareU.Text);
                    Response.Redirect("CRUDPlates.aspx");
                }
            }
            catch (Exception ex)
            {
                alertException(ex.Message, ex);
            }
        }