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(); }
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); }