Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["NID"] != null && !string.IsNullOrEmpty(Request.QueryString["NID"]))
         {
             uiPanelAllNews.Visible = false;
             uiPanelViewNews.Visible = true;
             int id = Convert.ToInt32(Request.QueryString["NID"].ToString());
             BLL.News currentnews = new BLL.News();
             currentnews.LoadByPrimaryKey(id);
             uiLabelDate.Text = string.Format("{0:yyyy-MM-dd}", currentnews.CreatedDate.ToString());
             uiLabelTime.Text = string.Format("{0:hh:mm:ss}", currentnews.CreatedDate.ToString());
             uiLabelTitle.Text = currentnews.EnTitle;
             if (!string.IsNullOrEmpty(currentnews.MainPicturePath))
                 uiImageNews.ImageUrl = currentnews.MainPicturePath;
             else
                 uiImageNews.ImageUrl = "images/logo_Big_watermark.jpg";
             uiLiteralContent.Text = Server.HtmlDecode(currentnews.EnBody);
         }
         else
         {
             uiPanelAllNews.Visible = true;
             uiPanelViewNews.Visible = false;
             BindData();
         }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LanguageID"] != null)
                g_LanguageID = Convert.ToInt32(Session["LanguageID"].ToString());

            if (!IsPostBack)
            {
                BLL.News b_News = new BLL.News();
                Entity.News[] e_News;

                e_News = b_News.Select_News(3, g_LanguageID, 3, 1);
                if (e_News != null)
                {
                    foreach (Entity.News o_News in e_News)
                    {
                        HyperLink o_HyperLink = new HyperLink();
                        o_HyperLink.NavigateUrl = "../News_Detail.aspx?News_ID=" + o_News.News_ID.ToString();

                        if (o_News.News_Title.Length > 24)
                            o_HyperLink.Text = o_News.News_Title.Substring(0, 24);
                        else
                            o_HyperLink.Text = o_News.News_Title;

                        o_HyperLink.CssClass = "nav8";
                        Form_Controls.Controls.Add(o_HyperLink);

                        HtmlGenericControl o_HtmlGenericControl = new HtmlGenericControl();
                        o_HtmlGenericControl.InnerHtml = "<br/>";
                        Form_Controls.Controls.Add(o_HtmlGenericControl);
                    }
                }
            }
        }
Esempio n. 3
0
 private void BindEnglishData()
 {
     BLL.News objData = new BLL.News();
     objData.GetTopNews();
     uiRepeaterEnNews.DataSource = objData.DefaultView;
     uiRepeaterEnNews.DataBind();
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int id = Convert.ToInt32(Context.Request.QueryString["id"]);
     BLL.News bllNews = new BLL.News();
       DataTable dt= bllNews.GetNewsById(id);
       sbHtml.Append(dt.Rows[0]["ncontent"]);
 }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetHyperLinkTitle(HyperLink_Title);

                if (g_News_ClassID == 1 || g_News_ClassID == 2)
                    SetHyperLinkNewsClass(HyperLink_News_ClassID_1, HyperLink_News_ClassID_2);
                else
                {
                    HyperLink_News_ClassID_1.Visible = false;
                    HyperLink_News_ClassID_2.Visible = false;
                }

                BLL.News b_News = new BLL.News();
                Entity.News e_News = b_News.Select_News(g_News_ID);

                if (e_News != null)
                {
                    g_News_ClassID = e_News.News_ClassID;
                    SetHyperLinkNews(HyperLink_News);

                    News_Content.InnerHtml += "<h1><strong>" + e_News.News_Title + "</strong></h1>";
                    News_Content.InnerHtml += e_News.News_Content;
                }
            }
        }
Esempio n. 6
0
 int LoadOldNews()
 {
     int id = Convert.ToInt32(Request.QueryString["id"]);
     BLL.News bllNews = new BLL.News();
     DataTable dt = bllNews.GetNewsById(id);
     title = dt.Rows[0][1].ToString();
     content = dt.Rows[0][2].ToString();
     return  Convert.ToInt32(dt.Rows[0][5]);
 }
Esempio n. 7
0
 void LoadNewsHead(int cid)
 {
     BLL.News bllNews = new BLL.News();
     List<MODEL.News> list = bllNews.GetAllNews(cid);
     foreach (MODEL.News model in list)
     {
         sbNews.Append("<li>");
         sbNews.Append("<a href='News.aspx?id=" + model.Id + "'>");
         sbNews.Append(model.Ntitle).Append("</a><span style='font-size:14px'>").Append(model.Ncreatedate.ToString("yyyy-MM-dd"));
         sbNews.Append("<span></li>");
     }
 }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetHyperLinkTitle(HyperLink_Title);
                SetHyperLinkNews(HyperLink_News);

                if (g_News_ClassID == 1 || g_News_ClassID == 2)
                    SetHyperLinkNewsClass(HyperLink_News_ClassID_1, HyperLink_News_ClassID_2);
                else
                {
                    HyperLink_News_ClassID_1.Visible = false;
                    HyperLink_News_ClassID_2.Visible = false;
                }

                BLL.News b_News = new BLL.News();
                Entity.News[] e_News = b_News.Select_News(g_News_ClassID, g_LanguageID, 7, g_Page);

                if (e_News != null)
                {
                    foreach (Entity.News o_News in e_News)
                    {
                        HtmlGenericControl o_Div = new HtmlGenericControl("div");
                        o_Div.Attributes.Add("class", "inside3_news");

                        HtmlGenericControl o_H3 = new HtmlGenericControl("h3");
                        HtmlGenericControl o_Strong = new HtmlGenericControl("strong");
                        HtmlAnchor o_Anchor = new HtmlAnchor();
                        o_Anchor.HRef = "News_Detail.aspx?News_ClassID=" + o_News.News_ClassID.ToString() + "&News_ID=" + o_News.News_ID.ToString();
                        o_Anchor.InnerText = o_News.News_Title;
                        o_Anchor.Style.Add(HtmlTextWriterStyle.Color, "#0355a3");
                        HtmlGenericControl o_Span = new HtmlGenericControl("span");
                        o_Span.Style.Add(HtmlTextWriterStyle.Color, "#636363");
                        o_Span.InnerText = "(" + o_News.News_AddTime.ToShortDateString() + ")";
                        o_Strong.Controls.Add(o_Anchor);
                        o_Strong.Controls.Add(o_Span);
                        o_H3.Controls.Add(o_Strong);
                        o_Div.Controls.Add(o_H3);

                        o_Span = new HtmlGenericControl("span");
                        o_Span.Attributes.Add("style", "line-height:20px; color:#636363; text-indent:2em; float:left; width:620px; margin-top:10px;");

                        if (o_News.News_Intro.Length > 182)
                            o_Span.InnerText = o_News.News_Intro.Substring(0, 182);
                        else
                            o_Span.InnerText = o_News.News_Intro;

                        o_Div.Controls.Add(o_Span);
                        News_Lists.Controls.Add(o_Div);
                    }
                }
            }
        }
Esempio n. 9
0
        private void ShowInfo(int Id)
        {
            Maticsoft.BLL.Leaveword   bll   = new Maticsoft.BLL.Leaveword();
            Maticsoft.Model.Leaveword model = bll.GetModel(Id);
            this.lblId.Text = model.Id.ToString();
            BLL.News   BLLNews   = new BLL.News();
            Model.News ModelNews = BLLNews.GetModel((int)model.Fk_News_Id);
            this.lblFk_News_Id.Text = ModelNews.Name;
            this.lblContents.Text   = model.Contents;

            this.lblAddTimes.Text = model.AddTimes.ToString();
        }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int cid = Convert.ToInt32(Context.Request.QueryString["cid"]);
     BLL.NewsCat bllNewsCat = new BLL.NewsCat();
     NewsCatName = bllNewsCat.GetNewCatNameById(cid);
     BLL.News bllNews = new BLL.News();
     List<MODEL.News> list = bllNews.GetNewsBycid(cid);
     foreach (var i in list)
     {
         sbHtml.Append("<li><a href='News.aspx?id="+i.Id+"'>");
         sbHtml.Append(i.Ntitle);
         sbHtml.Append("</a></li>");
     }
 }
Esempio n. 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     BLL.News bllNews = new BLL.News();
     DataTable dt = bllNews.GetTop7();
     foreach (DataRow dr in dt.Rows)
     {
         string title = dr["ntitle"].ToString();
         string showtitle = title.Length > 18 ? title.Substring(0, 18) + "..." : title;
         indexNews.Append("<li>");
         indexNews.Append("<a href='News.aspx?id="+Convert.ToInt32(dr["id"])+"'>"+showtitle+"");
         indexNews.Append("<span style='float:right'>"+((DateTime)dr["ncreatedate"]).ToString("MM-dd")+"<span>");
         indexNews.Append("</a></li>");
     }
 }
Esempio n. 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     BLL.News BllNews = new BLL.News();
     DataTable dtNews = BllNews.GetAllNews();
     foreach (DataRow dr in dtNews.Rows)
     {
         htmlData.Append("<tr class='info'><td>"+dr["id"]+"</td>");
         htmlData.Append("<td>"+dr["ntitle"]+"</td><td>");
         htmlData.Append("<a href='javascript:void(0)' onclick='del(this)' id='"+dr["id"]+"' role='button'><i class='icon-remove'></i></a>");
         htmlData.Append("  <a href='EditNews.aspx?id="+dr["id"]+"'><i class='icon-pencil' style='padding-left:15px'></i></a>");
         htmlData.Append("</td></tr>");
     }
     htmlData.Append("</tbody></table>");
 }
Esempio n. 13
0
 void GenerateNewsTitle()
 {
     // <li><a href="news.html">公司新闻 <span class="ui-li-count">12</span></a></li>
     BLL.NewsCat bllNewscat = new BLL.NewsCat();
     BLL.News bllNews = new BLL.News();
     List<MODEL.NewsCat> list= bllNewscat.GetAllNewsCategory();
     foreach (var item in list)
     {
         newsTitle.Append("<li><a href=NewsBrief.aspx?cid="+item.Id+">");
         newsTitle.Append(item.Name);
         newsTitle.Append("<span class='ui-li-count'>");
         newsTitle.Append(bllNews.GetNewsCountByCid(item.Id));
         newsTitle.Append("</span></a></li>");
     }
 }
Esempio n. 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LoadNewsCat(LoadOldNews());
     if (IsPostBack)
     {
         MODEL.News model = new MODEL.News();
         model.Id = Convert.ToInt32(Context.Request.QueryString["id"]);
         model.Catid = Convert.ToInt32(Request.Form["selNewsCate"]);
         model.Ntitle = Request.Form["title"];
         model.Ncontent = Request.Form["myeditor"];
         BLL.News bllNews = new BLL.News();
         if (bllNews.ModifyNews(model) > 0)
         {
             Context.Response.Write("<script>alert('修改成功啦!')</script>");
         }
     }
 }
Esempio n. 15
0
        private void BindData()
        {
            PagedDataSource dt = new PagedDataSource();
            BLL.News currentnews = new BLL.News();
            currentnews.LoadAll();
            currentnews.DefaultView.Sort = "CreatedDate desc";
            dt.DataSource = currentnews.DefaultView;
            dt.AllowPaging = true;
            dt.PageSize = 10;
            dt.CurrentPageIndex = PageIndex;
            uiRepeaterCurrentNews.DataSource = dt;
            uiRepeaterCurrentNews.DataBind();

            uiLinkButtonPrev.Enabled = !dt.IsFirstPage;
            uiLinkButtonNext.Enabled = !dt.IsLastPage;
            uiLabelPages.Text = "Page " + (PageIndex + 1).ToString() + " of " + dt.PageCount.ToString() + " Pages";
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            b_News = new BLL.News();

            if (!IsPostBack)
            {
                GetNewsTXT(News_Name);
                SetLanguageControl(News_LanguageID);

                switch (g_Action_ID)
                {
                    case 1:
                        News_AddTime_TD.Visible = false;
                        News_Submit.Text = " 添加 ";
                        break;

                    case 2:
                        if (g_News_ID == 0)
                            ResponseError("参数错误");

                        e_News = b_News.Select_News(g_News_ID);
                        if (e_News != null)
                        {
                            News_LanguageID.SelectedValue = e_News.News_LanguageID.ToString();
                            News_AddTime.Text = e_News.News_AddTime.ToString();
                            News_Intro.Text = e_News.News_Intro;
                            News_Title.Text = e_News.News_Title;
                            News_Content.Value = e_News.News_Content;
                        }

                        News_Submit.Text = " 修改 ";
                        break;

                    case 3:
                        if (g_News_ID == 0)
                            ResponseError("参数错误");

                        b_News.Delete_News(g_News_ID);
                        ResponseClose("删除成功");
                        break;
                }
            }
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LanguageID"] != null)
                g_LanguageID = Convert.ToInt32(Session["LanguageID"].ToString());

            if (!IsPostBack)
            {
                BLL.News b_News = new BLL.News();
                Entity.News[] e_News;

                e_News = b_News.Select_News(1, g_LanguageID, 6, 1);
                if (e_News != null)
                {
                    foreach (Entity.News o_News in e_News)
                    {
                        HyperLink o_HyperLink = new HyperLink();
                        o_HyperLink.NavigateUrl = "../News_Detail.aspx?News_ID=" + o_News.News_ID.ToString();

                        if (o_News.News_Title.Length > 24)
                            o_HyperLink.Text = o_News.News_Title.Substring(0, 24);
                        else
                            o_HyperLink.Text = o_News.News_Title;

                        o_HyperLink.CssClass = "nav8";
                        Offers_Controls.Controls.Add(o_HyperLink);

                        HtmlGenericControl o_HtmlGenericControl = new HtmlGenericControl();
                        o_HtmlGenericControl.InnerHtml = "<br/>";
                        Offers_Controls.Controls.Add(o_HtmlGenericControl);
                    }

                    HyperLink m_HyperLink = new HyperLink();
                    m_HyperLink.NavigateUrl = "../News_List.aspx?News_ClassID=1";
                    m_HyperLink.Text = "更多>>>";
                    m_HyperLink.CssClass = "nav8";
                    m_HyperLink.Style.Add(HtmlTextWriterStyle.BackgroundImage, "none");
                    m_HyperLink.Style.Add(HtmlTextWriterStyle.BorderWidth, "0");
                    m_HyperLink.Style.Add(HtmlTextWriterStyle.TextAlign, "right");
                    Offers_Controls.Controls.Add(m_HyperLink);
                }
            }
        }
Esempio n. 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LoadNewsCat();
     if (IsPostBack)
     {
         MODEL.News model = new MODEL.News();
         model.Ntitle = Request.Form["title"];
         model.Ncontent = Request.Form["editor01"];
         model.Catid = Convert.ToInt32(Request.Form["selNewsCate"]);
         BLL.News bllNews = new BLL.News();
         if (bllNews.AddNews(model))
         {
             Response.Write("<script>alert('添加成功!')</script>");
         }
         else
         {
             Response.Write("失败!请重试!");
         }
     }
 }
Esempio n. 19
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            BLL.News objData = new BLL.News();
            objData.GetTopNews();
            object oMissing = System.Reflection.Missing.Value;

            Application oWordApp = new Application();
            Document document = oWordApp.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            document.Activate();

            int i = 0 ;
            foreach (DataRowView item in objData.DefaultView)
            {

                oWordApp.Selection.TypeText(item["ArTitle"].ToString());
                oWordApp.Selection.TypeParagraph();
                oWordApp.Selection.TypeParagraph();

                oWordApp.Selection.InlineShapes.AddPicture("http://localhost:2674/" + item["MainPicturePath"].ToString());
                oWordApp.Selection.TypeParagraph();

                oWordApp.Selection.TypeText(StripTagsCharArray(Server.HtmlDecode(item["ArBody"].ToString())));
                oWordApp.Selection.InsertNewPage();
                i++;

            }
            document.SaveAs(Server.MapPath("~/fileuploads/News.docx"), oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
                    oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
            document.Close();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Charset = "";

            HttpContext.Current.Response.ContentType = "application/docx";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"news.docx\"");
            HttpContext.Current.Response.TransmitFile("/fileuploads/News.docx");

            HttpContext.Current.Response.Flush();
            HttpContext.Current.Response.End();
            oWordApp.Application.Quit(ref oMissing, ref oMissing, ref oMissing);
        }
Esempio n. 20
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/html";
     int nid=Convert.ToInt32(context.Request.QueryString["nid"]);
     try
     {
         BLL.News bllNews=new BLL.News();
         if (bllNews.DelNews(nid))
         {
             context.Response.Write("OK");
         }
         else
         {
             context.Response.Write("FAIL!");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     //JavaScriptSerializer jss = new JavaScriptSerializer();
     //string strJson = jss.Serialize(list);
 }
Esempio n. 21
0
        public void BindNewList()
        {
            string where = string.Empty;
            string queryString = string.Empty;

            string tid = Utility.Common.SqlEncode(Utility.Common.GetStringOfUrl("tid"));

            if (!string.IsNullOrEmpty(tid))
            {
                if (!Utility.Common.IsNumber(tid))
                {
                    Response.Write("请不要非法操作");
                    Response.End();
                }
                else
                {
                    where       += " and News_Type=" + tid + " ";
                    queryString += "&tid=" + Server.UrlEncode(queryString);
                    location     = "<a href=\"/NewsList.aspx\">新闻中心</a> > " + new BLL.News().GetTypeName(tid);
                }
            }
            else
            {
                location = "新闻中心";
            }

            int       counts;
            DataTable dt = new BLL.News().PagerList_Lsl(/*WebPager1.PageSize, WebPager1.CurrentPageIndex,*/ anpPageIndex.PageSize, PageIndex, out counts, where);

            //WebPager1.ItemCount = counts;
            anpPageIndex.CurrentPageIndex = PageIndex;
            anpPageIndex.RecordCount      = counts;
            //WebPager1.UrlQueryString = queryString;
            rpNewsList.DataSource = dt.DefaultView;
            rpNewsList.DataBind();
        }
Esempio n. 22
0
 protected void Page_Load( object sender, EventArgs e )
 {
     BLL.News news = new BLL.News();
     rpNewType.DataSource = news.TypeList().DefaultView;
     rpNewType.DataBind();
 }
Esempio n. 23
0
 protected void uiButtonSearch_Click(object sender, EventArgs e)
 {
     BLL.News objData = new BLL.News();
     objData.SearchNews(uiTextBoxSearch.Text, !string.IsNullOrEmpty(uiTextBoxFromDate.Text) ? DateTime.Parse(uiTextBoxFromDate.Text) : DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", null)
                                              , !string.IsNullOrEmpty(uiTextBoxToDate.Text) ? DateTime.Parse(uiTextBoxToDate.Text) : DateTime.MaxValue);
     uiGridViewNews.DataSource = objData.DefaultView;
     uiGridViewNews.DataBind();
 }
Esempio n. 24
0
 protected void uiButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelEdit.Visible = false;
     uiPanelViewNews.Visible = true;
     uiPanelExport.Visible = false;
     Clearfields();
     CurrentNews = null;
 }
Esempio n. 25
0
 private void UpdateRecord()
 {
     BLL.News objData = new BLL.News();
     objData = CurrentNews;
     objData.EnTitle = uiTextBoxEnTitle.Text;
     objData.ArTitle = uiTextBoxArTitle.Text;
     objData.EnBody = Server.HtmlEncode(uiFCKeditorEnBody.Value);
     objData.ArBody = Server.HtmlEncode(uiFCKeditorArBody.Value);
     //objData.CategoryID = Convert.ToInt32(uiDropDownListCategory.SelectedValue);
     objData.EnBrief = uiTextBoxEnBreif.Text;
     objData.ArBrief = uiTextBoxArBrief.Text;
     if (uiFileUploadMainPicturePath.HasFile)
     {
         uiFileUploadMainPicturePath.SaveAs(Server.MapPath("~/FileUploads/News/" + uiFileUploadMainPicturePath.FileName));
         objData.MainPicturePath = "/FileUploads/News/" + uiFileUploadMainPicturePath.FileName;
     }
     objData.CreatedDate = DateTime.Now.AddHours(7);
     objData.Save();
 }
Esempio n. 26
0
 private void BindExportData()
 {
     BLL.News objData = new BLL.News();
     objData.LoadAll();
     uiGridViewExport.DataSource = objData.DefaultView;
     uiGridViewExport.DataBind();
 }
Esempio n. 27
0
        protected void uiLinkButtonExport_Click(object sender, EventArgs e)
        {
            string filter = "";
            //DataTable dt = new DataTable();
            BLL.News news = new BLL.News();
            foreach (GridViewRow row in uiGridViewExport.Rows)
            {

                System.Web.UI.WebControls.CheckBox cb = (System.Web.UI.WebControls.CheckBox)row.FindControl("uiCheckBoxExport");
                if (cb.Checked)
                {
                    if (!string.IsNullOrEmpty(filter))
                        filter += ",";
                    HiddenField hf = (HiddenField)row.FindControl("uiHiddenFieldID");
                    filter += hf.Value;
                }
            }
            news.LoadAll();
            news.Filter = "NewsID in (" + filter + ")";

            if (news.RowCount > 0)
            {

                StringBuilder sbDocBody = new StringBuilder();

                object oMissing = System.Reflection.Missing.Value;

                /*Application oWordApp = new Application();
                Document document = oWordApp.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
                document.Activate();*/

                int i = 0;
                sbDocBody.Append("<html><body>");
                foreach (DataRowView item in news.DefaultView)
                {

                    /*oWordApp.Selection.TypeText(item["EnTitle"].ToString());
                    oWordApp.Selection.TypeParagraph();
                    oWordApp.Selection.TypeParagraph();

                    oWordApp.Selection.InlineShapes.AddPicture("http://www.globallogistics.mtg-eg.com/" + item["MainPicturePath"].ToString());
                    oWordApp.Selection.TypeParagraph();

                    oWordApp.Selection.TypeText(StripTagsCharArray(Server.HtmlDecode(item["EnBody"].ToString())));
                    oWordApp.Selection.InsertNewPage();*/
                    sbDocBody.Append(item["EnTitle"].ToString());
                    sbDocBody.Append("<br />");
                    sbDocBody.Append("<img src=\'http://www.globallogistics.mtg-eg.com/" + item["MainPicturePath"].ToString() + "\'");
                    sbDocBody.Append("<br />");
                    sbDocBody.Append(Server.HtmlDecode(item["EnBody"].ToString()));
                    sbDocBody.Append("<br />");
                    sbDocBody.Append("<br />");
                    sbDocBody.Append("<hr />");
                    i++;

                }
                sbDocBody.Append("</body></html>");
                /*document.SaveAs(Server.MapPath("~/fileuploads/News.docx"), oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
                        oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
                document.Close();*/
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Buffer = true;
                HttpContext.Current.Response.Charset = "utf-8";

                HttpContext.Current.Response.ContentType = "application/msword";
                HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"news.doc\"");
                //HttpContext.Current.Response.TransmitFile("/fileuploads/News.docx");
                HttpContext.Current.Response.Write(sbDocBody.ToString());
                //HttpContext.Current.Response.Flush();
                HttpContext.Current.Response.End();
                //oWordApp.Application.Quit(ref oMissing, ref oMissing, ref oMissing);
            }
            else
            {

            }
        }
Esempio n. 28
0
        protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditNews")
            {
                BLL.News objData = new BLL.News();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentNews = objData;
                uiTextBoxArTitle.Text = objData.ArTitle;
                uiTextBoxEnTitle.Text = objData.EnTitle;
                uiFCKeditorArBody.Value = Server.HtmlDecode(objData.ArBody);
                uiFCKeditorEnBody.Value = Server.HtmlDecode(objData.EnBody);
                //uiDropDownListCategory.SelectedValue = objData.CategoryID.ToString();
                uiTextBoxEnBreif.Text = objData.EnBrief;
                uiTextBoxArBrief.Text = objData.ArBrief;
                //uiTextBoxDate.Text = ds.Tables[0].Rows[0]["CreatedDate"].ToString();
                uiPanelViewNews.Visible = false;
                uiPanelEdit.Visible = true;
                uiPanelExport.Visible = false;
            }
            else if (e.CommandName == "DeleteNews")
            {
                BLL.News objData = new BLL.News();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                objData.MarkAsDeleted();
                objData.Save();
                CurrentNews = null;
                BindData();

            }
        }
Esempio n. 29
0
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            if (CurrentNews != null)
            {
                UpdateRecord();
            }
            else
            {
                AddNewRecord();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewNews.Visible = true;
            uiPanelExport.Visible = false;
            Clearfields();
            BindData();
            CurrentNews = null;
        }
Esempio n. 30
0
 protected void Page_Load(object sender, EventArgs e)
 {
     BLL.News news = new BLL.News();
     rpNewType.DataSource = news.TypeList().DefaultView;
     rpNewType.DataBind();
 }
Esempio n. 31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetMember_Info();

                BLL.News b_News = new BLL.News();
                Entity.News[] e_News;

                e_News = b_News.Select_News(1, g_LanguageID, 5, 1);
                if (e_News != null)
                {
                    foreach (Entity.News o_News in e_News)
                    {
                        HyperLink o_HyperLink = new HyperLink();
                        o_HyperLink.NavigateUrl = "News_Detail.aspx?News_ID=" + o_News.News_ID.ToString();

                        if (o_News.News_Title.Length > 24)
                            o_HyperLink.Text = o_News.News_Title.Substring(0, 24);
                        else
                            o_HyperLink.Text = o_News.News_Title;

                        o_HyperLink.CssClass = "nav9";

                        StringBuilder o_StringBuilder = new StringBuilder();
                        StringWriter o_StringWriter = new StringWriter(o_StringBuilder);
                        HtmlTextWriter o_HtmlTextWriter = new HtmlTextWriter(o_StringWriter);
                        o_HyperLink.RenderControl(o_HtmlTextWriter);

                        News_ClassID_1_Controls.InnerHtml += "<li>" + o_StringBuilder.ToString() + "&nbsp;&nbsp;" + o_News.News_AddTime.ToShortDateString() + "</li>";
                    }
                }
                else
                    News_ClassID_1_More.Visible = false;

                e_News = b_News.Select_News(2, g_LanguageID, 5, 1);
                if (e_News != null)
                {
                    foreach (Entity.News o_News in e_News)
                    {
                        HyperLink o_HyperLink = new HyperLink();
                        o_HyperLink.NavigateUrl = "News_Detail.aspx?News_ID=" + o_News.News_ID.ToString();

                        if (o_News.News_Title.Length > 24)
                            o_HyperLink.Text = o_News.News_Title.Substring(0, 24);
                        else
                            o_HyperLink.Text = o_News.News_Title;

                        o_HyperLink.CssClass = "nav9";

                        StringBuilder o_StringBuilder = new StringBuilder();
                        StringWriter o_StringWriter = new StringWriter(o_StringBuilder);
                        HtmlTextWriter o_HtmlTextWriter = new HtmlTextWriter(o_StringWriter);
                        o_HyperLink.RenderControl(o_HtmlTextWriter);

                        News_ClassID_2_Controls.InnerHtml += "<li>" + o_StringBuilder.ToString() + "&nbsp;&nbsp;" + o_News.News_AddTime.ToShortDateString() + "</li>";
                    }
                }
                else
                    News_ClassID_2_More.Visible = false;
            }
        }
Esempio n. 32
0
        private void GetNews()
        {
            BLL.News b_News = new BLL.News();
            Entity.News[] e_News = b_News.Select_News(g_News_ClassID, Convert.ToInt32(News_LanguageID.SelectedValue), Search_Content.Text, Convert.ToInt32(Search_Method.SelectedValue), g_PageSize, g_Page);
            if (e_News != null)
            {
                int i = 1;

                foreach (Entity.News o_News in e_News)
                {
                    HtmlTableRow o_HtmlTableRow = new HtmlTableRow();
                    HtmlTableCell o_HtmlTableCell;
                    HtmlAnchor o_HtmlAnchor;
                    HtmlGenericControl o_HtmlGenericControl;

                    o_HtmlTableCell = new HtmlTableCell();
                    o_HtmlTableCell.InnerText = ((g_Page - 1) * g_PageSize + i).ToString();
                    o_HtmlTableRow.Controls.Add(o_HtmlTableCell);

                    o_HtmlTableCell = new HtmlTableCell();
                    o_HtmlTableCell.InnerText = g_Language[o_News.News_LanguageID];
                    o_HtmlTableRow.Controls.Add(o_HtmlTableCell);

                    o_HtmlTableCell = new HtmlTableCell();
                    o_HtmlTableCell.InnerText = o_News.News_Title;
                    o_HtmlTableRow.Controls.Add(o_HtmlTableCell);

                    o_HtmlTableCell = new HtmlTableCell();
                    o_HtmlTableCell.InnerText = o_News.News_AddTime.ToString();
                    o_HtmlTableRow.Controls.Add(o_HtmlTableCell);

                    o_HtmlTableCell = new HtmlTableCell();
                    o_HtmlAnchor = new HtmlAnchor();
                    o_HtmlAnchor.HRef = "#";
                    o_HtmlAnchor.Attributes.Add("onclick", "ActionSubmit(2, " + o_News.News_ID.ToString() + ", " + g_News_ClassID.ToString() + ");return false;");
                    o_HtmlAnchor.Attributes.Add("class", "AdminToolsLink2");
                    o_HtmlAnchor.InnerText = "修改";
                    o_HtmlTableCell.Controls.Add(o_HtmlAnchor);

                    o_HtmlGenericControl = new HtmlGenericControl();
                    o_HtmlGenericControl.InnerHtml = "&nbsp;&nbsp;";
                    o_HtmlTableCell.Controls.Add(o_HtmlGenericControl);

                    o_HtmlAnchor = new HtmlAnchor();
                    o_HtmlAnchor.HRef = "#";
                    o_HtmlAnchor.Attributes.Add("onclick", "ActionSubmit(3, " + o_News.News_ID.ToString() + ", " + g_News_ClassID.ToString() + ");return false;");
                    o_HtmlAnchor.Attributes.Add("class", "AdminToolsLink2");
                    o_HtmlAnchor.InnerText = "删除";
                    o_HtmlTableCell.Controls.Add(o_HtmlAnchor);
                    o_HtmlTableRow.Controls.Add(o_HtmlTableCell);

                    o_HtmlTableRow.Align = "center";
                    o_HtmlTableRow.Style.Add(HtmlTextWriterStyle.Height, "30px");

                    g_MainTable.Rows.Add(o_HtmlTableRow);

                    i++;
                }

                Current_Page.Text = g_Page.ToString();
                Total_Page.Text = b_News.g_TotalPage.ToString();
                Total_Count.Text = b_News.g_TotalCount.ToString();

                if (g_Page > 1)
                {
                    Previous_Page.Visible = true;
                    Previous_Page.CommandArgument = (g_Page - 1).ToString();
                }
                else
                {
                    Previous_Page.Visible = false;
                }

                if (g_Page < b_News.g_TotalPage)
                {
                    Next_Page.Visible = true;
                    Next_Page.CommandArgument = (g_Page + 1).ToString();
                }
                else
                {
                    Next_Page.Visible = false;
                }

                Current_Page.Visible = true;
                Splite_Page.Visible = true;
                Total_Page.Visible = true;
            }
            else
            {
                Current_Page.Visible = false;
                Splite_Page.Visible = false;
                Total_Page.Visible = false;
                Total_Count.Text = "0";
            }
        }
Esempio n. 33
0
        public void BindNewList()
        {
            string where = string.Empty;
            string queryString = string.Empty;

            string tid = Utility.Common.SqlEncode( Utility.Common.GetStringOfUrl( "tid" ) );
            if( !string.IsNullOrEmpty( tid ) )
            {
                if( !Utility.Common.IsNumber( tid ) )
                {
                    Response.Write( "�벻Ҫ�Ƿ�����" );
                    Response.End();
                }
                else
                {
                    where += " and News_Type=" + tid + " ";
                    queryString += "&tid=" + Server.UrlEncode( queryString );
                    location = "<a href=\"/NewsList.aspx\">��������</a> > " + new BLL.News().GetTypeName( tid );
                }
            }
            else
            {

                location = "��������";

            }

            int counts;
            DataTable dt = new BLL.News().PagerList_Lsl(/*WebPager1.PageSize, WebPager1.CurrentPageIndex,*/ anpPageIndex.PageSize, PageIndex, out counts, where );
            //WebPager1.ItemCount = counts;
            anpPageIndex.CurrentPageIndex = PageIndex;
            anpPageIndex.RecordCount = counts;
            //WebPager1.UrlQueryString = queryString;
            rpNewsList.DataSource = dt.DefaultView;
            rpNewsList.DataBind();
        }