Beispiel #1
0
        private void SaveNewsInfo()
        {
            bool isNew = false;
            BPNews bp = new BPNews();
            BENews dsNews = new BENews();
            BENews.tbl_NewsRow news = null;

            //int tempImageID1 = 0;

            if (NewsID > 0)
            {
                dsNews = bp.SelectByID(NewsID);
                news = dsNews.tbl_News.FindByNewsID(NewsID);

                //if (!news.IsNewsImage1Null())
                //    tempImageID1 = news.NewsImage1;
            }

            if (news == null)
            {
                news = dsNews.tbl_News.Newtbl_NewsRow();
                isNew = true;
            }

            news.NewsTitle = txtNewsTitle.Text.Trim();

            if (txtNewsTitleFR.Text.Trim() != "")
                news.NewsTitleFR = txtNewsTitleFR.Text.Trim();
            else
                news.SetNewsTitleFRNull();

            if (dtNewsDate.Date != dtNewsDate.MinDate)
                news.NewsDate = dtNewsDate.Date;
            else
                news.SetNewsDateNull();

            if (txtNewsDescription.Text.Trim() != "")
                news.NewsDescription = txtNewsDescription.Text.Trim();
            else
                news.SetNewsDescriptionNull();

            if (txtNewsDescriptionFR.Text.Trim() != "")
                news.NewsDescriptionFR = txtNewsDescriptionFR.Text.Trim();
            else
                news.SetNewsDescriptionFRNull();

            if (docNewsDocument.SelectedDocument > 0)
                news.NewsDocumentID = docNewsDocument.SelectedDocument;
            else
                news.SetNewsDocumentIDNull();

            if (docNewsDocumentFR.SelectedDocument > 0)
                news.NewsDocumentIDFR = docNewsDocumentFR.SelectedDocument;
            else
                news.SetNewsDocumentIDFRNull();

            //if (txtNewsTime.Text.Trim() != "")
            //    news.NewsTime = txtNewsTime.Text.Trim();
            //else
            //    news.SetNewsTimeNull();

            //if (txtNewsLocation.Text.Trim() != "")
            //    news.NewsLocation = txtNewsLocation.Text.Trim();
            //else
            //    news.SetNewsLocationNull();

            //if (txtNewsMapInfo.Text.Trim() != "")
            //    news.NewsMapInfo = txtNewsMapInfo.Text.Trim();
            //else
            //    news.SetNewsMapInfoNull();

            //if (edtNewsContent.Text.Trim() == "")
            //    news.SetNewsDescriptionNull();
            //else
            //    news.NewsDescription = edtNewsContent.Text.Trim();

            //if (imgNewsImage1.SelectedImage > 0)
            //{
            //    news.NewsImage1 = imgNewsImage1.SelectedImage;
            //    news.NewsImage1Alignment = Convert.ToInt32(ddlNewsImage1Alignment.SelectedValue);
            //}
            //else
            //{
            //    news.SetNewsImage1Null();
            //    news.SetNewsImage1AlignmentNull();
            //}

            if (chkNewsActive.Checked)
            {
                news.NewsActive = true;
                news.FeaturedItem = chkFeaturedItem.Checked;
            }
            else
            {
                news.NewsActive = false;
                news.FeaturedItem = false;
            }

            news.NewsActiveFR = chkNewsActiveFR.Checked;

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

            if (isNew)
            {
                news.NewsTypeID = SubTypeID;
                news.DateCreated = DateTime.Now;
                dsNews.tbl_News.Addtbl_NewsRow(news);
            }

            bp.Update(dsNews);
            //NewsID = news.NewsID;
            //SaveLinkInfo(isNew);

            //if (!news.IsNewsImage1Null() && (news.NewsImage1 != tempImageID1))
            //    ResizePageImages(news.NewsImage1); 
        }
Beispiel #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BPNews bpNews = new BPNews();
            BENews dsNews = bpNews.SelectByID(NewsID);

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

            if (dsNews.tbl_News.Count > 0)
            {
                //DeleteAllLinkInfo();
                dsNews.tbl_News[0].Delete();
                bpNews.Update(dsNews);

                //if (dsPages.tbl_Pages.Count > 0)
                //{
                //    dsPages.tbl_Pages[0].Delete();
                //    bpPages.Update(dsPages);
                //}
            }
            BrowseRedirect();
        }
Beispiel #3
0
        private void BindNewsInfo()
        {
            if (NewsID > 0)
            {
                BPNews bp = new BPNews();
                BENews ds = bp.SelectByID(NewsID);
                BENews.tbl_NewsRow news = null;

                if (ds.tbl_News.Count > 0)
                {
                    news = ds.tbl_News[0];

                    lblTitle.Text = "Edit " + news.NewsTitle;

                    txtNewsTitle.Text = news.NewsTitle;
                    txtNewsTitleFR.Text = news.IsNewsTitleFRNull() ? "" : news.NewsTitleFR;

                    if (!news.IsNewsDateNull())
                        dtNewsDate.Date = news.NewsDate;

                    //txtNewsLocation.Text = news.IsNewsLocationNull() ? "" : news.NewsLocation;
                    //txtNewsTime.Text = news.IsNewsTimeNull() ? "" : news.NewsTime;
                    //txtNewsMapInfo.Text = news.IsNewsMapInfoNull() ? "" : news.NewsMapInfo;

                    //if (!news.IsNewsDescriptionNull())
                    //    edtNewsContent.Text = news.NewsDescription;
                    //else
                    //    edtNewsContent.Text = "";

                    txtNewsDescription.Text = news.IsNewsDescriptionNull() ? "" : news.NewsDescription;
                    txtNewsDescriptionFR.Text = news.IsNewsDescriptionFRNull() ? "" : news.NewsDescriptionFR;

                    if (!news.IsNewsDocumentIDNull())
                        docNewsDocument.SelectedDocument = news.NewsDocumentID;

                    if (!news.IsNewsDocumentIDFRNull())
                        docNewsDocumentFR.SelectedDocument = news.NewsDocumentIDFR;

                    //if (!news.IsNewsImage1Null())
                    //    imgNewsImage1.SelectedImage = news.NewsImage1;

                    //if (!news.IsNewsImage1AlignmentNull() && ddlNewsImage1Alignment.Items.FindByValue(news.NewsImage1Alignment.ToString()) != null)
                    //    ddlNewsImage1Alignment.SelectedValue = news.NewsImage1Alignment.ToString();


                    if (news.FeaturedItem)
                        chkFeaturedItem.Enabled = true;
                    else
                        chkFeaturedItem.Enabled = !MaxFeaturedItemsExist();

                    chkFeaturedItem.Checked = news.FeaturedItem;
                    chkNewsActive.Checked = news.NewsActive;
                    chkNewsActiveFR.Checked = news.NewsActiveFR;

                    //lnkNewsLinks.PageTypeSpecificID = NewsID;
                    //lnkNewsLinks.PageTypeID = PageTypeID;
                }
            }
            else
            {
                btnDelete.Visible = false;
                lblTitle.Text = "Add New " + SubTypeName;
                chkFeaturedItem.Enabled = !MaxFeaturedItemsExist();
                //edtNewsContent.Text = ""; 
            }
        }