Пример #1
0
        private void SaveStoryInfo()
        {
            bool isNew = false;
            BPStories bp = new BPStories();
            BEStories dsStories = new BEStories();
            BEStories.tbl_StoriesRow story = null;

            if (StoryID > 0)
            {
                dsStories = bp.SelectStoryByID(StoryID);
                story = dsStories.tbl_Stories.FindByStoryID(StoryID);
            }

            if (story == null)
            {
                story = dsStories.tbl_Stories.Newtbl_StoriesRow();
                isNew = true;
            }

            //page
            story.StoryTitle = txtPageTitle.Text.Trim();

            if (edtContentBody1.Text.Trim() == "" || edtContentBody1.Text.Trim() == "<p>&nbsp;</p>")
                story.SetStoryBody1Null();
            else
                story.StoryBody1 = edtContentBody1.Text.Trim();

            story.StoryActive = chkStoryActive.Checked;

            story.DateModified = DateTime.Now;
            story.ModifiedByAdminID = PageUserID;

            if (isNew)
            {
                story.StoryTypeID = SubTypeID;
                story.StoryOrder = bp.GetStoryMaxOrder(SubTypeID);
                story.DateCreated = DateTime.Now;
                dsStories.tbl_Stories.Addtbl_StoriesRow(story);
            }

            bp.Update(dsStories);
            StoryID = story.StoryID;

            if (isNew)
            {
                //Add to main Pages table
                BPPages bpPages = new BPPages();
                BEPages dsPages = new BEPages();
                BEPages.tbl_PagesRow pageRow = dsPages.tbl_Pages.Newtbl_PagesRow();

                pageRow.PageTypeID = PageTypeID;
                pageRow.PageTypeSpecificID = StoryID;
                pageRow.SubTypeID = SubTypeID;

                dsPages.tbl_Pages.Addtbl_PagesRow(pageRow);
                bpPages.Update(dsPages);

                PageID = pageRow.PageID;
            }

            AddUpdateImageCategory(story.StoryTitle);
        }
Пример #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BPStories bpStories = new BPStories();
            BEStories dsStories = bpStories.SelectStoryByID(StoryID);

            BPPages bpPages = new BPPages();
            BEPages dsPages = bpPages.SelectByPageTypeIDAndPageTypeSpecificID(PageTypeID, StoryID);

            if (dsStories.tbl_Stories.Count > 0)
            {
                DeleteRelatedPageLinks();
                dsStories.tbl_Stories[0].Delete();
                bpStories.Update(dsStories);

                if (dsPages.tbl_Pages.Count > 0)
                {
                    DeleteImageGallery(dsPages.tbl_Pages[0].PageID);
                    dsPages.tbl_Pages[0].Delete();
                    bpPages.Update(dsPages);
                }
            }

            BrowseRedirect();
        }
Пример #3
0
        private void BindStoryInfo()
        {
            if (StoryID > 0)
            {
                BPStories bp = new BPStories();
                BEStories ds = bp.SelectStoryByID(StoryID);
                BEStories.tbl_StoriesRow story = null;

                if (ds.tbl_Stories.Count > 0)
                {
                    story = ds.tbl_Stories[0];

                    GetPageID();
                    BindImageGalleryUserControl();

                    lblTitle.Text = "Edit " + story.StoryTitle;
                    txtPageTitle.Text = story.StoryTitle;

                    if (!story.IsStoryBody1Null())
                        edtContentBody1.Text = story.StoryBody1;
                    else
                        edtContentBody1.Text = "";

                    BindSelectedRelatedPages();

                    chkStoryActive.Checked = story.StoryActive;
                }
            }
            else
            {
                lblTitle.Text = "Add New " + SubTypeName + " Page";
                btnDelete.Visible = false;
                edtContentBody1.Text = "";
                plcNewGalleryMessage.Visible = true;
                plcInactiveGalleryMessage.Visible = false;
                ucImageGallery.Visible = false;
            }
        }