Esempio n. 1
0
        /// <summary>
        /// 模板
        /// </summary>
        /// <param name="N"></param>
        /// <returns></returns>
        public string GetXML_MODEL(int N)
        {
            NewsMsgData CMsgData = new NewsMsgData();
            for (int i = 0; i < N; i++)
            {
                NewsItem cN = new NewsItem();
                cN.Title = "项目 " + i.ToString() + " 标题";
                cN.Description = "项目 " + i.ToString() + " 具体内容描述";
                cN.PicUrl = "http://xxxx.com/img/a.jpg ";
                cN.Url = "http://xxxx.com/img/a.aspx";

                CMsgData.Items.Add(cN);
            }
            return CMsgData.Getdata();
        }
Esempio n. 2
0
        protected void Button23_Click(object sender, EventArgs e)
        {
            for (int j = 0; j < 10000; j++)
            {
                string Name = "新图文消息" + j.ToString("D2");
                bool IsOK=true ;

                string PathFile = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\NEWS\\page"+j.ToString()+".htm" );

                if (System.IO.File.Exists(PathFile) == true)
                {
                    IsOK = false;
                }
                else
                {
                    for (int i = 0; i < TreeView1.Nodes.Count; i++)
                    {
                        //节点名称  已经存在 或者 文件名已经存在
                        if (TreeView1.Nodes[i].Text == Name)
                        {
                            IsOK = false; break;
                        }
                    }
                }

                if (IsOK == true)
                {
                    string filename ="page"+   j.ToString() + ".htm";  //自动生产一个文件名

                    TreeView1.Nodes.Add(new TreeNode(Name));

                    Label2.Text = Name;

                    TextBoxTitle.Text =Name;
                    txt0.Text ="";
                    TextBoxUrl.Text = filename;
                    TextBoxEDIT.Text = "内容描述";

                    NewsItem myItem = new NewsItem();
                    myItem.Title = Name;
                    myItem.PicUrl ="";
                    myItem.Url = filename;
                    myItem.Description = "内容描述";

                    NewsMsgData CMsgData = new NewsMsgData();
                    CMsgData.LoadSet(WeTextBoxOne.Text);

                    CMsgData.Items.Add(myItem);
                    WeTextBoxOne.Text = CMsgData.Getdata();

                    return;
                }

            }
        }
Esempio n. 3
0
        protected void Button21_Click(object sender, EventArgs e)
        {
            if (Label2.Text == "")
                return;

            NewsItem myItem = new NewsItem();
             myItem.Title =  TextBoxTitle.Text ;
             myItem.PicUrl= txt0.Text  ;
             myItem.Url=TextBoxUrl.Text  ;

             string PathFile = System.IO.Path.Combine(Server.MapPath("~"),"USER_DIR\\SYSUSER\\NEWS\\"+ myItem.Url);
             System.IO.File.WriteAllText(PathFile, TextBoxEDIT.Text, System.Text.Encoding.UTF8);

             myItem.Description = "";//

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    CMsgData.Items[i] = myItem;
                    break;
                }
            }

            WeTextBoxOne.Text = CMsgData.Getdata();

            TreeView1.Nodes.Clear();

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title));
            }
            TextBoxTitle.Text = "";
            txt0.Text = "";
            TextBoxUrl.Text = "";
            TextBoxEDIT.Text = "";
            Label2.Text = "";

            Button24_Click(null, null);
        }
        protected void Button23_Click(object sender, EventArgs e)
        {
            if (TreeView1.Nodes.Count >= 10)
                return;

            for (int j = 0; j < 100; j++)
            {
                string Name = "新图文消息" + j.ToString("D2");
                bool IsOK=true ;
                for(int i=0;i<TreeView1.Nodes.Count;i++)
                {
                    if (TreeView1.Nodes[i].Text == Name)
                    {
                        IsOK = false; break;
                    }
                }

                if (IsOK == true)
                {
                    TreeView1.Nodes.Add(new TreeNode(Name));

                    Label2.Text = Name;

                    TextBoxTitle.Text =Name;
                    txt0.Text ="";
                    TextBoxUrl.Text ="";
                    TextBoxEDIT.Text = "内容描述";

                    NewsItem myItem = new NewsItem();
                    myItem.Title = Name;
                    myItem.PicUrl ="";
                    myItem.Url = "";
                    myItem.Description = "内容描述";

                    NewsMsgData CMsgData = new NewsMsgData();
                    CMsgData.LoadSet(WeTextBoxOne.Text);

                    CMsgData.Items.Add(myItem);
                    WeTextBoxOne.Text = CMsgData.Getdata();

                    Image1.ImageUrl = "";

                    return;
                }

            }
        }
        protected void Button21_Click(object sender, EventArgs e)
        {
            NewsItem myItem = new NewsItem();
             myItem.Title =  TextBoxTitle.Text ;
             myItem.PicUrl= txt0.Text  ;
             myItem.Url=TextBoxUrl.Text  ;
             myItem.Description= TextBoxEDIT.Text ;

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            bool IsSave = false;
            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    CMsgData.Items[i] = myItem;
                    IsSave = true;
                    break;
                }
            }

            if (IsSave == false)
                CMsgData.Items.Add(myItem);

            TreeView1.Nodes.Clear();

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title));
            }
            TextBoxTitle.Text = "";
            txt0.Text = "";
            TextBoxUrl.Text = "";
            TextBoxEDIT.Text = "";
            Label2.Text = "";

            WeTextBoxOne.Text = CMsgData.Getdata();
            Image1.ImageUrl = "";

            Button24_Click(null ,null );
        }
Esempio n. 6
0
        /// <summary>
        ///  从字符串读取 结构体
        /// </summary>
        /// <param name="dat"></param>
        public bool LoadSet(string dat)
        {
            Items.Clear();
            //解析

            XmlDocument xmlDoc = new XmlDocument();
            try
            {
                xmlDoc.LoadXml(dat);
                XmlNodeList xnList = xmlDoc.SelectNodes("//NewsMsgData");
                foreach (XmlNode xn in xnList)
                {
                    NewsItem item = new NewsItem();
                    item.Title = (xn.SelectSingleNode("Title")).InnerXml.Replace("<![CDATA[", "").Replace("]]>", "");
                    item.Description = (xn.SelectSingleNode("Description")).InnerXml.Replace("<![CDATA[", "").Replace("]]>", "");

                    item.PicUrl = (xn.SelectSingleNode("PicUrl")).InnerXml.Replace("<![CDATA[", "").Replace("]]>", "");

                    item.Url = (xn.SelectSingleNode("Url")).InnerXml.Replace("<![CDATA[", "").Replace("]]>", "");

                    Items.Add(item);
                }
            }
            catch
            {
                return false;
            }

            return true;
        }
        protected void Button24_Click(object sender, EventArgs e)
        {
            if (WeTextBoxFive.Text.Trim() == "")
            {
                Label1.Text = "请输入关键字"; return;
            }

            NewsItem myItem = new NewsItem();
            myItem.Title = TextBoxTitle.Text;
            myItem.PicUrl = txt0.Text;
            myItem.Url = TextBoxUrl.Text;
            myItem.Description = TextBoxEDIT.Text;

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            bool IsSave = false;
            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                CMsgData.Items[i] = myItem;
                IsSave = true;
                break;

            }

            if (IsSave == false)
                CMsgData.Items.Add(myItem);

            WeTextBoxOne.Text = CMsgData.Getdata();

            try
            {
                long nX = (int)(double.Parse(WeTextBoxFive.Text) * 100000);
                long nY = (int)(double.Parse(WeTextBoxSix.Text) * 100000);

                string NAME2 = nX.ToString() + "_" + nY.ToString();   //模糊地址

                //long nX1 = (int)(double.Parse(WeTextBoxFive.Text) * 10000000);
                //long nY1 = (int)(double.Parse(WeTextBoxSix.Text) * 10000000);

                string NAME1 = WeTextBoxFive.Text.Replace(".", "V") + "_" + WeTextBoxSix.Text.Replace(".", "V"); //高精度地址

                string PathFile1 = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NAME1 + ".dll"); //图文 关键词回复目录);
                File.WriteAllText(PathFile1, WeTextBoxOne.Text, System.Text.Encoding.UTF8);

                string PathFile2 = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location2\\" + NAME2 + ".dll"); //图文 关键词回复目录);
                File.WriteAllText(PathFile2, WeTextBoxOne.Text, System.Text.Encoding.UTF8);

                FileManager1.Visible = true;
                TextEditor.Visible = false;
                Label1.Text = "保存成功!";

                FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Details;

            }
            catch
            {
                Label1.Text = "保存失败,关键字中不能有特殊字符";
            }
        }