Ejemplo n.º 1
0
        public bool PerformAddOperation(string commandName, InformationSourceCollection sources, string requesterLocation, HttpFileCollection files)
        {
            string[] cmdIDList = commandName.Split('_');
            if (cmdIDList.Length < 2)
            {
                return(false);
            }
            string cmd   = cmdIDList[0];
            string cmdID = cmdIDList[1];

            if (cmdID != this.ID)
            {
                return(false);
            }
            var          defaultSource  = sources.GetDefaultSource(typeof(ImageGroup).FullName);
            ImageGroup   currImageGroup = (ImageGroup)defaultSource.RetrieveInformationObject();
            VirtualOwner owner          = VirtualOwner.FigureOwner(this);
            Image        addedImage     = Image.CreateDefault();

            addedImage.CopyContentFrom(this);
            addedImage.ImageData = MediaContent.CreateDefault();
            HttpPostedFile postedFile = files[this.ImageData.ID];

            if (postedFile != null && String.IsNullOrWhiteSpace(postedFile.FileName) == false)
            {
                addedImage.SetMediaContent(owner, addedImage.ImageData.ID, postedFile);
            }
            currImageGroup.ImagesCollection.CollectionContent.Add(addedImage);
            currImageGroup.StoreInformationMasterFirst(owner, true);
            return(true);
        }
Ejemplo n.º 2
0
        public bool PerformAddOperation(string commandName, InformationSourceCollection sources, string requesterLocation, HttpFileCollection files)
        {
            if (ImageGroupTitle == "")
            {
                throw new InvalidDataException("Image group title is mandatory");
            }
            //IInformationObject container = sources.GetDefaultSource().RetrieveInformationObject();
            ImageGroup   imageGroup = ImageGroup.CreateDefault();
            VirtualOwner owner      = VirtualOwner.FigureOwner(this);

            imageGroup.SetLocationAsOwnerContent(owner, imageGroup.ID);
            imageGroup.Title = ImageGroupTitle;
            StorageSupport.StoreInformationMasterFirst(imageGroup, owner, true);
            DefaultViewSupport.CreateDefaultViewRelativeToRequester(requesterLocation, imageGroup, owner);
            return(true);
        }