private void BindPoster()
        {
            var posterId = string.IsNullOrEmpty(Request.QueryString["id"]) ? EmptyGuid : new Guid(Request.QueryString["id"]);

            if (posterId == EmptyGuid)
            {
                ShowError("There was an error with your request please go back and try again.");
                phMain.Visible = false;
                return;
            }

            hdnId.Value = posterId.ToString();

            var poster = posterService.GetPoster(posterId);

            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var photo = photoService.GetPhoto(poster.PhotoId);

            imgDisplayFull.ImageUrl = LinkBuilder.GetImageLinkByFileName(photo.FileName);

            ddlShow.SelectedValue = photo.ShowId.ToString();

            txtCreator.Text = poster.Creator;
            txtLength.Text = poster.Length.ToString();
            txtNotes.Text = poster.Notes;
            txtNumber.Text = poster.Number.ToString();
            txtReleaseDate.Text = poster.ReleaseDate != null ? poster.ReleaseDate.Value.ToString("MM/dd/yyyy") : string.Empty;
            txtTechnique.Text = poster.Technique;
            txtTitle.Text = poster.Title;
            txtTotal.Text = poster.Total.ToString();
            txtWidth.Text = poster.Width.ToString();
            ddlStatus.SelectedValue = poster.Status.ToString();
        }
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            if (EmptyNullUndefined(ddlShows.SelectedValue) || fuPicture.PostedFile == null)
            {
                //Show Some error here eventually, 
                //  but for now, no NOOOOOO No error for you!
                return;
            }

            var ticketStubService = new TicketStubService(Ioc.GetInstance<ITicketStubRepository>());
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var showId = new Guid(ddlShows.SelectedValue);

            Brih(showId);
        }
        public AjaxControlToolkit.Slide[] GetSlides(String contextKey)
        {
            if (String.IsNullOrEmpty(contextKey))
                return null;

            Guid userId = new Guid(contextKey.Split(';')[0]);
            Guid showId = new Guid(contextKey.Split(';')[1]);

            try
            {
                IPhotoRepository photoRepo = new PhotoRepository(new PhishDatabase(new ConnectionString(new AppConfigManager(), connKey)));

                PhotoService photoService = new PhotoService(photoRepo);

                var photos = photoService.GetPhotosByUserAndShow(userId, showId).Where(x => x.Thumbnail == false).ToList();

                if (photos == null || photos.Count <= 0)
                    return GetNoImagesFoundDirectory("There are no images for this show", string.Empty);

                // create generic empty list of slides
                List<AjaxControlToolkit.Slide> list = new List<AjaxControlToolkit.Slide>();
                String justFileName;
                String displayedFileTitleOnSlider;
                String displayedFileDescriptionOnSlider;

                foreach (var photo in photos)
                {
                    // get complete filename
                    justFileName = photo.FileName;

                    // get title
                    displayedFileTitleOnSlider = photo.NickName;

                    // set description
                    displayedFileDescriptionOnSlider = photo.Notes;

                    // add file to list of slides
                    list.Add(new AjaxControlToolkit.Slide(showImagesFolder + justFileName, displayedFileTitleOnSlider, displayedFileDescriptionOnSlider));
                }

                return (list.ToArray());
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        private void Bind()
        {
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());
            var showService = new ShowService(Ioc.GetInstance<IShowRepository>());

            var photos = photoService.GetRecentlyAddedPhotos().ToList();
            var showIds = (from p in photos select p.ShowId.Value).ToList();
            var shows = showService.GetShows(showIds);

            var showPhotos = new List<ShowPhoto>();

            showPhotos = (from p in photos
                          from s in shows
                          where p.ShowId == s.ShowId
                          select new ShowPhoto { NickName = p.NickName, ShowDate = s.ShowDate.Value.ToShortDateString(), ShowId = s.ShowId.ToString() }).ToList();

            rptRecentlyAddedPictures.DataSource = showPhotos;
            rptRecentlyAddedPictures.DataBind();
        }
        public MyShowThumbnail<IMyShowArt> GetAnyMyShowArtForUser(Guid userId)
        {
            var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>());
            var artService = new ArtService(Ioc.GetInstance<IArtRepository>());
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var myShows = myShowService.GetMyShowsForUser(userId);

            var myShowArts = GetAllMyShowArt().Where(x => myShows.Any(y => y.MyShowId == x.MyShowId)).OrderByDescending(z => z.CreatedDate);

            foreach (var myShowArt in myShowArts)
            {
                var art = artService.GetArt(myShowArt.ArtId);
                var photo = photoService.GetPhotoThumbnail(art.PhotoId);
                if (photo.Thumbnail)
                    return new MyShowThumbnail<IMyShowArt>(myShowArt, photo);
            }
            
            return null;
        }
        public MyShowThumbnail<IMyShowTicketStub> GetAnyMyShowTicketStubForUser(Guid userId)
        {
            var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>());
            var ticketStubService = new TicketStubService(Ioc.GetInstance<ITicketStubRepository>());
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var myShows = myShowService.GetMyShowsForUser(userId);

            var myShowTicketStubs = GetAllMyShowTicketStubs().Where(x => myShows.Any(y => y.MyShowId == x.MyShowId)).OrderByDescending(z => z.CreatedDate);

            foreach (var myShowTicketStub in myShowTicketStubs)
            {
                var ticketStub = ticketStubService.GetTicketStub(myShowTicketStub.TicketStubId);
                var photo = photoService.GetPhotoThumbnail(ticketStub.PhotoId);
                if (photo.Thumbnail)
                    return new MyShowThumbnail<IMyShowTicketStub>(myShowTicketStub, photo);
            }

            return null;
        }
        public MyShowThumbnail<IMyShowPoster> GetAnyMyShowPosterForUser(Guid userId)
        {
            var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>());
            var posterService = new PosterService(Ioc.GetInstance<IPosterRepository>());
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var myShows = myShowService.GetMyShowsForUser(userId);

            var myShowPosters = GetAllMyShowPosters().Where(x => myShows.Any(y => y.MyShowId == x.MyShowId)).OrderByDescending(z => z.CreatedDate);

            foreach (var myShowPoster in myShowPosters)
            {
                var poster = posterService.GetPoster(myShowPoster.PosterId);
                var photo = photoService.GetPhotoThumbnail(poster.PhotoId);
                if (photo.Thumbnail)
                    return new MyShowThumbnail<IMyShowPoster>(myShowPoster, photo);
            }

            return null;
        }
Example #8
0
        public MyShowThumbnail <IMyShowTicketStub> GetAnyMyShowTicketStubForUser(Guid userId)
        {
            var myShowService     = new MyShowService(Ioc.GetInstance <IMyShowRepository>());
            var ticketStubService = new TicketStubService(Ioc.GetInstance <ITicketStubRepository>());
            var photoService      = new PhotoService(Ioc.GetInstance <IPhotoRepository>());

            var myShows = myShowService.GetMyShowsForUser(userId);

            var myShowTicketStubs = GetAllMyShowTicketStubs().Where(x => myShows.Any(y => y.MyShowId == x.MyShowId)).OrderByDescending(z => z.CreatedDate);

            foreach (var myShowTicketStub in myShowTicketStubs)
            {
                var ticketStub = ticketStubService.GetTicketStub(myShowTicketStub.TicketStubId);
                var photo      = photoService.GetPhotoThumbnail(ticketStub.PhotoId);
                if (photo.Thumbnail)
                {
                    return(new MyShowThumbnail <IMyShowTicketStub>(myShowTicketStub, photo));
                }
            }

            return(null);
        }
        public MyShowThumbnail <IMyShowArt> GetAnyMyShowArtForUser(Guid userId)
        {
            var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>());
            var artService    = new ArtService(Ioc.GetInstance <IArtRepository>());
            var photoService  = new PhotoService(Ioc.GetInstance <IPhotoRepository>());

            var myShows = myShowService.GetMyShowsForUser(userId);

            var myShowArts = GetAllMyShowArt().Where(x => myShows.Any(y => y.MyShowId == x.MyShowId)).OrderByDescending(z => z.CreatedDate);

            foreach (var myShowArt in myShowArts)
            {
                var art   = artService.GetArt(myShowArt.ArtId);
                var photo = photoService.GetPhotoThumbnail(art.PhotoId);
                if (photo.Thumbnail)
                {
                    return(new MyShowThumbnail <IMyShowArt>(myShowArt, photo));
                }
            }

            return(null);
        }
Example #10
0
        public MyShowThumbnail <IMyShowPoster> GetAnyMyShowPosterForUser(Guid userId)
        {
            var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>());
            var posterService = new PosterService(Ioc.GetInstance <IPosterRepository>());
            var photoService  = new PhotoService(Ioc.GetInstance <IPhotoRepository>());

            var myShows = myShowService.GetMyShowsForUser(userId);

            var myShowPosters = GetAllMyShowPosters().Where(x => myShows.Any(y => y.MyShowId == x.MyShowId)).OrderByDescending(z => z.CreatedDate);

            foreach (var myShowPoster in myShowPosters)
            {
                var poster = posterService.GetPoster(myShowPoster.PosterId);
                var photo  = photoService.GetPhotoThumbnail(poster.PhotoId);
                if (photo.Thumbnail)
                {
                    return(new MyShowThumbnail <IMyShowPoster>(myShowPoster, photo));
                }
            }

            return(null);
        }
Example #11
0
        private void BindArt()
        {
            var artId = string.IsNullOrEmpty(Request.QueryString["id"]) ? EmptyGuid : new Guid(Request.QueryString["id"]);

            if (artId == EmptyGuid)
            {
                ShowError("There was an error with your request please go back and try again.");
                phMain.Visible = false;
                return;
            }

            hdnId.Value = artId.ToString();

            var art = artService.GetArt(artId);

            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var photo = photoService.GetPhoto(art.PhotoId);

            txtNotes.Text = art.Notes;
            ddlShow.SelectedValue = photo.ShowId.ToString();
            imgDisplayFull.ImageUrl = LinkBuilder.GetImageLinkByFileName(photo.FileName);
            txtCreator.Text = art.Creator;
        }
        private void BindTicketStub()
        {
            var ticketStubId = string.IsNullOrEmpty(Request.QueryString["id"]) ? EmptyGuid : new Guid(Request.QueryString["id"]);

            if (ticketStubId == EmptyGuid)
            {
                ShowError("There was an error with your request please go back and try again.");
                phMain.Visible = false;
                return;
            }

            hdnId.Value = ticketStubId.ToString();

            var ticketStub = ticketStubService.GetTicketStub(ticketStubId);

            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());

            var photo = photoService.GetPhoto(ticketStub.PhotoId);

            txtNotes.Text = ticketStub.Notes;
            ddlShow.SelectedValue = photo.ShowId.ToString();
            imgDisplayFull.ImageUrl = LinkBuilder.GetImageLinkByFileName(photo.FileName);
            chkPTBM.Checked = ticketStub.Original;
        }
        public void Brih(Guid showId)
        {
            IImageMediaFormats imageMediaFormats = Ioc.GetInstance<IImageMediaFormats>();
            IPhotoRepository photoRepo = Ioc.GetInstance<IPhotoRepository>();

            ImageResizerService imageResizerService = new ImageResizerService();
            PhotoService photoService = new PhotoService(photoRepo);

            bool compiledSuccess = true;

            var posted = fuPicture.PostedFile;

            if (posted == null)
            {
                return;
                //ERROR MESSAGE
                //return new FileUploadJsonResult { Data = new { Src = "", ErrorMessage = "File was not uploaded." } };
            }

            var fileExt = Path.GetExtension(posted.FileName.ToLower());

            if (string.IsNullOrEmpty(fileExt))
            {
                //ERROR MESSAGE
                //return new FileUploadJsonResult { Data = new { Src = "", ErrorMessage = "File was not uploaded." } };
            }
            else
            { //check type
                if (imageMediaFormats.HasExtension(fileExt))
                {
                    var mediaFormat = imageMediaFormats.GetSpecByExtension(fileExt);

                    Guid userID = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString());
                    string userName = Membership.GetUser(User.Identity.Name).UserName;
                    var ticks = DateTime.Now.Ticks;
                    Guid thumbImageId = Guid.NewGuid();
                    Guid fullImageId = Guid.NewGuid();

                    //save file 
                    var newFileName = posted.FileName;

                    if (posted.ContentLength > 0)
                    {

                        //try to resize the image
                        var tmpResizeBuffer = new byte[posted.ContentLength];
                        posted.InputStream.Read(tmpResizeBuffer, 0, posted.ContentLength);
                        var thumbResizedBuffer = imageResizerService.ResizeImage(tmpResizeBuffer, new ThumbnailSize(), mediaFormat);
                        var fullResizedBuffer = imageResizerService.ResizeImage(tmpResizeBuffer, new FullImageSize(), mediaFormat);

                        IPhoto thumbImage = null;
                        IPhoto fullImage = null;
                        //TODO: save fullImage

                        using (var unitOfWork = TheCore.Infrastructure.UnitOfWork.Begin())
                        {
                            /*
                             * thumbnail
                             */
                            if (thumbImage == null)
                            {
                                thumbImage = new Photo
                                {
                                    PhotoId = thumbImageId,
                                    CreatedDate = DateTime.Now,
                                    UserId = userID,
                                    FileName = "thumb" + newFileName,
                                    ContentType = mediaFormat.ContentType,
                                    ContentLength = thumbResizedBuffer.Length,
                                    //Image = new byte[thumbResizedBuffer.Length],
                                    Type = (short)PhotoType.TicketStub,
                                    Thumbnail = true,
                                    ShowId = showId
                                };
                            }
                            else
                            { //update entity
                                thumbImage.ContentType = mediaFormat.ContentType;
                                thumbImage.ContentLength = thumbResizedBuffer.Length;
                            }

                            bool success = false;
                            photoService.Save(thumbImage, mediaFormat, out success);

                            compiledSuccess = compiledSuccess && success;

                            /*
                             * fullsize
                             */
                            if (fullImage == null)
                            {
                                //newFileName = userName + "-" + DateTime.Now.Ticks + fileExt;

                                fullImage = new Photo
                                {
                                    PhotoId = fullImageId,
                                    CreatedDate = DateTime.Now,
                                    UserId = userID,
                                    FileName = newFileName,
                                    ContentType = mediaFormat.ContentType,
                                    ContentLength = fullResizedBuffer.Length,
                                    //Image = new byte[fullResizedBuffer.Length],
                                    Type = (short)PhotoType.TicketStub,
                                    Thumbnail = false,
                                    ShowId = showId
                                };
                            }
                            else
                            { //update entity
                                fullImage.ContentType = mediaFormat.ContentType;
                                fullImage.ContentLength = fullResizedBuffer.Length;
                            }

                            photoService.Save(fullImage, mediaFormat, out success);

                            compiledSuccess = compiledSuccess && success;

                            if (!compiledSuccess)
                            {
                                //log.Error("The following validation conditions cased the offering image upload to fail during a call to CreateOfferingImageUpload: {0}".FormatWith(validationState.GetMessages()));
                                //ERROR MESSAGE NEEDED
                                //return new FileUploadJsonResult { Data = new { Src = "", ErrorMessage = "An error occurred while trying to save you upload. Please try again." } };
                            }
                            else
                            {
                                unitOfWork.Commit();

                                var thumbImageTemp = photoService.GetPhoto(thumbImageId);
                                thumbImageTemp.Image = thumbResizedBuffer;

                                string path = string.Format("{0}{1}", DefaultTicketStubImageLocation, thumbImageTemp.FileName);

                                bool valid = photoService.SaveAs(thumbImageTemp, HttpContext.Current.Server.MapPath(path));

                                if (valid)
                                {
                                    var fullImageTemp = photoService.GetPhoto(fullImageId);
                                    fullImageTemp.Image = fullResizedBuffer;

                                    path = string.Format("{0}{1}", DefaultTicketStubImageLocation, fullImageTemp.FileName);

                                    valid = photoService.SaveAs(fullImageTemp, HttpContext.Current.Server.MapPath(path));

                                    if (valid)
                                    {
                                        imgTheImage.ImageUrl = LinkBuilder.GetTicketStubLink(fullImage.FileName);

                                        thumbImageTemp.Image = null;
                                        fullImageTemp.Image = null;

                                        CreateTicketStubNow(fullImage, showId);
                                    }
                                    else
                                    {
                                        //FREAK OUT!!
                                    }
                                }
                            }
                        }
                    }

                    //ERROR MESSAGE NEEDED
                    //return new FileUploadJsonResult { Data = new { Src = Url.TempImages(tempId), ErrorMessage = "" } };

                }
                else
                {
                    //ERROR MESSAGE NEEDED
                    //return new FileUploadJsonResult { Data = new { Src = "", ErrorMessage = "The image you are trying to upload is listed as an invalid image type.  Please use the approved types:{0}".FormatWith(_imageMediaFormats.ImageFormatSpecs.ToDebugString(",")) } };
                }

            }

            //ERROR MESSAGE NEEDED
            //return new FileUploadJsonResult { Data = new { Src = "", ErrorMessage = "No file uploaded." } };
        }
        private void DeletePoster(string posterIdStr)
        {
            var posterId = new Guid(posterIdStr);

            var myShowPoster = GetPoster(posterId);
            var myShowPosterId = myShowPoster.MyShowPosterId.ToString();
            var photoId = myShowPoster.Poster.Photo.PhotoId.ToString();
            var filename = myShowPoster.Poster.Photo.FileName.ToString();

            var posterService = new PosterService(Ioc.GetInstance<IPosterRepository>());
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());
            var myShowPosterService = new MyShowPosterService(Ioc.GetInstance<IMyShowPosterRepository>());

            using (IUnitOfWork uow = UnitOfWork.Begin())
            {
                var photo = myShowPoster.Poster.Photo;
                var poster = myShowPoster.Poster;

                photoService.Delete(photo);
                posterService.Delete(poster);
                myShowPosterService.Delete(myShowPoster);

                uow.Commit();
            }

            log.WriteLine("Deleted myShowPoster Id: " + myShowPosterId);
            log.WriteLine("Deleted photo Id: " + photoId + "and filename: " + filename);
            log.WriteLine("Deleted picture Id: " + posterId);

            Response.Redirect(LinkBuilder.MyPostersLink(new Guid(hdnShowId.Value)));

        }
        private void DeletePic(string pictureIdStr)
        {
            var pictureId = new Guid(pictureIdStr);

            var myShowArt = GetPicture(pictureId);
            var myShowArtId = myShowArt.MyShowArtId.ToString();
            var photoId = myShowArt.Art.Photo.PhotoId.ToString();
            var filename = myShowArt.Art.Photo.FileName.ToString();

            var artService = new ArtService(Ioc.GetInstance<IArtRepository>());
            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());
            var myShowArtService = new MyShowArtService(Ioc.GetInstance<IMyShowArtRepository>());

            using (IUnitOfWork uow = UnitOfWork.Begin())
            {
                photoService.Delete(myShowArt.Art.Photo);
                artService.Delete(myShowArt.Art);
                myShowArtService.Delete(myShowArt);

                uow.Commit();
            }

            log.WriteLine("Deleted myShowArt Id: " + myShowArtId);
            log.WriteLine("Deleted photo Id: " + photoId + "and filename: " + filename);
            log.WriteLine("Deleted picture Id: " + pictureId);

            Response.Redirect(LinkBuilder.MyPicturesLink(new Guid(hdnShowId.Value)));
        }
        public AjaxControlToolkit.Slide[] GetShowPictures(String contextKey)
        {
            if (String.IsNullOrEmpty(contextKey))
                return null;

            var showId = new Guid(contextKey);

            try
            {

                IPhotoRepository photoRepo = new PhotoRepository(new PhishDatabase(new ConnectionString(new AppConfigManager(), connKey)));

                PhotoService photoService = new PhotoService(photoRepo);

                var photos = photoService.GetPhotosByShow(showId).Where(x => x.Thumbnail == false).ToList();

                if (photos == null || photos.Count <= 0)
                {
                    var linkBuilder = new LinkBuilder();
                    var myPictureLink = linkBuilder.MyPicturesLink(showId);

                    var link = string.Format("<a href=\"{0}\">Upload your pictures here!</a>", myPictureLink);
                    
                    var name = string.Format("There are no pictures uploaded for this show. {0} You could be the first!", link);

                    return GetNoImagesFoundDirectory(name, string.Empty);
                }

                // create generic empty list of slides
                List<AjaxControlToolkit.Slide> list = new List<AjaxControlToolkit.Slide>();
                String justFileName;
                String displayedFileTitleOnSlider;
                String displayedFileDescriptionOnSlider;

                foreach (var photo in photos)
                {
                    // get complete filename
                    justFileName = photo.FileName;

                    // get title
                    displayedFileTitleOnSlider = photo.NickName;

                    // set description
                    displayedFileDescriptionOnSlider = photo.Notes;

                    // add file to list of slides
                    list.Add(new AjaxControlToolkit.Slide(showImagesFolder + justFileName, displayedFileTitleOnSlider, displayedFileDescriptionOnSlider));
                }

                return (list.ToArray());
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public override void ProcessRequest(HttpContextBase context)
        {
            HttpRequestBase request = context.Request;
            var showIdStr = request.QueryString["s"];
            var showDateStr = request.QueryString["d"];
            HttpResponseBase response = context.Response;

            var final = string.Empty;

            if (EmptyNullUndefined(showIdStr) && EmptyNullUndefined(showDateStr))
            {
                final = GetNoImagesFound();

                response.ContentType = "application/json";
                response.ContentEncoding = Encoding.UTF8;
                response.Write(final);
                response.End();
            }

            var showService = new ShowService(Ioc.GetInstance<IShowRepository>());
            if (string.IsNullOrEmpty(showIdStr))
            {
                DateTime date;
                var success = DateTime.TryParse(showDateStr, out date);

                if (!success)
                    return;

                var s = showService.GetShow(date);

                if (s == null)
                    return;

                showIdStr = s.ShowId.ToString();
            }

            var showId = new Guid(showIdStr);

            IPhotoRepository photoRepo = new PhotoRepository(new PhishDatabase(new ConnectionString(new AppConfigManager(), connKey)));

            PhotoService photoService = new PhotoService(photoRepo);

            var photos = photoService.GetPhotosByShow(showId).Where(x => x.Thumbnail == false).ToList();

            if (photos == null || photos.Count <= 0)
            {
                final = GetNoImagesFound();
            }

            if (string.IsNullOrEmpty(final))
            {
                var json = new ImageJSONifier("records");

                foreach (var photo in photos)
                {
                    var path = (PhotoType)photo.Type != PhotoType.TicketStub ? ShowImagesFolder : TicketStubImagesFolder;

                    json.Add(new ImageItem
                    {
                        Image = path + photo.FileName,
                        Description = photo.Notes,
                        Title = photo.NickName,
                        //Thumb =  //This is a consideration.  If we want to go through the trouble of using the thumb or not
                    });
                }

                final = json.GetFinalizedJSON();
            }

            response.ContentType = "application/json";
            response.ContentEncoding = Encoding.UTF8;
            response.Write(final);
        }
Example #18
0
        public bool CreateArt(IPhoto photo, Guid? showId)
        {
            bool final = false;
            var artId = Guid.NewGuid();

            var artService = new ArtService(Ioc.GetInstance<IArtRepository>());
            var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>());
            var spService = new MyShowArtService(Ioc.GetInstance<IMyShowArtRepository>());

            var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString());
            var myShowId = myShowService.GetMyShow(showId.Value, userId).MyShowId;

            var date = DateTime.UtcNow;

            Art p = new Art
            {
                CreatedDate = date,
                UpdatedDate = date,
                PhotoId = photo.PhotoId,
                ArtId = artId,
                Notes = photo.Notes,
                UserId = photo.UserId,
                ShowId = showId
            };


            var combinedSuccess = true;
            bool success = false;

            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());
            photoService.Save(photo, out success);

            combinedSuccess = combinedSuccess && success;

            artService.Save(p, out success);

            combinedSuccess = combinedSuccess && success;

            var myShowArt = new MyShowArt
            {
                CreatedDate = date,
                UpdatedDate = date,
                MyShowId = myShowId,
                MyShowArtId = Guid.NewGuid(),
                ArtId = artId
            };

            spService.Save(myShowArt, out success);

            combinedSuccess = combinedSuccess && success;

            return combinedSuccess;
        }
Example #19
0
        public bool CreatePoster(IPhoto photo, Guid? showId)
        {
            bool final = false;
            var posterId = Guid.NewGuid();

            var posterService = new PosterService(Ioc.GetInstance<IPosterRepository>());
            var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>());
            var spService = new MyShowPosterService(Ioc.GetInstance<IMyShowPosterRepository>());

            var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString());
            var myShowId = myShowService.GetMyShow(showId.Value, userId).MyShowId;

            var date = DateTime.UtcNow;

            Poster p = new Poster
            {
                CreatedDate = DateTime.Now,
                PhotoId = photo.PhotoId,
                PosterId = posterId,
                Notes = photo.Notes,
                UserId = photo.UserId,
                Creator = txtCreator.Text,
                Length = string.IsNullOrEmpty(txtLength.Text) ? 0 : double.Parse(txtLength.Text),
                Width = string.IsNullOrEmpty(txtWidth.Text) ? 0 : double.Parse(txtWidth.Text),
                Total = string.IsNullOrEmpty(txtTotal.Text) ? 0 : int.Parse(txtTotal.Text),
                Number = string.IsNullOrEmpty(txtNumber.Text) ? 0 : int.Parse(txtNumber.Text),
                Technique = txtTechnique.Text,
                Title = txtTitle.Text,
                ShowId = showId
            };

            var combinedSuccess = true;
            bool success = false;

            var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>());
            photoService.Save(photo, out success);

            combinedSuccess = combinedSuccess && success;

            posterService.Save(p, out success);

            combinedSuccess = combinedSuccess && success;

            var myShowPoster = new MyShowPoster
            {
                CreatedDate = date,
                UpdatedDate = date,
                MyShowId = myShowId,
                MyShowPosterId = Guid.NewGuid(),
                PosterId = posterId
            };

            spService.Save(myShowPoster, out success);

            combinedSuccess = combinedSuccess && success;

            return combinedSuccess;
        }