Example #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BPArticles bpArticles = new BPArticles();
            BEArticles dsArticles = bpArticles.SelectArticleByID(ArticleID);

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

            if (dsArticles.tbl_Articles.Count > 0)
            {
                dsArticles.tbl_Articles[0].Delete();
                bpArticles.Update(dsArticles);

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

            BrowseRedirect();
        }
Example #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();
        }
Example #3
0
        private void SaveArticleInfo()
        {
            bool isNew = false;
            BPArticles bp = new BPArticles();
            BEArticles dsArticles = new BEArticles();
            BEArticles.tbl_ArticlesRow article = null;

            int tempImageID1 = 0;
            int tempImageID2 = 0;

            if (ArticleID > 0)
            {
                dsArticles = bp.SelectArticleByID(ArticleID);
                article = dsArticles.tbl_Articles.FindByArticleID(ArticleID);

                if (!article.IsArticleImageID1Null())
                    tempImageID1 = article.ArticleImageID1;

                if (!article.IsArticleImageID2Null())
                    tempImageID2 = article.ArticleImageID2;
            }

            if (article == null)
            {
                article = dsArticles.tbl_Articles.Newtbl_ArticlesRow();
                isNew = true;
            }

            //page
            article.ArticleTitle = txtArticleTitle.Text.Trim();
            article.ArticleCategoryID = Convert.ToInt32(ddlCategories.SelectedValue);

            if (dtArticleDate.Date != dtArticleDate.MinDate)
                article.ArticleDate = dtArticleDate.Date;
            else
                article.SetArticleDateNull();

            if (edtBody1.Text.Trim() == "" || edtBody1.Text.Trim() == "<p>&nbsp;</p>")
                article.SetArticleBody1Null();
            else
                article.ArticleBody1 = edtBody1.Text.Trim();

            if (edtBody2.Text.Trim() == "" || edtBody2.Text.Trim() == "<p>&nbsp;</p>")
                article.SetArticleBody2Null();
            else
                article.ArticleBody2 = edtBody2.Text.Trim();

            //image 1
            if (imgArticleImageID1.SelectedImage > 0)
            {
                article.ArticleImageID1 = imgArticleImageID1.SelectedImage;
                if (ddlArticleImageAlignment1.SelectedValue == "Left" || ddlArticleImageAlignment1.SelectedValue == "Right" || ddlArticleImageAlignment1.SelectedValue == "Top" || ddlArticleImageAlignment1.SelectedValue == "Bottom")
                    article.ArticleImageAlignment1 = Convert.ToInt32(Enum.Parse(typeof(ImageAlignment), ddlArticleImageAlignment1.SelectedValue));
                else
                    article.SetArticleImageAlignment1Null();
            }
            else
            {
                article.SetArticleImageID1Null();
                article.SetArticleImageAlignment1Null();
            }

            //image 2
            if (imgArticleImageID2.SelectedImage > 0)
            {
                article.ArticleImageID2 = imgArticleImageID2.SelectedImage;
                if (ddlArticleImageAlignment2.SelectedValue == "Left" || ddlArticleImageAlignment2.SelectedValue == "Right" || ddlArticleImageAlignment2.SelectedValue == "Top" || ddlArticleImageAlignment2.SelectedValue == "Bottom")
                    article.ArticleImageAlignment2 = Convert.ToInt32(Enum.Parse(typeof(ImageAlignment), ddlArticleImageAlignment2.SelectedValue));
                else
                    article.SetArticleImageAlignment2Null();
            }
            else
            {
                article.SetArticleImageID2Null();
                article.SetArticleImageAlignment2Null();
            }

            //external article
            if (rblExternalArticle.SelectedValue == "True")
            {
                article.ExternalArticle = true;
                if (txtExternalURL.Text.Trim() != "")
                {
                    if (txtExternalURL.Text.Trim().Length < 8)
                        article.ExternalURL = "http://" + txtExternalURL.Text.Trim();
                    else if (txtExternalURL.Text.Trim().Substring(0, 7) != "http://" && txtExternalURL.Text.Trim().Substring(0, 8) != "https://")
                        article.ExternalURL = "http://" + txtExternalURL.Text.Trim();
                    else
                        article.ExternalURL = txtExternalURL.Text.Trim();

                }
                else
                    article.SetExternalURLNull();
            }
            else
            {
                article.ExternalArticle = false;
                article.SetExternalURLNull();
            }

            if (noBrowsePage)
                article.ArticleActive = true;
            else
                article.ArticleActive = chkArticleActive.Checked;

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

            if (isNew)
            {
                article.ArticleTypeID = SubTypeID;
                article.DateCreated = DateTime.Now;
                dsArticles.tbl_Articles.Addtbl_ArticlesRow(article);
            }

            bp.Update(dsArticles);
            ArticleID = article.ArticleID;

            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 = ArticleID;
                pageRow.SubTypeID = SubTypeID;

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

            //Resize images
            int[] selectedImageIDs = new int[2];
            bool doResize = false;

            if (!article.IsArticleImageID1Null() && (article.ArticleImageID1 != tempImageID1))
            {
                selectedImageIDs[0] = imgArticleImageID1.SelectedImage;
                doResize = true;
            }

            if (!article.IsArticleImageID2Null() && (article.ArticleImageID2 != tempImageID2))
            {
                selectedImageIDs[1] = imgArticleImageID2.SelectedImage;
                doResize = true;
            }

            if (doResize)
                ResizePageImages(selectedImageIDs);
        }
Example #4
0
        private void BindSelectedRelatedPages()
        {
            BPPages bpPages = new BPPages();
            BEPages dsPages = bpPages.SelectActiveRelatedPageLinks(PageTypeID, StoryID);

            int pageID;
            int typeID;
            int subTypeID;

            foreach (BEPages.tbl_PagesRow destinationPage in dsPages.tbl_Pages)
            {
                pageID = destinationPage.PageID;
                typeID = destinationPage.PageTypeID;
                subTypeID = destinationPage.IsSubTypeIDNull() ? -1 : destinationPage.SubTypeID;

                switch ((PageTypes)typeID)
                {
                    case PageTypes.Animal:
                        if (ddlAdoptionPages.Items.FindByValue(pageID.ToString()) != null)
                            ddlAdoptionPages.SelectedValue = pageID.ToString();
                        break;
                    case PageTypes.Story:
                        if (subTypeID > 0 && subTypeID == Convert.ToInt32(StoryTypes.Rescue_Story))
                        {
                            if (ddlRescueStoryPages.Items.FindByValue(pageID.ToString()) != null)
                                ddlRescueStoryPages.SelectedValue = pageID.ToString();
                        }
                        else if (subTypeID > 0 && subTypeID == Convert.ToInt32(StoryTypes.Look_At_Us_Now))
                        {
                            if (ddlLookAtUsNowPages.Items.FindByValue(pageID.ToString()) != null)
                                ddlLookAtUsNowPages.SelectedValue = pageID.ToString();
                        }
                        break;
                }
            }
        }
Example #5
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);
        }
Example #6
0
        private void BindRescueStoryPages()
        {
            BPPages bpPages = new BPPages();
            BEPages dsPages = bpPages.SelectActivePagesByPageTypeIDAndSubTypeID(PageTypeID, Convert.ToInt32(StoryTypes.Rescue_Story));

            dsPages.tbl_Pages.DefaultView.Sort = dsPages.tbl_Pages.PageTitleColumn.ColumnName;
            ddlRescueStoryPages.DataSource = dsPages.tbl_Pages.DefaultView;
            ddlRescueStoryPages.DataTextField = dsPages.tbl_Pages.PageTitleColumn.ColumnName;
            ddlRescueStoryPages.DataValueField = dsPages.tbl_Pages.PageIDColumn.ColumnName;
            ddlRescueStoryPages.DataBind();
            ddlRescueStoryPages.Items.Insert(0, new ListItem("(Select Rescue Story Page)", "0"));
        }
Example #7
0
        private void GetPageID()
        {
            BPPages bp = new BPPages();
            BEPages ds = bp.SelectByPageTypeIDAndPageTypeSpecificID(PageTypeID, StoryID);

            if (ds.tbl_Pages.Count > 0)
                PageID = ds.tbl_Pages[0].PageID;
        }
Example #8
0
        //private void BindAvailableRelatedPages()
        //{
        //    BindAdoptionPages();

        //    switch ((StoryTypes)SubTypeID)
        //    {
        //        case StoryTypes.Rescue_Story:
        //            BindLookAtUsNowPages();
        //            break;
        //        case StoryTypes.Look_At_Us_Now:
        //            BindRescueStoryPages();
        //            break;
        //    }
        //}

        private void BindAdoptionPages()
        {
            BPPages bpPages = new BPPages();
            BEPages dsPages = bpPages.SelectActivePagesByPageTypeID(Convert.ToInt32(PageTypes.Animal));

            dsPages.tbl_Pages.DefaultView.Sort = dsPages.tbl_Pages.PageTitleColumn.ColumnName;
            ddlAdoptionPages.DataSource = dsPages.tbl_Pages.DefaultView;
            ddlAdoptionPages.DataTextField = dsPages.tbl_Pages.PageTitleColumn.ColumnName;
            ddlAdoptionPages.DataValueField = dsPages.tbl_Pages.PageIDColumn.ColumnName;
            ddlAdoptionPages.DataBind();
            ddlAdoptionPages.Items.Insert(0, new ListItem("(Select Adoption Page)", "0"));
        }
Example #9
0
        private void SaveHomeInfo()
        {
            bool isNew = false;
            BPHome bp = new BPHome();
            BEHome ds = new BEHome();
            BEHome.tbl_HomeRow homeRow = null;

            int tempImageID1 = 0;

            if (HomeID > 0)
            {
                ds = bp.SelectHomeByID(HomeID);
                homeRow = ds.tbl_Home.FindByHomeID(HomeID);

                if (!homeRow.IsHomeImageIDNull())
                    tempImageID1 = homeRow.HomeImageID;
            }

            if (homeRow == null)
            {
                homeRow = ds.tbl_Home.Newtbl_HomeRow();
                isNew = true;
            }

            homeRow.HomeTitle = txtHomeTitle.Text.Trim();

            if (txtHomeTitleFR.Text.Trim() != "")
                homeRow.HomeTitleFR = txtHomeTitleFR.Text.Trim();
            else
                homeRow.SetHomeTitleFRNull();

            if (txtHomeText.Text.Trim() != "")
                homeRow.HomeText = txtHomeText.Text.Trim();
            else
                homeRow.SetHomeTextNull();

            if (txtHomeTextFR.Text.Trim() != "")
                homeRow.HomeTextFR = txtHomeTextFR.Text.Trim();
            else
                homeRow.SetHomeTextFRNull();

            if (imgHomeImage.SelectedImage > 0)
                homeRow.HomeImageID = imgHomeImage.SelectedImage;
            else
                homeRow.SetHomeImageIDNull();

            homeRow.DateModified = DateTime.Now;
            homeRow.ModifiedByAdminID = Convert.ToInt32(PageUserID);

            if (isNew)
            {
                homeRow.HomeActive = true;
                homeRow.DateCreated = DateTime.Now;
                ds.tbl_Home.Addtbl_HomeRow(homeRow);
            }

            bp.Update(ds);
            HomeID = homeRow.HomeID;

            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 = HomeID;

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

            SaveLinkInfo(isNew);

            //Resize images
            int[] selectedImageIDs = new int[1];
            bool doResize = false;

            if (!homeRow.IsHomeImageIDNull() && (homeRow.HomeImageID != tempImageID1))
            {
                selectedImageIDs[0] = homeRow.HomeImageID;
                doResize = true;
            }

            //if (!homeRow.IsLinkList2ImageIDNull() && (homeRow.LinkList2ImageID != tempImageID2))
            //{
            //    selectedImageIDs[1] = imgLinkList2Image.SelectedImage;
            //    doResize = true;
            //}

            if (doResize)
                ResizePageImages(selectedImageIDs);
        }
Example #10
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BPAnimals bpAnimals = new BPAnimals();
            BEAnimals dsAnimals = bpAnimals.SelectAnimalByID(AnimalID);

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

            if (dsAnimals.tbl_Animals.Count > 0)
            {
                DeleteRelatedPageLinks();
                dsAnimals.tbl_Animals[0].Delete();
                bpAnimals.Update(dsAnimals);

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

            BrowseRedirect();
        }
Example #11
0
        private void SaveAnimalInfo()
        {
            bool isNew = false;
            BPAnimals bp = new BPAnimals();
            BEAnimals dsAnimals = new BEAnimals();
            BEAnimals.tbl_AnimalsRow animal = null;

            if (AnimalID > 0)
            {
                dsAnimals = bp.SelectAnimalByID(AnimalID);
                animal = dsAnimals.tbl_Animals.FindByAnimalID(AnimalID);
            }

            if (animal == null)
            {
                animal = dsAnimals.tbl_Animals.Newtbl_AnimalsRow();
                isNew = true;
            }

            //page
            animal.AnimalTitle = txtAnimalTitle.Text.Trim();
            animal.AnimalTypeID = Convert.ToInt32(ddlAnimalTypes.SelectedValue);
            animal.AnimalGender = rblGender.SelectedValue;

            if (edtAnimalDescription.Text.Trim() == "" || edtAnimalDescription.Text.Trim() == "<p>&nbsp;</p>")
                animal.SetAnimalDescriptionNull();
            else
                animal.AnimalDescription = edtAnimalDescription.Text.Trim();

            if (txtAnimalMicrochipped.Text.Trim() != "")
                animal.AnimalMicrochipped = txtAnimalMicrochipped.Text.Trim();
            else
                animal.SetAnimalMicrochippedNull();

            if (txtAnimalNeutered.Text.Trim() != "")
                animal.AnimalNeutered = txtAnimalNeutered.Text.Trim();
            else
                animal.SetAnimalNeuteredNull();

            if (txtAnimalVaccinations.Text.Trim() != "")
                animal.AnimalVaccinations = txtAnimalVaccinations.Text.Trim();
            else
                animal.SetAnimalVaccinationsNull();

            if (dtAnimalIntakeDate.Date != dtAnimalIntakeDate.MinDate)
                animal.AnimalIntakeDate = dtAnimalIntakeDate.Date;
            else
                animal.SetAnimalIntakeDateNull();

            if (chkAdopted.Checked)
            {
                animal.Adopted = true;
                animal.Adoptable = false;
            }
            else
            {
                animal.Adopted = false;
                animal.Adoptable = chkIsAdoptable.Checked;
            }

            if (chkAnimalActive.Checked)
            {
                animal.AnimalActive = true;
                animal.FeaturedAnimal = chkFeaturedAnimal.Checked;
            }
            else
            {
                animal.AnimalActive = false;
                animal.FeaturedAnimal = false;
            }

            animal.DateModified = DateTime.Now;
            animal.ModifiedByAdminID = Convert.ToInt32(COPRUser.COPRIdentity.MemberID);	

            if (isNew)
            {
                animal.AnimalOrder = bp.GetAnimalMaxOrder();
                animal.DateCreated = DateTime.Now;
                dsAnimals.tbl_Animals.Addtbl_AnimalsRow(animal);
            }

            bp.Update(dsAnimals);
            AnimalID = animal.AnimalID;

            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 = AnimalID;
                pageRow.SetSubTypeIDNull();

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

                PageID = pageRow.PageID;
            }

            AddUpdateImageCategory(animal.AnimalTitle);
        }
Example #12
0
        private void BindSelectedRelatedPages()
        {
            BPPages bpPages = new BPPages();
            BEPages dsPages = bpPages.SelectActiveRelatedPageLinks(PageTypeID, AnimalID);

            if(dsPages.tbl_Pages.Count > 0)
            {
                BEPages.tbl_PagesRow destinationPage = dsPages.tbl_Pages[0];

                int pageID = destinationPage.PageID;
                int typeID = destinationPage.PageTypeID;
                int subTypeID = destinationPage.IsSubTypeIDNull() ? -1 : destinationPage.SubTypeID;

                if((PageTypes)typeID == PageTypes.Story)
                {
                    if (subTypeID > 0 && subTypeID == Convert.ToInt32(StoryTypes.Rescue_Story))
                    {
                        if (ddlRescueStoryPages.Items.FindByValue(pageID.ToString()) != null)
                            ddlRescueStoryPages.SelectedValue = pageID.ToString();
                    }
                }
            }
        }