示例#1
0
        private Vmax44ParserConnectedLayer.ParsedDataCollection ParseData()
        {
            ParsedDataCollection dataColl = new ParsedDataCollection();
            decimal price;

            var table = PageHtmlDocument.DocumentNode
                        .SelectNodes("//table[starts-with(@class,'price-table')]/tr[@class]");

            foreach (var item in table)
            {
                string price_s = GetNodeText(item, ".//td[5]/span");
                price = summParse(price_s);

                ParsedData original = new ParsedData();
                original.orig       = "original";
                original.firmname   = GetNodeText(item, ".//td[1]");
                original.art        = GetNodeText(item, ".//td[2]/p[1]");
                original.desc       = GetNodeText(item, ".//td[2]/p[2]");
                original.statistic  = GetNodeText(item, ".//td[4]");
                original.price      = price;
                original.parsertype = GetParserType();
                original.url        = "";

                dataColl.Add(original);
            }
            return(dataColl);
        }
示例#2
0
        private Vmax44ParserConnectedLayer.ParsedDataCollection ParseData()
        {
            string  orig = "", firmname = "", art = "", desc = "", statistic = "", price_s = "";
            decimal price;
            ParsedDataCollection res = new ParsedDataCollection();
            var tableselected        = this.PageHtmlDocument.DocumentNode.SelectNodes("//tr[@bl]");

            if (tableselected == null)
            {
                return(res);
            }

            var table = tableselected.ToArray();

            foreach (var item in table)
            {
                var tmp = item.GetAttributeValue("bl", "");

                if (tmp == "-10")
                {
                    orig = "original";
                }
                else
                {
                    orig = "zamenitel";
                }
                PutParsedData(item, ".//div[@class='firmname']", ref firmname);
                PutParsedData(item, ".//div[@class='art']", ref art);
                PutParsedData(item, ".//div[@class='descblock']", ref desc);
                PutParsedData(item, ".//td[@class='statis mobile_h']", ref statistic);
                PutParsedData(item, ".//td[@class='price']", ref price_s);

                price = summParse(price_s);
                ParsedData original = new ParsedData();
                original.orig       = orig;
                original.firmname   = firmname;
                original.art        = art;
                original.desc       = desc;
                original.statistic  = statistic;
                original.price      = price;
                original.parsertype = this.GetParserType();
                original.url        = "";
                res.Add(original);
            }
            return(res);
        }
示例#3
0
文件: Form1.cs 项目: vmax44/parser
        public Form1()
        {
            InitializeComponent();
            dataBase = new ParsedDataCollection();
            dataCollectionBindingSource.DataSource = dataBase;
            dataGridView1.DataSource = dataCollectionBindingSource;

            OrdersDAL sqlbase = new OrdersDAL();

            sqlbase.OpenConnection(ConfigurationManager.ConnectionStrings[
                                       "Vmax44Parser.Properties.Settings.vmax44parserConnectionString"].ToString());
            DataTable orders = sqlbase.GetAllOrdersAsDataTable();

            foreach (DataRow row in orders.Rows)
            {
                comboBox1.Items.Add(row.Field <string>("OrderNumber"));
            }
            sqlbase.CloseConnection();
        }
示例#4
0
        private Vmax44ParserConnectedLayer.ParsedDataCollection ParseData()
        {
            ParsedDataCollection dataColl = new ParsedDataCollection();
            string  orig = "", firmname = "", art = "", desc = "", statistic = "", price_s = "";
            decimal price;

            var table = PageHtmlDocument.DocumentNode
                        .SelectNodes("//table[@id='gridDetails']/tr[not(@class='gridHeaderStyle3')]");

            foreach (var item in table)
            {
                orig = "original";
                string moredata = string.Empty;
                PutParsedData(item, ".//td[4]/a[1]", ref moredata);
                statistic = moredata.Trim();

                var tmp = item.SelectSingleNode(".//td[4]/a[1]").GetAttributeValue("href", "");
                tmp = tmp.Substring(tmp.IndexOf("(") + 1, tmp.IndexOf(")") - tmp.IndexOf("(") - 1);
                tmp = WebUtility.HtmlDecode(tmp);
                var tmparr = tmp.Split((",").ToCharArray());
                firmname = tmparr[0].Replace("'", "");
                art      = tmparr[2].Replace("'", "");
                desc     = tmparr[3].Replace("'", "");

                PutParsedData(item, ".//td[1]", ref price_s);
                price = summParse(price_s);

                ParsedData original = new ParsedData();
                original.orig       = orig;
                original.firmname   = firmname;
                original.art        = art;
                original.desc       = desc;
                original.statistic  = statistic;
                original.price      = price;
                original.parsertype = GetParserType();
                original.url        = "";

                dataColl.Add(original);
            }
            return(dataColl);
        }