protected void UploadUpdate_Click(object sender, System.EventArgs e)
        {
            if (File.PostedFile != null && File.PostedFile.FileName.Trim().Length > 0 && File.PostedFile.ContentLength > 0)
            {
                int    width              = SueetieConfiguration.Get().AvatarSettings.Width;
                int    height             = SueetieConfiguration.Get().AvatarSettings.Height;
                int    thumbnailWidth     = SueetieConfiguration.Get().AvatarSettings.ThumbnailHeight;
                int    thumbnailHeight    = SueetieConfiguration.Get().AvatarSettings.ThumbnailWidth;
                string imageName          = CurrentUserID.ToString() + ".jpg";
                string thumbnailImageName = CurrentUserID.ToString() + "t.jpg";

                ImageFormat imgFormat = ImageFormat.Jpeg;

                try
                {
                    #region Save to disk

                    Bitmap originalBitmap = new Bitmap(File.PostedFile.InputStream);
                    //ImageHelper.CalculateOptimizedWidthAndHeight(originalBitmap, out width, out height);

                    int    jpegQuality = SueetieConfiguration.Get().AvatarSettings.ImageQuality;
                    string path        = HttpContext.Current.Server.MapPath("/") + SueetieConfiguration.Get().AvatarSettings.AvatarFolderPath;

                    ImageHelper.SaveImageFile(originalBitmap, path + imageName, imgFormat, width, height, jpegQuality);
                    ImageHelper.SaveImageFile(originalBitmap, path + thumbnailImageName, imgFormat, thumbnailWidth, thumbnailHeight, jpegQuality);

                    #endregion

                    #region Save to database for use with Forums

                    SueetieUserAvatar sueetieUserAvatar = new SueetieUserAvatar();

                    MemoryStream stream = new MemoryStream();
                    originalBitmap.Save(stream, ImageFormat.Bmp);

                    byte[] data = new byte[stream.Length];
                    stream.Seek(0, System.IO.SeekOrigin.Begin);
                    stream.Read(data, 0, (int)stream.Length);

                    sueetieUserAvatar.UserID          = CurrentUserID;
                    sueetieUserAvatar.AvatarImage     = data;
                    sueetieUserAvatar.AvatarImageType = "image/jpeg";

                    SueetieUsers.UpdateSueetieUserAvatar(sueetieUserAvatar);
                    SueetieUsers.ClearUserCache(sueetieUserAvatar.UserID);

                    //Response.Redirect("myaccountinfo.aspx?av=1&bio=2&pr=2&pw=2");
                    Response.Redirect("myaccountinfo.aspx?av=1");
                    #endregion
                }
                catch
                {
                    //return null;
                }
            }

            BindData();
        }
        protected void DeleteAvatar_Click(object sender, System.EventArgs e)
        {
            SueetieUsers.DeleteAvatar(CurrentUserID);
            string path = HttpContext.Current.Server.MapPath("/") + SueetieConfiguration.Get().AvatarSettings.AvatarFolderPath +
                          CurrentUserID.ToString() + ".jpg";

            System.IO.File.Delete(path);
            SueetieUsers.ClearUserCache(CurrentUserID);
            Response.Redirect("myaccountinfo.aspx?dv=1&bio=2");
            //BindData();
        }
        protected void btnUpdateBio_OnClick(object sender, EventArgs args)
        {
            SueetieUser sueetieUser = new SueetieUser
            {
                UserID = CurrentSueetieUser.UserID,
                Bio    = txtBio.Text
            };


            SueetieUsers.ClearUserCache(CurrentSueetieUser.UserID);
            SueetieUsers.UpdateSueetieUserBio(sueetieUser);
            Response.Redirect("myaccountinfo.aspx?bio=1");
        }