protected void btnSave_Click(object sender, System.EventArgs e)
        {
            lblMessage.Text = string.Empty;

            SlideShowImage slideImg = SlideShowImage.GetById(this.ContentId);

            // Update the content
            slideImg.SlideTextContentName = txtContentName.Text.Trim();
            slideImg.SlideTextContent     = txtContent.Value;
            slideImg.LinkUrl = txtLinkUrl.Text.Trim();

            slideImg.Save(Page.User.Identity.Name);

            // Reload content
            SetEditableContent();

            lblMessage.Text = "<br>Your changes have been saved.";
        }
Beispiel #2
0
        public void Insert(int ModuleId, string ImageFileName, int SortOrder, string LinkUrl, string SlideTextContent, string SlideTextContentName)
        {
            SlideShowImage item = new SlideShowImage();

            item.ModuleId = ModuleId;

            item.ImageFileName = ImageFileName;

            item.SortOrder = SortOrder;

            item.LinkUrl = LinkUrl;

            item.SlideTextContent = SlideTextContent;

            item.SlideTextContentName = SlideTextContentName;


            item.Save(UserName);
        }
Beispiel #3
0
        public void InsertAndReturnIdentity(int ModuleId, string ImageFileName, int SortOrder, string LinkUrl, string SlideTextContent, string SlideTextContentName, out object newId)
        {
            SlideShowImage item = new SlideShowImage();

            item.ModuleId = ModuleId;

            item.ImageFileName = ImageFileName;

            item.SortOrder = SortOrder;

            item.LinkUrl = LinkUrl;

            item.SlideTextContent = SlideTextContent;

            item.SlideTextContentName = SlideTextContentName;


            item.Save(UserName);

            newId = item.Id;
        }
Beispiel #4
0
        public void Update(int Id, int ModuleId, string ImageFileName, int SortOrder, string LinkUrl, string SlideTextContent, string SlideTextContentName)
        {
            SlideShowImage item = new SlideShowImage();

            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.ModuleId = ModuleId;

            item.ImageFileName = ImageFileName;

            item.SortOrder = SortOrder;

            item.LinkUrl = LinkUrl;

            item.SlideTextContent = SlideTextContent;

            item.SlideTextContentName = SlideTextContentName;

            item.Save(UserName);
        }
Beispiel #5
0
        protected void Image_SaveButton_Click(object sender, EventArgs e)
        {
            HttpPostedFile postedFile    = Image_FileUploadCtl.PostedFile;
            string         filename      = String.Empty;
            string         fileExtension = String.Empty;

            if (!this.IsJQuerySlidingTextContentSlideShow)
            {
                if (null == postedFile)
                {
                    throw new InvalidOperationException("Image_FileUploadCtl.PostedFile is null.");
                }

                filename = Path.GetFileName(Image_FileUploadCtl.PostedFile.FileName);
                Regex reg = new Regex(@"[^A-Za-z0-9.()_]");
                filename      = reg.Replace(filename, String.Empty);
                fileExtension = Path.GetExtension(filename);


                if (!IsFileExtensionValid(fileExtension))
                {
                    Msg.ShowError(string.Format("Invalid file format. Image format must be {0} format.",
                                                (this.IsFlashSlideShow ? AllowedImageTypes_Flash_Text : AllowedImageTypes_Normal_Text)));
                    return;
                }
            }

            //SlideShow_Image image = new SlideShow_Image();
            SlideShowImage image = new SlideShowImage();

            image.ModuleId      = this.ModuleId;
            image.ImageFileName = filename;

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                image.SlideTextContentName = Content_Name.Text.Trim();
                image.SlideTextContent     = SlideContent.Text;
            }
            else
            {
                if (IsGalleryViewSlideShow)
                {
                    image.SlideTextContentName = Content_Name.Text.Trim();
                    image.SlideTextContent     = SlideContent.Text;
                }

                string savePath = Server.MapPath(image.GetFullPath());
                string saveDir  = Path.GetDirectoryName(savePath);

                if (!Directory.Exists(saveDir))
                {
                    Directory.CreateDirectory(saveDir);
                }

                if (File.Exists(savePath))
                {
                    image.ImageFileName = RenameFile(filename, fileExtension, savePath);
                }

                Image_FileUploadCtl.SaveAs(Server.MapPath(image.GetFullPath()));
            }

            image.Save();

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                SlideShowImagesCtl.IsJQuerySlidingTextContentSlideShow = true;
            }

            SlideShowImagesCtl.Load_(this.ModuleId);

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                Msg.ShowSuccess("Added new content to slide show.");

                SlideContent.Text = String.Empty;
                Content_Name.Text = String.Empty;
            }
            else
            {
                Msg.ShowSuccess("Added new image to slide show.");
            }

            Content_Name.Text = "";
            SlideContent.Text = "";
        }