Esempio n. 1
0
 protected void AddSaveDeleteButtons()
 {
     if (loggedUsername != null)
     {
         int loggedUserId = App_Code.SqlUtilities.GetUserId(loggedUsername);
         App_Code.User loggedUsr = new App_Code.User(loggedUserId);
         App_Code.Image img = new App_Code.Image(imageId);
         if ((img.UploaderId == loggedUserId || loggedUsr.IsAdmin) && DeleteSaveButtonsHolder.Controls.Count < 1)
         {
             Button deleteImage = new Button();
             deleteImage.ID = "DeteleImageButton";
             deleteImage.Text = "Delete Image";
             deleteImage.Click += DeleteImage;
             DeleteSaveButtonsHolder.Controls.Add(deleteImage);
         }
         if (ViewState["editedImagePath"] != null && DeleteSaveButtonsHolder.Controls.Count < 2)
         {
             Button saveImage = new Button();
             saveImage.ID = "SaveImageButton";
             saveImage.Click += SaveImage;
             saveImage.Text = "Save image";
             DeleteSaveButtonsHolder.Controls.Add(saveImage);
         }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["LastAppendedImg"] = 0;

                if (Request["user"] == null || Request["album"] == null)
                {
                    Response.Redirect("Login.aspx");
                    return;
                }
                else
                {
                    profileUser = App_Code.SqlUtilities.GetUser(int.Parse(Request["user"]));
                    albumId     = int.Parse(Request["album"]);
                    if (Session["username"] != null)
                    {
                        string loggedUser = (string)Session["username"];
                        if (loggedUser == profileUser.Username)
                        {
                            UserGreeting.Text = "My albums";
                        }
                        else
                        {
                            UserGreeting.Text = "Hello, " + loggedUser + ". Welcome to " + profileUser + "'s album";
                        }
                    }
                }
                AddAlbumsToLeftPlaceholder();
                AppendThumbnailsToMainPlaceholder(null, null);
            }
            else
            {
                albumId     = int.Parse(Request["album"]);
                profileUser = App_Code.SqlUtilities.GetUser(int.Parse(Request["user"]));
            }
        }