示例#1
0
        public NewsItem GetNews(int id)
        {
            NewsItem item =null;

            try
            {
                News dao = new News();
                item = dao.GetByID(id);
            }
            catch { }

            return item;
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowAuctionBanner();
            News dao = new News();
            NewsItem item = dao.GetLastOneNewsForPage(3,CurrentLanguage);

            if (item != null && !string.IsNullOrEmpty(item.Title))
            {
                ltLastNews.Text = item.Title;
            }

            url1 = setHyperLink("HomePageBannerUrl");
            url2 = setHyperLink("HomePageBannerUrl2");
        }
示例#3
0
 protected void btnDeleteImage_Click(object sender, EventArgs e)
 {
     News news = new News();
     if (news.DeleteImage(this.GroupID))
         btnDeleteImage.Visible = false;
 }
示例#4
0
        private void SaveCommonFields()
        {
            News news = new News();
            if (fuImage.HasFile && fuImage.FileBytes.Length>0)
            {
                int size = 0;
                byte[] image = fuImage.FileBytes;

                if (int.TryParse(ConfigurationManager.AppSettings["NewsImageWidth"],out size))
                {
                    System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Jpeg;
                    string mime = fuImage.PostedFile.ContentType.ToLower();
                    if (mime == "image/gif")
                    {
                        format = System.Drawing.Imaging.ImageFormat.Gif;
                    }
                    else if (mime == "image/png")
                    {
                        format = System.Drawing.Imaging.ImageFormat.Png;
                    }
                    image = ImageResizer.ResizeByWidth(fuImage.FileBytes, format, size);
                }

                if (news.UpdateImage(this.GroupID, image))
                    btnDeleteImage.Visible = true;
            }
            //save pages
            news.ShowOnPages(this.GroupID, cp.GetSelectedIDs());
            //save sections
            //news.ShowInSections(this.GroupID, cs.GetSelectedIDs());
        }
示例#5
0
        private void BindCommonFields()
        {
            News news = new News();
            NewsItem item = news.GetByLangGroup("ru", GroupID);

            if (item != null)
            {
                dpNewsDate.SelectedDate = item.Date;
                //ip.CheckItem(item.ImagePosition);
                btnDeleteImage.Visible = item.HasImage;

                List<int> pages = news.GetContentPagesIDs(item.GroupID);
                List<int> sections = news.GetContentSectionsIDs(item.GroupID);

                cp.CheckItems(pages);
                //cs.CheckItems(sections);

                chbIsMain.Checked = item.IsMain;
            }
        }
示例#6
0
        public string GetNewsText(int id)
        {
            string result = string.Empty;

            try
            {
                News dao = new News();
                NewsItem item = dao.GetByID(id);
                if (item != null && !string.IsNullOrEmpty(item.Text))
                {
                    result = item.Text;
                }
            }
            catch { }

            return result;
        }