Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtLocalTagID.Text))
            {
                strErr+="LocalTagID格式错误!\\n";
            }
            if(this.txtTagName.Text.Trim().Length==0)
            {
                strErr+="TagName不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int LocalTagID=int.Parse(this.txtLocalTagID.Text);
            string TagName=this.txtTagName.Text;

            Maticsoft.Model.CityLocalTag model=new Maticsoft.Model.CityLocalTag();
            model.LocalTagID=LocalTagID;
            model.TagName=TagName;

            Maticsoft.BLL.CityLocalTag bll=new Maticsoft.BLL.CityLocalTag();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Пример #2
0
        /// <summary>
        /// 商家详细商家列表页
        /// </summary>
        /// <param name="pageUrl"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        private bool InsretCityLocalTag(string pageUrl, int index)
        {
            var htmlWeb = new HtmlWeb();
            var htmlDoc = htmlWeb.Load(pageUrl);
            var list =
                htmlDoc.DocumentNode.SelectNodes(
                    ".//div[@class='constr pt10']/div[@class='constr_in']/a[@class='g3']");

            var cityLocalTagBll = new CityLocalTag();
            if (list == null)
            {
                return false;
            };
            var htmlNode = list.First();
            if (htmlNode == null)
            {
                return false;
            }
            if (cityLocalTagBll.Exists(index.ToString()))
            {
                return false;
            }
            var cityLocalTag = new Maticsoft.Model.CityLocalTag
                               {
                                   TagName = htmlNode.InnerText,
                                   LocalTagID = index.ToString()
                               };

            cityLocalTagBll.Add(cityLocalTag);
            return true;
        }