Пример #1
0
        private static M_CreateJS GetInfoFromReader(SqlDataReader rdr)
        {
            M_CreateJS info = new M_CreateJS();

            info.id           = DataConverter.CLng(rdr["id"].ToString());
            info.Jsname       = rdr["Jsname"].ToString();
            info.JsReadme     = rdr["JsReadme"].ToString();
            info.ContentType  = DataConverter.CLng(rdr["ContentType"].ToString());
            info.JsFileName   = rdr["JsFileName"].ToString();
            info.JsType       = DataConverter.CLng(rdr["JsType"].ToString());
            info.JsXmlContent = rdr["JsXmlContent"].ToString();
            rdr.Close();
            rdr.Dispose();
            return(info);
        }
Пример #2
0
        /// <summary>
        /// 系统页面载入时间
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ContentManage.aspx'>内容管理</a></li><li><a  href=\"CreateHtmlContent.aspx\">生成管理</a></li><li class=\"active\">添加新JS</li>");
            int        id    = DataConverter.CLng(Request.QueryString["id"]);
            M_CreateJS jinfo = Jll.GetSelect(id);

            if (jinfo.id > 0)
            {
                if (jinfo.JsType != 1)
                {
                    function.WriteErrMsg("JS信息分类读取错误!");
                }
            }

            if (!IsPostBack)
            {
                ReadNodeList();
                ListItem itemdd = new ListItem();
                itemdd.Value = "";
                itemdd.Text  = "所有栏目";
                this.ClassID.Items.Insert(0, itemdd);
                ReadSpecInfo();
                if (jinfo.id > 0)
                {
                    this.JsFileName.Text = jinfo.JsFileName;
                    this.Jsname.Text     = jinfo.Jsname;
                    this.JsReadme.Text   = jinfo.JsReadme;
                    this.JsFileName.Text = jinfo.JsFileName;
                    string jsxml = jinfo.JsXmlContent;
                    ContentType_Rad.SelectedIndex = jinfo.ContentType;
                    XmlDocument xmldoc = new XmlDocument();
                    jsxml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><doc>" + jsxml + "</doc>";
                    xmldoc.LoadXml(jsxml);
                    PageInit(xmldoc);
                    JSID_Hid.Value     = jinfo.id.ToString();
                    this.TxtTitle.Text = "编辑JS文件(图片列表方式)";
                }
                else
                {
                    this.TxtTitle.Text = "添加新的JS文件(图片列表方式)";
                    Save_Btn.Text      = "添加";
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 添加按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            M_CreateJS Mjs = new M_CreateJS();

            Mjs.JsFileName  = this.JsFileName.Text;
            Mjs.Jsname      = this.Jsname.Text;
            Mjs.JsReadme    = this.JsReadme.Text;
            Mjs.JsFileName  = this.JsFileName.Text;
            Mjs.ContentType = ContentType_Rad.SelectedIndex;
            Mjs.JsType      = 1;

            StringBuilder xmlcontent = new StringBuilder();

            xmlcontent.AppendLine("<ClassID>" + this.ClassID.Text + "</ClassID>");
            xmlcontent.AppendLine("<IncludeChild>" + (this.IncludeChild.Checked ? "1" : "0") + "</IncludeChild>");
            xmlcontent.AppendLine("<ArticleNum>" + ArticleNum.Text + "</ArticleNum>");
            xmlcontent.AppendLine("<ContentProperty>" + ContentProperty.SelectedValue + "</ContentProperty>");
            xmlcontent.AppendLine("<DateNum>" + DateNum.Text + "</DateNum>");
            xmlcontent.AppendLine("<OrderType>" + OrderType.SelectedValue + "</OrderType>");
            xmlcontent.AppendLine("<ShowType>" + ShowType.SelectedValue + "</ShowType>");
            xmlcontent.AppendLine("<ImgWidth>" + ImgWidth.Text + "</ImgWidth>");
            xmlcontent.AppendLine("<ImgHeight>" + ImgHeight.Text + "</ImgHeight>");
            xmlcontent.AppendLine("<TitleLen>" + TitleLen.Text + "</TitleLen>");
            xmlcontent.AppendLine("<ContentLen>" + ContentLen.Text + "</ContentLen>");
            xmlcontent.AppendLine("<ShowTips>" + (ShowTips.Checked ? "1" : "0") + "</ShowTips>");
            xmlcontent.AppendLine("<Cols>" + Cols.SelectedValue + "</Cols>");
            xmlcontent.AppendLine("<UrlType>" + UrlType.SelectedValue + "</UrlType>");
            Mjs.JsXmlContent = xmlcontent.ToString();

            DataTable ContentList = Getlist();
            string    picPath     = ""; //图片路径
            int       Colsnum     = 0;  //列数

            if (DataConverter.CLng(Cols.Text) > 0)
            {
                Colsnum = DataConverter.CLng(Cols.Text);
            } //每行显示文章数

            string        txt_ShowType = ShowType.SelectedValue;
            StringBuilder jscontent    = new StringBuilder();
            int           ContentNum   = 0;

            if (Colsnum > 0)
            {
                ContentNum = ContentList.Rows.Count / Colsnum;
            }
            float ContentMod = 0;

            if (Colsnum > 0)
            {
                ContentMod = ContentList.Rows.Count % Colsnum;
            }

            int ReadCst = ContentList.Rows.Count - (int)ContentMod;

            switch (ShowType.SelectedValue)
            {
            case "1":       //图片+标题:上下排列

                #region 图片+标题:上下排列
                jscontent.AppendLine("");
                jscontent.AppendLine("<table>");

                for (int c = 0; c < ContentNum; c++)
                {
                    jscontent.AppendLine("<tr>");

                    for (int i = 0; i < Colsnum; i++)
                    {
                        string title       = "";
                        string c_ClassName = "";
                        //string c_Author = "";
                        //string c_Hits = "";
                        string c_HotSign = "";
                        //string c_Tips = "";
                        string c_CommentLink = "";
                        string c_OpenType    = "";

                        if (this.ShowTips.Checked)      //显示内容
                        {
                            //ShowClassName 所属栏目
                            int NodeID = DataConverter.CLng(ContentList.Rows[i]["NodeID"]);

                            if (Nll.GetNodeXML(NodeID).NodeName != "" && Nll.GetNodeXML(NodeID).NodeName != null)
                            {
                                c_ClassName = "[" + Nll.GetNodeXML(NodeID).NodeName + "]";
                            }

                            title  = "作者:" + ContentList.Rows[i]["Inputer"].ToString() + "&#13;"; //作者
                            title += "点击数:" + ContentList.Rows[i]["Hits"].ToString() + "&#13;";   //点击数
                                                                                                  //热门文章标志
                            if (DataConverter.CLng(ContentList.Rows[i]["Hits"]) > 20)             //文章大于20则为热门
                            {
                                c_HotSign = "<img src='/Images/Article/hot.gif' alt='固顶文章'>";
                            }
                            //显示评论链接
                            c_CommentLink = " <a href ='" + GetUrl("0") + "/Comments/CommentFor.aspx?ID=" + ContentList.Rows[c * Colsnum + i]["GeneralID"].ToString() + "'>[评论信息]</a>";
                            //显示提示信息
                            title += "文章标题:" + ContentList.Rows[i]["Title"].ToString() + "&#13;";
                            //更新时间
                            DateTime UpDateTime = DataConverter.CDate(ContentList.Rows[c + i]["UpDateTime"]);
                            string   showtime   = UpDateTime.ToString();
                            title  += "更新时间:" + showtime + "&#13;";
                            picPath = GetPicPathByModelID(DataConverter.CLng(ContentList.Rows[c + i]["ModelID"]), DataConverter.CLng(ContentList.Rows[c + i]["ItemID"]));
                        }
                        else
                        {
                            c_ClassName = "";
                        }
                        jscontent.AppendLine("<td>");
                        jscontent.AppendLine("<img title='" + title + "' " + " src='" + GetUrl(UrlType.SelectedValue) + "/UploadFiles" + picPath + "' width='" + ImgWidth.Text + "' height='" + ImgHeight.Text + "' /> <br/>");
                        jscontent.AppendLine("<a title='" + title + "' " + c_OpenType + " href='" + GetUrl(UrlType.SelectedValue) + "/Content.aspx?ItemID=" + ContentList.Rows[c * Colsnum + i]["GeneralID"].ToString() + "'>" + BaseClass.Left(c_ClassName + ContentList.Rows[c * Colsnum + i]["title"].ToString(), DataConverter.CLng(TitleLen.Text)) + "</a>" + c_HotSign + c_CommentLink);
                        jscontent.AppendLine("</td>");
                    }
                    jscontent.AppendLine("</tr>");
                }


                if ((int)ContentMod > 0)
                {
                    jscontent.AppendLine("<tr>");
                    for (int p = 0; p < (int)ContentMod; p++)
                    {
                        string title       = "";
                        string c_HotSign   = "";
                        string c_ClassName = "";
                        //string c_Author = "";
                        //string c_Hits = "";
                        //string c_Tips = "";
                        string c_CommentLink = "";
                        //string c_OpenType = "";

                        if (this.ShowTips.Checked)      //显示内容
                        {
                            //ShowClassName 所属栏目
                            int NodeID = DataConverter.CLng(ContentList.Rows[ReadCst + p]["NodeID"]);

                            if (Nll.GetNodeXML(NodeID).NodeName != "" && Nll.GetNodeXML(NodeID).NodeName != null)
                            {
                                c_ClassName = "[" + Nll.GetNodeXML(NodeID).NodeName + "]";
                            }

                            title  = "作者:" + ContentList.Rows[ReadCst + p]["Inputer"].ToString() + "&#13;"; //作者
                            title += "点击数:" + ContentList.Rows[ReadCst + p]["Hits"].ToString() + "&#13;";   //点击数
                                                                                                            //热门文章标志
                            if (DataConverter.CLng(ContentList.Rows[ReadCst + p]["Hits"]) > 20)             //文章大于20则为热门
                            {
                                c_HotSign = "<img src='/Images/Article/hot.gif' alt='固顶文章'>";
                            }
                            //显示评论链接
                            c_CommentLink = " <a href ='" + GetUrl("0") + "/Comments/CommentFor.aspx?ID=" + ContentList.Rows[ReadCst + p]["GeneralID"].ToString() + "'>[评论信息]</a>";
                            //显示提示信息
                            title += "文章标题:" + ContentList.Rows[ReadCst + p]["Title"].ToString() + "&#13;";
                            //更新时间
                            DateTime UpDateTime = DataConverter.CDate(ContentList.Rows[ReadCst + p]["UpDateTime"]);
                            string   showtime   = UpDateTime.ToString();
                            title += "更新时间:" + showtime + "&#13;";
                        }
                        else
                        {
                            c_ClassName = "";
                        }
                        jscontent.AppendLine("<td>");
                        picPath = GetPicPathByModelID(DataConverter.CLng(ContentList.Rows[ReadCst + p]["ModelID"]), DataConverter.CLng(ContentList.Rows[ReadCst + p]["ItemID"]));
                        jscontent.AppendLine("<img title='" + title + "' " + " src='" + GetUrl(UrlType.SelectedValue) + "/UploadFiles" + picPath + "' width='" + ImgWidth.Text + "' height='" + ImgHeight.Text + "' /><br/>");
                        jscontent.AppendLine("<a title='" + title + "' " + " href='" + GetUrl(UrlType.SelectedValue) + "/Content.aspx?ItemID=" + ContentList.Rows[ReadCst + p]["GeneralID"].ToString() + "'>" + c_ClassName + BaseClass.Left(ContentList.Rows[ReadCst + p]["title"].ToString(), DataConverter.CLng(TitleLen.Text)) + "</a>" + c_HotSign + c_CommentLink);
                        jscontent.AppendLine("</td>");
                    }

                    int Ccount = Colsnum - (int)ContentMod;
                    jscontent.AppendLine("</tr>");
                }
                jscontent.AppendLine("</table>");

                #endregion
                break;

            case "2":       //图片+标题:左右排列

                #region 图片+标题:左右排列
                jscontent.AppendLine("");
                jscontent.AppendLine("<table>");

                for (int c = 0; c < ContentNum; c++)
                {
                    jscontent.AppendLine("<tr>");

                    for (int i = 0; i < Colsnum; i++)
                    {
                        string title       = "";
                        string c_ClassName = "";
                        //string c_Author = "";
                        //string c_Hits = "";
                        string c_HotSign = "";
                        //string c_Tips = "";
                        string c_CommentLink = "";
                        string c_OpenType    = "";

                        if (this.ShowTips.Checked)      //显示内容
                        {
                            //ShowClassName 所属栏目
                            int NodeID = DataConverter.CLng(ContentList.Rows[i]["NodeID"]);

                            if (Nll.GetNodeXML(NodeID).NodeName != "" && Nll.GetNodeXML(NodeID).NodeName != null)
                            {
                                c_ClassName = "[" + Nll.GetNodeXML(NodeID).NodeName + "]";
                            }

                            title += "作者:" + ContentList.Rows[i]["Inputer"].ToString() + "&#13;"; //作者
                            title += "点击数:" + ContentList.Rows[i]["Hits"].ToString() + "&#13;";   //点击数
                                                                                                  //热门文章标志
                            if (DataConverter.CLng(ContentList.Rows[i]["Hits"]) > 20)             //文章大于20则为热门
                            {
                                c_HotSign = "<img src='/Images/Article/hot.gif' alt='固顶文章'>";
                            }
                            //显示评论链接
                            c_CommentLink = " <a href ='" + GetUrl("0") + "/Comments/CommentFor.aspx?ID=" + ContentList.Rows[c * Colsnum + i]["GeneralID"].ToString() + "'>[评论信息]</a>";
                            //显示提示信息
                            title += "文章标题:" + ContentList.Rows[i]["Title"].ToString() + "&#13;";
                            //更新时间
                            DateTime UpDateTime = DataConverter.CDate(ContentList.Rows[c + i]["UpDateTime"]);
                            string   showtime   = UpDateTime.ToString();
                            title  += "更新时间:" + showtime + "&#13;";
                            picPath = GetPicPathByModelID(DataConverter.CLng(ContentList.Rows[c + i]["ModelID"]), DataConverter.CLng(ContentList.Rows[c + i]["ItemID"]));
                        }
                        else
                        {
                            c_ClassName = "";
                        }
                        jscontent.AppendLine("<td><img title='" + title + "' " + " src='" + GetUrl(UrlType.SelectedValue) + "/UploadFiles" + picPath + "' width='" + ImgWidth.Text + "' height='" + ImgHeight.Text + "' /></td>");
                        jscontent.AppendLine("<td>");
                        jscontent.AppendLine("<a title='" + title + "' " + c_OpenType + " href='" + GetUrl(UrlType.SelectedValue) + "/Content.aspx?ItemID=" + ContentList.Rows[c * Colsnum + i]["GeneralID"].ToString() + "'>" + BaseClass.Left(c_ClassName + ContentList.Rows[c * Colsnum + i]["title"].ToString(), DataConverter.CLng(TitleLen.Text)) + "</a>" + c_HotSign + c_CommentLink);
                        jscontent.AppendLine("</td>");
                    }
                    jscontent.AppendLine("</tr>");
                }


                if ((int)ContentMod > 0)
                {
                    jscontent.AppendLine("<tr>");
                    for (int p = 0; p < (int)ContentMod; p++)
                    {
                        string title       = "";
                        string c_HotSign   = "";
                        string c_ClassName = "";
                        //string c_Author = "";
                        //string c_Hits = "";
                        //string c_Tips = "";
                        string c_CommentLink = "";
                        //string c_OpenType = "";

                        if (this.ShowTips.Checked)      //显示内容
                        {
                            //ShowClassName 所属栏目
                            int NodeID = DataConverter.CLng(ContentList.Rows[ReadCst + p]["NodeID"]);

                            if (Nll.GetNodeXML(NodeID).NodeName != "" && Nll.GetNodeXML(NodeID).NodeName != null)
                            {
                                c_ClassName = "[" + Nll.GetNodeXML(NodeID).NodeName + "]";
                            }

                            title += "作者:" + ContentList.Rows[ReadCst + p]["Inputer"].ToString() + "&#13;"; //作者
                            title += "点击数:" + ContentList.Rows[ReadCst + p]["Hits"].ToString() + "&#13;";   //点击数
                                                                                                            //热门文章标志
                            if (DataConverter.CLng(ContentList.Rows[ReadCst + p]["Hits"]) > 20)             //文章大于20则为热门
                            {
                                c_HotSign = "<img src='/Images/Article/hot.gif' alt='固顶文章'>";
                            }
                            //显示评论链接
                            c_CommentLink = " <a href ='" + GetUrl("0") + "/Comments/CommentFor.aspx?ID=" + ContentList.Rows[ReadCst + p]["GeneralID"].ToString() + "'>[评论信息]</a>";
                            //显示提示信息
                            title += "文章标题:" + ContentList.Rows[ReadCst + p]["Title"].ToString() + "&#13;";
                            //更新时间
                            DateTime UpDateTime = DataConverter.CDate(ContentList.Rows[ReadCst + p]["UpDateTime"]);
                            string   showtime   = UpDateTime.ToString();
                            title += "更新时间:" + showtime + "&#13;";
                        }
                        else
                        {
                            c_ClassName = "";
                        }

                        jscontent.AppendLine("<td>");
                        picPath = GetPicPathByModelID(DataConverter.CLng(ContentList.Rows[ReadCst + p]["ModelID"]), DataConverter.CLng(ContentList.Rows[ReadCst + p]["ItemID"]));
                        jscontent.AppendLine("<img title='" + title + "' " + " src='" + GetUrl(UrlType.SelectedValue) + "/UploadFiles" + picPath + "' width='" + ImgWidth.Text + "' height='" + ImgHeight.Text + "' /><br/>");
                        jscontent.AppendLine("<a title='" + title + "' " + " href='" + GetUrl(UrlType.SelectedValue) + "/Content.aspx?ItemID=" + ContentList.Rows[ReadCst + p]["GeneralID"].ToString() + "'>" + c_ClassName + BaseClass.Left(ContentList.Rows[ReadCst + p]["title"].ToString(), DataConverter.CLng(TitleLen.Text)) + "</a>" + c_HotSign + c_CommentLink);
                        jscontent.AppendLine("</td>");
                    }

                    int Ccount = Colsnum - (int)ContentMod;
                    jscontent.AppendLine("</tr>");
                }
                jscontent.AppendLine("</table>");

                #endregion
                break;
            }

            if (ContentType_Rad.SelectedValue == "JS")
            {
                FileSystemObject.WriteFile(Server.MapPath("/JS/Ads/JS/" + this.JsFileName.Text), ConvertJs(jscontent.ToString()));
            }
            else
            {
                FileSystemObject.WriteFile(Server.MapPath("/JS/Ads/HTML/" + this.JsFileName.Text), "<html><head></head><body>" + jscontent.ToString() + "</body></html>");
            }

            if (!string.IsNullOrEmpty(JSID_Hid.Value))
            {
                Mjs.id = DataConverter.CLng(JSID_Hid.Value);
                Jll.GetUpdate(Mjs);
                function.WriteSuccessMsg("修改成功!", "ManageJsContent.aspx");
            }
            else
            {
                Jll.GetInsert(Mjs);
                function.WriteSuccessMsg("添加成功!", "ManageJsContent.aspx");
            }
        }
Пример #4
0
 /// <summary>
 ///更新记录
 /// </summary>
 /// <param name="CreateJS"></param>
 /// <returns></returns>
 public bool GetUpdate(M_CreateJS model)
 {
     return(DBCenter.UpdateByID(model, model.id));
 }
Пример #5
0
 /// <summary>
 ///添加记录
 /// </summary>
 /// <param name="CreateJS"></param>
 /// <returns></returns>
 public int GetInsert(M_CreateJS model)
 {
     return(DBCenter.Insert(model));
 }