Example #1
0
        private static List <PropertyEntyties> GetListPropertiesFyi(string html)
        {
            List <PropertyEntyties> rlist = new List <PropertyEntyties>();

            try
            {
                GABIZ.Base.HtmlAgilityPack.HtmlDocument doc = new GABIZ.Base.HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(html);
                var nodes   = doc.DocumentNode.SelectNodes("//tr");
                var nodesTD = doc.DocumentNode.SelectNodes("//tr[1]");
                if (nodes != null)
                {
                    string tenNhom = "", tenthuoctinh = "", giatri = "";
                    tenNhom = "Thông số chung";
                    PropertyEntyties item = new PropertyEntyties();
                    int  stt       = 1;
                    bool check3cot = false;
                    for (int i = 0; i < nodes.Count; i++)
                    {
                        //if (nodes[i].ChildNodes[1].InnerText.Trim().Length > 0)
                        //{
                        //    check3cot = true;
                        //}
                        //if (check3cot)
                        //{

                        //}
                        //else
                        //{
                        tenthuoctinh = nodes[i].ChildNodes[1].InnerText.Trim();
                        giatri       = nodes[i].ChildNodes[3].InnerText.Trim();
                        //}
                        //tenNhom = nodes[i].ChildNodes[1].InnerText.Trim();
                        //tenthuoctinh = nodes[i].ChildNodes[3].InnerText.Trim();
                        //giatri = nodes[i].ChildNodes[5].InnerText.Trim();
                        item          = new PropertyEntyties();
                        item.ID       = Common.GetID_Properties(tenthuoctinh + tenNhom);
                        item.IDType   = Common.GetID_Properties(tenNhom);
                        item.IDValue  = Common.GetID_Properties(giatri);
                        item.Name     = tenthuoctinh;
                        item.NameType = tenNhom;
                        item.Value    = giatri;
                        item.STT      = stt;
                        stt++;
                        rlist.Add(item);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(rlist);
        }
Example #2
0
        private static List <PropertyEntyties> GetListPropertiesVatGia(string html)
        {
            List <PropertyEntyties> rlist = new List <PropertyEntyties>();

            GABIZ.Base.HtmlAgilityPack.HtmlDocument doc = new GABIZ.Base.HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(html);
            var nodes = doc.DocumentNode.SelectNodes("//tr");

            if (nodes != null)
            {
                string           tenNhom = "", tenthuoctinh = "", giatri = "";
                PropertyEntyties item = new PropertyEntyties();
                int stt = 1;
                for (int i = 0; i < nodes.Count; i++)
                {
                    if (nodes[i].Attributes.Count == 0)
                    {
                        // tên nhóm
                        tenNhom = nodes[i].ChildNodes[1].InnerText.Trim();
                    }
                    else
                    {
                        tenthuoctinh  = nodes[i].ChildNodes[1].InnerText.Trim();
                        giatri        = nodes[i].ChildNodes[3].InnerText.Trim();
                        item          = new PropertyEntyties();
                        item.ID       = Common.GetID_Properties(tenthuoctinh + tenNhom);
                        item.IDType   = Common.GetID_Properties(tenNhom);
                        item.IDValue  = Common.GetID_Properties(giatri);
                        item.Name     = tenthuoctinh;
                        item.NameType = tenNhom;
                        item.Value    = giatri;
                        item.STT      = stt;
                        stt++;
                        rlist.Add(item);
                    }
                }
            }
            return(rlist);
        }