예제 #1
0
        public int SavetoDb(string url)
        {
            ecar_content model  = new ecar_content();
            string       source = HtmlHandle.HtmlCode(url);
            string       data   = source.Replace("\n", "").Replace(" ", "").Replace("\r", "");

            #region//绑定数据
            model.title = title.Match(data).Groups[1].Value;
            if (model.title == "")
            {
                model.title = "微口碑";
            }
            model.url         = url;
            model.type        = type.Match(data).Groups[1].Value;
            model.car         = car.Match(data).Groups[1].Value;
            model.malladdr    = address.Match(data).Groups[1].Value;
            model.buydata     = buydate.Match(data).Groups[1].Value;
            model.price       = price.Match(data).Groups[1].Value;
            model.oil         = oil.Match(data).Groups[1].Value;
            model.satisfied   = satisfied.Match(data).Groups[1].Value;
            model.unsatisfied = unsatisfied.Match(data).Groups[1].Value;
            //具体内容
            model.oil_star       = oilItem.Match(data).Groups[1].Value;
            model.oil_sum        = oilItem.Match(data).Groups[2].Value;
            model.operation_star = operationItem.Match(data).Groups[1].Value;
            model.operation      = operationItem.Match(data).Groups[2].Value;
            model.power_star     = powerItem.Match(data).Groups[1].Value;
            model.power          = powerItem.Match(data).Groups[2].Value;
            model.space_star     = spaceItem.Match(data).Groups[1].Value;
            model.space          = spaceItem.Match(data).Groups[2].Value;
            if (model.title == "微口碑")
            {
                model.synthetical_star = syntheticalItem_wkb.Match(data).Groups[1].Value;
                model.synthetical      = syntheticalItem_wkb.Match(data).Groups[2].Value;
            }
            else
            {
                model.synthetical_star = syntheticalItem.Match(data).Groups[1].Value;
                model.synthetical      = syntheticalItem.Match(data).Groups[2].Value;
            }
            model.appearance_star = appearanceItem.Match(data).Groups[1].Value;
            model.appearance      = appearanceItem.Match(data).Groups[2].Value;
            model.comfort_star    = comfortItem.Match(data).Groups[1].Value;
            model.comfort         = comfortItem.Match(data).Groups[2].Value;
            model.config_star     = configItem.Match(data).Groups[1].Value;
            model.config          = configItem.Match(data).Groups[2].Value;
            model.costperfor_star = costperforItem.Match(data).Groups[1].Value;
            model.costperfor      = costperforItem.Match(data).Groups[2].Value;
            model.inside_star     = insideItem.Match(data).Groups[1].Value;
            model.inside          = insideItem.Match(data).Groups[2].Value;
            #endregion
            return(0);//new Ecar_koubei_Dal().Save(model);//具体存储
        }
예제 #2
0
        /// <summary>
        /// 保存口碑具体数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Save(ecar_content model)
        {
            string sql = "insert into Ecar_Koubei (url,title,type,buydata,malladdr,price,oil,satisfied,unsatisfied,operation_star,operation,costperfor_star,costperfor,config_star,config,comfort_star,comfort,space_star,space,power_star,power,appearance_star,appearance,inside_star,inside,synthetical_star,synthetical,Car,oil_star,oil_sumy)values(@url,@title,@type,@buydata,@malladdr,@price,@oil,@satisfied,@unsatisfied,@operation_star,@operation,@costperfor_star,@costperfor,@config_star,@config,@comfort_star,@comfort,@space_star,@space,@power_star,@power,@appearance_star,@appearance,@inside_star,@inside,@synthetical_star,@synthetical,@Car,@oil_star,@oil_sumy);";

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@url", model.url),
                new SqlParameter("@title", model.title),
                new SqlParameter("@type", model.type),
                new SqlParameter("@buydata", model.buydata),
                new SqlParameter("@malladdr", model.malladdr),
                new SqlParameter("@price", model.price),
                new SqlParameter("@oil", model.oil),
                new SqlParameter("@satisfied", model.satisfied),
                new SqlParameter("@unsatisfied", model.unsatisfied),
                new SqlParameter("@operation_star", model.operation_star),
                new SqlParameter("@operation", model.operation),
                new SqlParameter("@costperfor_star", model.costperfor_star),
                new SqlParameter("@costperfor", model.costperfor),
                new SqlParameter("@config_star", model.config_star),
                new SqlParameter("@config", model.config),
                new SqlParameter("@comfort_star", model.comfort_star),
                new SqlParameter("@comfort", model.comfort),
                new SqlParameter("@space_star", model.space_star),
                new SqlParameter("@space", model.space),
                new SqlParameter("@power_star", model.power_star),
                new SqlParameter("@power", model.power),
                new SqlParameter("@appearance_star", model.appearance_star),
                new SqlParameter("@appearance", model.appearance),
                new SqlParameter("@inside_star", model.inside_star),
                new SqlParameter("@inside", model.inside),
                new SqlParameter("@synthetical_star", model.synthetical_star),
                new SqlParameter("@synthetical", model.synthetical),
                new SqlParameter("@Car", model.car),
                new SqlParameter("@oil_star", model.oil_star),
                new SqlParameter("@oil_sumy", model.oil_sum)
            };
            return(BLL.ExecuteNonQuery(sql, pars));
        }
예제 #3
0
        private string GetList(string url)
        {
            #region//具体业务代码
            string showdata = "";
            string source   = HtmlHandle.HtmlCode(url);
            if (source != "")
            {
                string data = source.Replace("\n", "").Replace(" ", "").Replace("\r", "");

                ecar_content model = new ecar_content();
                #region//model赋值
                model.url               = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(url));
                model.title             = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(title));
                model.car               = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(car));
                model.type              = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(type));
                model.buydata           = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(buydata));
                model.malladdr          = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(malladdr));//购车地址
                model.price             = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(price));
                model.oil               = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(oil));
                model.oil_sum           = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(oil_sum));    //
                model.operation         = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(operation));  //操控
                model.costperfor        = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(costperfor)); //性价比
                model.config            = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(config));
                model.comfort           = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(comfort));    //舒适度
                model.space             = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(space));      //
                model.power             = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(power));      //
                model.appearance        = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(appearance));
                model.inside            = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(inside));
                model.synthetical       = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(synthetical));     //综合
                model.wsynthetical      = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(wsynthetical));    //综合
                model.oil_star          = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(oil_star));
                model.operation_star    = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(operation_star));  //操控
                model.costperfor_star   = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(costperfor_star)); //性价比
                model.config_star       = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(config_star));
                model.comfort_star      = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(comfort_star));    //舒适度
                model.space_star        = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(space_star));      //
                model.power_star        = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(power_star));      //
                model.appearance_star   = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(appearance_star));
                model.inside_star       = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(inside_star));
                model.synthetical_star  = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(synthetical_star));  //综合
                model.wsynthetical_star = RegexBLL.One_Match(data, RegexBLL.GenerateRegex(wsynthetical_star)); //综合
                #endregion

                #region//数据展示
                showdata = "链接:" + model.url + "<br/>" +
                           "标题:" + model.title + "<br/>" +
                           "车型:" + model.car + "<br/>" +
                           "类型:" + model.type + "<br/>" +
                           "购车日期:" + model.buydata + "<br/>" +
                           "购车地址:" + model.malladdr + "<br/>" +//购车地址
                           "购车价格:" + model.price + "<br/>" +
                           "油耗:" + model.oil + "<br/>" +

                           "油耗评价:" + model.oil_sum + "<br/>" +     //
                           "油耗评分:" + model.operation + "<br/>" +   //操控
                           "性价比评价:" + model.costperfor + "<br/>" + //性价比
                           "配置评价:" + model.config + "<br/>" +
                           "舒适度评价:" + model.comfort + "<br/>" +    //舒适度
                           "空间评价:" + model.space + "<br/>" +       //
                           "动力评价:" + model.power + "<br/>" +       //
                           "外观评价:" + model.appearance + "<br/>" +
                           "内饰评价:" + model.inside + "<br/>" +
                           "综合评价:" + model.synthetical + "<br/>" +      //综合
                           "微口碑评价:" + model.wsynthetical + "<br/>" +    //综合
                           "油耗评分:" + model.oil_star + "<br/>" +
                           "操控评分:" + model.operation_star + "<br/>" +   //操控
                           "性价比评分:" + model.costperfor_star + "<br/>" + //性价比
                           "配置评分:" + model.config_star + "<br/>" +
                           "舒适度评分:" + model.comfort_star + "<br/>" +    //舒适度
                           "空间评分:" + model.space_star + "<br/>" +       //
                           "动力评分:" + model.power_star + "<br/>" +       //
                           "外观评分:" + model.appearance_star + "<br/>" +
                           "内饰评分:" + model.inside_star + "<br/>" +
                           "综合评分:" + model.synthetical_star + "<br/>" +//综合
                           "微口碑评分:" + model.wsynthetical_star + "<br/>";
                #endregion
            }
            #endregion
            return(showdata);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["url"] != "")
            {
                url = Request["url"].Trim().ToString();
            }
            string source = HtmlHandle.HtmlCode(url);

            if (source != "")
            {
                string       data  = source.Replace("\n", "").Replace(" ", "").Replace("\r", "");
                ecar_content model = new ecar_content();
                model.car         = BLL.One_Match(data, Rule.car);
                model.title       = BLL.One_Match(data, Rule.title);
                model.type        = BLL.One_Match(data, Rule.type);
                model.malladdr    = BLL.One_Match(data, Rule.address);
                model.buydata     = BLL.One_Match(data, Rule.buydate);
                model.price       = BLL.One_Match(data, Rule.price);
                model.oil         = BLL.One_Match(data, Rule.oil);
                model.satisfied   = BLL.One_Match(data, Rule.satisfied);
                model.unsatisfied = BLL.One_Match(data, Rule.unsatisfied);

                MatchCollection oilItem = BLL.Matchs(data, Rule.oilItem);
                foreach (Match m in oilItem)
                {
                    model.oil_star = m.Groups[1].Value;
                    model.oil_sum  = m.Groups[2].Value;
                }
                MatchCollection operationItem = BLL.Matchs(data, Rule.operationItem);
                foreach (Match m in operationItem)
                {
                    model.operation_star = m.Groups[1].Value;
                    model.operation      = m.Groups[2].Value;
                }
                MatchCollection costperforItem = BLL.Matchs(data, Rule.costperforItem);
                foreach (Match m in costperforItem)
                {
                    model.costperfor_star = m.Groups[1].Value;
                    model.costperfor      = m.Groups[2].Value;
                }
                MatchCollection configItem = BLL.Matchs(data, Rule.configItem);
                foreach (Match m in configItem)
                {
                    model.config      = m.Groups[1].Value;
                    model.config_star = m.Groups[2].Value;
                }
                MatchCollection comfortItem = BLL.Matchs(data, Rule.comfortItem);
                foreach (Match m in comfortItem)
                {
                    model.comfort      = m.Groups[1].Value;
                    model.comfort_star = m.Groups[2].Value;
                }
                MatchCollection spaceItem = BLL.Matchs(data, Rule.spaceItem);
                foreach (Match m in spaceItem)
                {
                    model.space_star = m.Groups[1].Value;
                    model.space      = m.Groups[2].Value;
                }
                MatchCollection powerItem = BLL.Matchs(data, Rule.powerItem);
                foreach (Match m in powerItem)
                {
                    model.operation_star = m.Groups[1].Value;
                    model.operation      = m.Groups[2].Value;
                }
                MatchCollection appearanceItem = BLL.Matchs(data, Rule.appearanceItem);
                foreach (Match m in appearanceItem)
                {
                    model.appearance_star = m.Groups[1].Value;
                    model.appearance      = m.Groups[2].Value;
                }
                MatchCollection insideItem = BLL.Matchs(data, Rule.insideItem);
                foreach (Match m in insideItem)
                {
                    model.inside_star = m.Groups[1].Value;
                    model.inside      = m.Groups[2].Value;
                }
                MatchCollection syntheticalItem = BLL.Matchs(data, Rule.syntheticalItem);
                foreach (Match m in syntheticalItem)
                {
                    model.synthetical_star = m.Groups[1].Value;
                    model.synthetical      = m.Groups[2].Value;
                }


                string showdata = model.car + "/r/n" + model.url + "/r/n" + model.title + "/r/n" +
                                  model.type + "/r/n" + model.malladdr + "/r/n" + model.buydata + model.price + "/r/n" + model.oil + "/r/n" + model.satisfied + "\n" + model.unsatisfied;
                Response.Write(showdata);
            }
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["url"] != "")
            {
                url = Request["url"].Trim().ToString();
            }
            if (Request["series"] != "")
            {
                series = Request["series"].Trim().ToString();
            }
            string source = HtmlHandle.HtmlCode(url);

            if (source != "")
            {
                #region//数据获取
                string       data  = source.Replace("\n", "").Replace(" ", "").Replace("\r", "");
                ecar_content model = new ecar_content();
                model.car         = BLL.One_Match(data, Rule.car);
                model.title       = BLL.One_Match(data, Rule.title);
                model.type        = BLL.One_Match(data, Rule.type);
                model.malladdr    = BLL.One_Match(data, Rule.address);
                model.buydata     = BLL.One_Match(data, Rule.buydate);
                model.price       = BLL.One_Match(data, Rule.price);
                model.oil         = BLL.One_Match(data, Rule.oil);
                model.satisfied   = BLL.One_Match(data, Rule.satisfied);
                model.unsatisfied = BLL.One_Match(data, Rule.unsatisfied);

                MatchCollection oilItem = BLL.Matchs(data, Rule.oilItem);
                foreach (Match m in oilItem)
                {
                    model.oil_star = m.Groups[1].Value;
                    model.oil_sum  = m.Groups[2].Value;
                }
                MatchCollection operationItem = BLL.Matchs(data, Rule.operationItem);
                foreach (Match m in operationItem)
                {
                    model.operation_star = m.Groups[1].Value;
                    model.operation      = m.Groups[2].Value;
                }
                MatchCollection costperforItem = BLL.Matchs(data, Rule.costperforItem);
                foreach (Match m in costperforItem)
                {
                    model.costperfor_star = m.Groups[1].Value;
                    model.costperfor      = m.Groups[2].Value;
                }
                MatchCollection configItem = BLL.Matchs(data, Rule.configItem);
                foreach (Match m in configItem)
                {
                    model.config_star = m.Groups[1].Value;
                    model.config      = m.Groups[2].Value;
                }
                MatchCollection comfortItem = BLL.Matchs(data, Rule.comfortItem);
                foreach (Match m in comfortItem)
                {
                    model.comfort_star = m.Groups[1].Value;
                    model.comfort      = m.Groups[2].Value;
                }
                MatchCollection spaceItem = BLL.Matchs(data, Rule.spaceItem);
                foreach (Match m in spaceItem)
                {
                    model.space_star = m.Groups[1].Value;
                    model.space      = m.Groups[2].Value;
                }
                MatchCollection powerItem = BLL.Matchs(data, Rule.powerItem);
                foreach (Match m in powerItem)
                {
                    model.operation_star = m.Groups[1].Value;
                    model.operation      = m.Groups[2].Value;
                }
                MatchCollection appearanceItem = BLL.Matchs(data, Rule.appearanceItem);
                foreach (Match m in appearanceItem)
                {
                    model.appearance_star = m.Groups[1].Value;
                    model.appearance      = m.Groups[2].Value;
                }
                MatchCollection insideItem = BLL.Matchs(data, Rule.insideItem);
                foreach (Match m in insideItem)
                {
                    model.inside_star = m.Groups[1].Value;
                    model.inside      = m.Groups[2].Value;
                }
                MatchCollection syntheticalItem = BLL.Matchs(data, Rule.syntheticalItem);
                foreach (Match m in syntheticalItem)
                {
                    model.synthetical_star = m.Groups[1].Value;
                    model.synthetical      = Regex.Replace(m.Groups[2].Value.ToString(), "<[\\S\\s]*?>", "").ToString();
                }
                #endregion

                #region//绑定
                lbl_car.InnerText            = series + model.car + model.type;
                txt_title.Value              = model.title;
                txt_buydate.Value            = model.buydata;
                txt_buyprice.Value           = model.price;
                txt_car_oil.Value            = model.oil;
                txt_oil_summary.Value        = model.oil_sum;
                txt_inside_summary.Value     = model.inside;
                txt_drive_summary.Value      = model.operation;
                txt_config_summary.Value     = model.config;
                txt_comfort_summary.Value    = model.comfort;
                txt_cost_summary.Value       = model.costperfor;
                txt_power_summary.Value      = model.power;
                txt_appearance_summary.Value = model.appearance;
                txt_space_summary.Value      = model.space;
                txt_all_summary.Value        = model.synthetical;
                //type = model.type;//
                allstar     = model.synthetical_star;
                powerstar   = model.power_star;
                oilstar     = model.oil_star;
                drivestar   = model.operation_star;
                configstar  = model.config_star;
                coststar    = model.costperfor_star;
                comfortstar = model.comfort_star;
                apperstar   = model.appearance_star;
                spacestar   = model.space_star;
                insidestar  = model.inside_star;
                #endregion

                rep_type.DataSource = T_BLL.Get_ALL();
                rep_type.DataBind();
            }
        }