Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string     newsId  = Request.QueryString["NewsID"];
                string     loginId = Session["LoginID"].ToString();
                TNNEWSInfo news    = new TNNEWSInfo();
                news.CN_MODIFY_DATE    = DateTime.Now;
                news.CR_MODIFY_USER_ID = loginId;
                news.CN_CREATE_DATE    = DateTime.Now;
                news.CR_CREATE_USER_ID = loginId;
                if (newsId != null)
                {
                    news            = bllTNNEWS.GetModelByID(newsId);
                    news.CN_TITLE   = txtTitle.Text;
                    news.CN_CONTENT = Server.HtmlDecode(myEditor.InnerHtml);

                    bllTNNEWS.Update(news);
                }
                else
                {
                    news.CN_ID      = Guid.NewGuid().ToString();
                    news.CN_TITLE   = txtTitle.Text;
                    news.CN_CONTENT = Server.HtmlDecode(myEditor.InnerHtml);

                    bllTNNEWS.Add(news);
                }
                MessageBox.ShowAndRedirect(this, "保存成功", "NewsList.aspx");
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "保存出错" + ex.Message);
            }
        }
Example #2
0
        private void BindContent()
        {
            try
            {
                string id = Request["id"];
                if (id != null)
                {
                    TNNEWSInfo info = bll.GetModelByID(id);
                    if (info != null)
                    {
                        labTitle.Text        = info.CN_TITLE;
                        labTime.Text         = "上传日期:" + DateTime.Parse(info.CN_CREATE_DATE.ToString()).ToString("yyyy-MM-dd");
                        divContent.InnerHtml = info.CN_CONTENT;

                        if (info.ListTNNEWSVIDEO != null && info.ListTNNEWSVIDEO.Count > 0)
                        {
                            divVideo.Visible = true;
                            StringBuilder sb  = new StringBuilder();
                            StringBuilder sb1 = new StringBuilder();
                            foreach (var item in info.ListTNNEWSVIDEO)
                            {
                                sb.Append("<div style='margin:10px' id='" + item.CN_ID + "'></div>");
                                sb1.Append("CKobject.embed('../Style/ckplayer/ckplayer.swf', '" + item.CN_ID + "', 'ckplayer_" + item.CN_ID + "', '750', '450', true, { f: '" + item.CN_VIDEO_PATH + "', c: 0, b: 1, i: '' }, ['" + item.CN_VIDEO_PATH + "']);");
                            }
                            StringBuilder result = new StringBuilder();
                            result.Append(sb.ToString());
                            result.Append("<script type='text/javascript'>");
                            result.Append(sb1.ToString());
                            result.Append("</script>");

                            video.InnerHtml = result.ToString();
                        }
                        else
                        {
                            divVideo.Visible = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog(ex);
                MessageBox.Show(this, ex.Message);
            }
        }