Exemple #1
0
        public List <CrmWebService.CompanyCmsData> GenerateCCDList(string html, out int totalCount)
        {
            List <CrmWebService.CompanyCmsData> ccdList = new List <CompanyCmsData>();

            mshtml.HTMLDocumentClass doc = new mshtml.HTMLDocumentClass();
            doc.designMode = "on";
            doc.IHTMLDocument2_write(html);

            mshtml.IHTMLElement           divcnt    = doc.getElementById("cnt");
            mshtml.IHTMLElementCollection childrens = (mshtml.IHTMLElementCollection)divcnt.children;
            mshtml.IHTMLTable             table     = (mshtml.IHTMLTable)childrens.item(2);
            for (int i = 1; i < table.rows.length; i++)
            {
                CompanyCmsData item = new CompanyCmsData();

                mshtml.IHTMLTableRow row  = (mshtml.IHTMLTableRow)table.rows.item(i);
                mshtml.IHTMLElement  cell = (mshtml.IHTMLElement)row.cells.item(0);
                item.CmsId         = int.Parse(cell.innerText.Trim());
                cell               = (mshtml.IHTMLElement)row.cells.item(1);
                item.CompanyName   = string.IsNullOrEmpty(cell.innerText) ? "" : cell.innerText.Trim();
                cell               = (mshtml.IHTMLElement)row.cells.item(2);
                item.TTSStatusDesp = string.IsNullOrEmpty(cell.innerText) ? "" : cell.innerText.Trim();
                cell               = (mshtml.IHTMLElement)row.cells.item(3);
                item.ContactPhone  = string.IsNullOrEmpty(cell.innerText) ? "" : cell.innerText.Trim();
                cell               = (mshtml.IHTMLElement)row.cells.item(5);
                item.SalesName     = string.IsNullOrEmpty(cell.innerText) ? "" : cell.innerText.Trim();

                ccdList.Add(item);
            }
            totalCount = 0;
            mshtml.IHTMLElementCollection eles = doc.getElementsByName("totalCount");
            if (eles != null && eles.length > 0)
            {
                totalCount = int.Parse(((mshtml.IHTMLElement)eles.item(0)).getAttribute("value").ToString());
            }

            return(ccdList);
        }
Exemple #2
0
        public CompanyCmsData GenerateCCD(string html)
        {
            CompanyCmsData item = new CompanyCmsData();

            mshtml.HTMLDocumentClass doc = new mshtml.HTMLDocumentClass();
            doc.designMode = "on";
            doc.IHTMLDocument2_write(html);

            mshtml.IHTMLElement noteEle = doc.getElementById("note");   //公司简介
            if (noteEle != null)
            {
                item.CompanyDesp = string.IsNullOrEmpty(noteEle.innerText) ? "" : noteEle.innerText.Trim();
            }
            else
            {
                return(null);
            }
            mshtml.IHTMLElement ele = doc.getElementById("registeredAddress"); //注册地址
            if (ele.getAttribute("value") != null)
            {
                item.RegisterAddress = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("address"); //地址
            if (ele.getAttribute("value") != null)
            {
                item.RealAddress = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("businessLicense"); //营业执照号
            if (ele.getAttribute("value") != null)
            {
                item.CompanyIdNo = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("email"); //营业执照号
            if (ele.getAttribute("value") != null)
            {
                item.CompanyEmail = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("legalRepresentative"); //法人
            if (ele.getAttribute("value") != null)
            {
                item.LegalPerson = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("contact"); //联系人
            if (ele.getAttribute("value") != null)
            {
                item.ContactPerson = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("phone"); //电话
            if (ele.getAttribute("value") != null)
            {
                item.ContactPhone = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }
            ele = doc.getElementById("accountName"); //tts的admin账号
            if (ele.getAttribute("value") != null)
            {
                item.TTSAdminAccount = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
            }

            mshtml.IHTMLElementCollection eles = doc.getElementsByName("promotionNameDomestic");
            if (eles != null && eles.length > 0)
            {
                ele = (mshtml.IHTMLElement)eles.item(0);
                if (ele.getAttribute("value") != null)
                {
                    item.GuoneiWebName = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
                }
            }
            eles = doc.getElementsByName("promotionNameInternational");
            if (eles != null && eles.length > 0)
            {
                ele = (mshtml.IHTMLElement)eles.item(0);
                if (ele.getAttribute("value") != null)
                {
                    item.GuojiWebName = string.IsNullOrEmpty(ele.getAttribute("value").ToString()) ? "" : ele.getAttribute("value").ToString();
                }
            }
            ele = doc.getElementById("bossBackgrouds");   //公司简介
            item.BossBackground = string.IsNullOrEmpty(ele.innerText) ? "" : ele.innerText.Trim();

            return(item);
        }