Пример #1
0
        protected void NewAlbumButton_Click(object sender, EventArgs e)
        {
            if (!Roles.IsUserInRole("family"))
            {
                ErrorMessage.Text = "<p class=\"errormsg\">Error: You do not have enough permissions to create an album.</p>";
                ErrorMessage.Visible = true;
                return;
            }

            // Add album to database
            using (var db = new NietoYostenDbDataContext())
            {
                var newAlbum = new Album()
                    {
                        Title = AlbumTitle.Text,
                        FolderName = AlbumFolder.Text
                    };
                db.Albums.InsertOnSubmit(newAlbum);
                db.SubmitChanges();
            }
            // Create folders for album
            //string originalDir = Server.MapPath(string.Format("~/pictures/original/{0}", AlbumFolder.Text));
            Directory.CreateDirectory(Server.MapPath(string.Format("~/pictures/original/{0}", AlbumFolder.Text)));
            Directory.CreateDirectory(Server.MapPath(string.Format("~/pictures/web/{0}", AlbumFolder.Text)));
            Directory.CreateDirectory(Server.MapPath(string.Format("~/pictures/thumb/{0}", AlbumFolder.Text)));

            Response.Redirect("~/Pictures.aspx");
        }
Пример #2
0
 partial void UpdateAlbum(Album instance);
Пример #3
0
 partial void DeleteAlbum(Album instance);
Пример #4
0
 partial void InsertAlbum(Album instance);