/// <summary> /// 企业负责人信息 /// </summary> /// <param name="info"></param> /// <param name="html"></param> public void AddCorpLeader(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "fzrxx"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string LeaderName = string.Empty, LeaderDuty = string.Empty, LeaderType = string.Empty, htlCtx = string.Empty, phone = string.Empty; LeaderName = tr.Columns[1].ToNodePlainString(); LeaderDuty = tr.Columns[2].ToNodePlainString(); phone = tr.Columns[3].ToNodePlainString(); LeaderType = tr.Columns[4].ToNodePlainString(); CorpLeader corpLeader = ToolDb.GenCorpLeader(info.Id, LeaderName, LeaderDuty, LeaderType, info.Url, phone); ToolDb.SaveEntity(corpLeader, string.Empty); } } } }
/// <summary> /// 企业业绩 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpResults(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "yjxx"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string PrjName = string.Empty, PrjCode = string.Empty, BuildUnit = string.Empty, GrantDate = string.Empty, PrjAddress = string.Empty, ChargeDept = string.Empty, PrjClassLevel = string.Empty, PrjClass = string.Empty, BuildArea = string.Empty, InviteArea = string.Empty, ProspUnit = string.Empty, DesignUnit = string.Empty, SuperUnit = string.Empty, ConstUnit = string.Empty, PrjStartDate = string.Empty, PrjEndDate = string.Empty; PrjName = tr.Columns[2].ToNodePlainString(); PrjCode = tr.Columns[1].ToNodePlainString(); BuildUnit = tr.Columns[3].ToNodePlainString(); GrantDate = tr.Columns[4].ToPlainTextString().GetDateRegex(); CorpResults result = ToolDb.GenCorpResults(info.Id, PrjName, PrjCode, BuildUnit, GrantDate, PrjAddress, ChargeDept, PrjClassLevel, PrjClass, BuildArea, InviteArea, ProspUnit, DesignUnit, SuperUnit, ConstUnit, PrjStartDate, PrjEndDate, info.Url); ToolDb.SaveEntity(result, string.Empty); } } } }
/// <summary> /// 企业安全人员证书 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpSecLicStaff(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "ryaq"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string PersonName = string.Empty, PersonCertNo = string.Empty, GrantUnit = string.Empty, GrantDate = string.Empty; PersonName = tr.Columns[1].ToNodePlainString(); PersonCertNo = tr.Columns[2].ToNodePlainString(); GrantUnit = tr.Columns[3].ToNodePlainString(); GrantDate = tr.Columns[4].ToPlainTextString().GetDateRegex(); CorpSecLicStaff SecLicStaff = ToolDb.GenCorpSecLicStaff(info.Id, PersonName, PersonCertNo, GrantUnit, GrantDate, info.Url); ToolDb.SaveEntity(SecLicStaff, string.Empty); } } } }
/// <summary> /// 企业获奖信息 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpAward(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "hjxx"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string AwardName = string.Empty, AwardDate = string.Empty, AwardLevel = string.Empty, GrantUnit = string.Empty, ProjectName = string.Empty; AwardName = tr.Columns[1].ToNodePlainString(); AwardDate = tr.Columns[2].ToPlainTextString().GetDateRegex(); AwardLevel = tr.Columns[3].ToNodePlainString(); GrantUnit = tr.Columns[4].ToNodePlainString(); ProjectName = tr.Columns[5].ToNodePlainString(); CorpAward award = ToolDb.GenCorpAward(info.Id, AwardName, AwardDate, AwardLevel, GrantUnit, ProjectName, info.Url); ToolDb.SaveEntity(award, string.Empty); } } } }
/// <summary> /// 企业处罚信息 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpPunish(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "xzcf"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string DocNo = string.Empty, PunishType = string.Empty, GrantUnit = string.Empty, DocDate = string.Empty, PunishCtx = string.Empty, IsShow = string.Empty; DocNo = tr.Columns[1].ToNodePlainString(); PunishType = tr.Columns[2].ToNodePlainString(); GrantUnit = tr.Columns[3].ToNodePlainString(); DocDate = tr.Columns[4].ToNodePlainString(); CorpPunish punish = ToolDb.GenCorpPunish(info.Id, DocNo, PunishType, GrantUnit, DocDate, PunishCtx, info.Url, "0"); ToolDb.SaveEntity(punish, string.Empty); } } } }
/* * 연동회원의 회사정보를 수정합니다. * - https://docs.popbill.com/cashbill/dotnetcore/api#UpdateCorpInfo */ public IActionResult UpdateCorpInfo() { CorpInfo corpInfo = new CorpInfo(); // 대표자 성명 (최대 100자) corpInfo.ceoname = "대표자 성명 수정"; // 상호 (최대 200자) corpInfo.corpName = "상호 수정"; // 주소 (최대 300자) corpInfo.addr = "주소 수정"; // 업태 (최대 100자) corpInfo.bizType = "업태 수정"; // 종목 (최대 100자) corpInfo.bizClass = "종목 수정"; try { var response = _cashbillService.UpdateCorpInfo(corpNum, corpInfo); return(View("Response", response)); } catch (PopbillException pe) { return(View("Exception", pe)); } }
/// <summary> /// 保存资质 /// </summary> /// <param name="info"></param> /// <param name="html"></param> private void AddCorpQual(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "data-grid"))); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; string CorpId = string.Empty, QualName = string.Empty, QualCode = string.Empty, QualSeq = string.Empty, qualNum = string.Empty, QualType = string.Empty, QualLevel = string.Empty, ValidDate = string.Empty, LicDate = string.Empty, LicUnit = string.Empty; CorpId = info.Id; QualName = tr.Columns[0].ToNodePlainString(); QualCode = tr.Columns[2].ToNodePlainString(); QualLevel = tr.Columns[1].ToNodePlainString(); QualType = info.CorpType; LicDate = tr.Columns[4].ToPlainTextString().GetDateRegex(); ValidDate = tr.Columns[5].ToPlainTextString().GetDateRegex(); LicUnit = tr.Columns[3].ToNodePlainString(); qualNum = QualLevel.GetLevel(); CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, "广东省", "广东地区"); ToolDb.SaveEntity(qual, string.Empty); } } }
protected void AddCorpTecStaff(CorpInfo info, string infoUrl) { string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(infoUrl); } catch { } Parser parser = new Parser(new Lexer(htmldtl)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int i = 2; i < table.RowCount; i++) { if (table.Rows[i].ColumnCount <= 1) { break; } string StaffName = string.Empty, IdCard = string.Empty, CertLevel = string.Empty, CertNo = string.Empty, stffType = string.Empty; TableRow tr = table.Rows[i]; StaffName = tr.Columns[1].ToNodePlainString(); IdCard = tr.Columns[2].ToNodePlainString(); CertLevel = tr.Columns[3].ToNodePlainString(); CertNo = tr.Columns[4].ToNodePlainString(); stffType = tr.Columns[5].ToNodePlainString(); CorpTecStaff staff = ToolDb.GenCorpTecStaff(info.Id, StaffName, IdCard, CertLevel, CertNo, info.Url, stffType); ToolDb.SaveEntity(staff, string.Empty); } } }
/// <summary> /// 企业技术力量 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpTecStaff(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "jsll"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string StaffName = string.Empty, IdCard = string.Empty, CertLevel = string.Empty, CertNo = string.Empty, stffType = string.Empty; StaffName = tr.Columns[1].ToNodePlainString(); stffType = tr.Columns[2].ToNodePlainString(); CertNo = tr.Columns[3].ToNodePlainString(); CorpTecStaff staff = ToolDb.GenCorpTecStaff(info.Id, StaffName, IdCard, CertLevel, CertNo, info.Url, stffType); ToolDb.SaveEntity(staff, string.Empty); } } } }
/// <summary> /// 企业机械设备 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpDevice(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "jxsb"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string DeviceName = string.Empty, DeviceSpec = string.Empty, DeviceCount = string.Empty; DeviceName = tr.Columns[1].ToNodePlainString(); DeviceSpec = tr.Columns[2].ToNodePlainString(); DeviceCount = tr.Columns[3].ToNodePlainString(); CorpDevice device = ToolDb.GenCorpDevice(info.Id, DeviceName, DeviceSpec, DeviceCount, info.Url); ToolDb.SaveEntity(device, string.Empty); } } } }
protected void AddCorpQual(CorpInfo info, string infoUrl) { string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(infoUrl); } catch { } Parser parser = new Parser(new Lexer(htmldtl)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { if (table.Rows[i].ColumnCount <= 1) { break; } string CorpId = string.Empty, QualName = string.Empty, QualCode = string.Empty, QualSeq = string.Empty, qualNum = string.Empty, QualType = string.Empty, QualLevel = string.Empty, ValidDate = string.Empty, LicDate = string.Empty, LicUnit = string.Empty; TableRow tr = table.Rows[i]; QualType = tr.Columns[1].ToNodePlainString(); QualCode = tr.Columns[2].ToNodePlainString(); string name = tr.Columns[3].ToNodePlainString(); LicDate = tr.Columns[4].ToPlainTextString().GetDateRegex(); ValidDate = tr.Columns[5].ToPlainTextString().GetDateRegex(); LicUnit = tr.Columns[6].ToNodePlainString(); if (name.Contains("不分")) { QualName = name.Remove(name.IndexOf("不分")); QualLevel = "不分级"; } else if (name.Contains("暂定级")) { QualName = name.Remove(name.IndexOf("暂定级")); QualLevel = "不分级"; } else if (!string.IsNullOrWhiteSpace(name) && name.Length > 2) { QualLevel = name.Substring(name.Length - 2, 2); QualName = name.Remove(name.Length - 2, 2); } if (QualType.Contains("监理")) { QualName = QualName + "监理"; } qualNum = QualLevel.GetLevel(); CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, info.Province, info.City); ToolDb.SaveEntity(qual, string.Empty); } } }
protected void AddCorpStaff(CorpInfo info, string enterpriseId) { string url = "http://202.104.65.182:8081/G2/webdrive/web-person-info.do?enterpriseId=" + enterpriseId + "&enterpriseBaseId=&data&filter_params_=rowNum,personId,personBaseId,name,isPause,isDel&defined_operations_=&nocheck_operations_=&"; string gridSearch = "false"; string nd = ToolHtml.GetDateTimeLong(DateTime.Now).ToString(); string PAGESIZE = "1000"; string PAGE = "1"; string sortField = ""; string sortDirection = "asc"; NameValueCollection nvc = ToolWeb.GetNameValueCollection(new string[] { "gridSearch", "nd", "PAGESIZE", "PAGE", "sortField", "sortDirection" }, new string[] { gridSearch, nd, PAGESIZE, PAGE, sortField, sortDirection }); string strJson = string.Empty; try { strJson = ToolWeb.GetHtmlByUrl(url, nvc); } catch { return; } JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(strJson); object[] objList = smsTypeJson["data"] as object[]; if (objList != null) { foreach (object obj in objList) { string StaffName = string.Empty, IdCard = string.Empty, CertLevel = string.Empty, CertNo = string.Empty, stffType = string.Empty; Dictionary <string, object> dic = obj as Dictionary <string, object>; StaffName = Convert.ToString(dic["name"]); string dtlUrl = "http://202.104.65.182:8081/G2/webdrive/web-person-certificate.do?personId=" + dic["personId"] + "&actionFlag=view&data&filter_params_=rowNum,personBaseId,personId,certificateId,certificateType,registerLevel,certificateCode,certificatePhotoetch,gardenMajor,issuer,major,pmTitle,issueDate,registerValidEnd&defined_operations_=&nocheck_operations_=view&";//"http://202.104.65.182:8081/G2/webdrive/web-person-certificate.do?personId=" + enterpriseId + "&actionFlag=view&data&filter_params_=rowNum,personBaseId,personId,certificateId,certificateType,registerLevel,certificateCode,certificatePhotoetch,gardenMajor,issuer,major,pmTitle,issueDate,registerValidEnd&defined_operations_=&nocheck_operations_=view&"; string dtlJson = string.Empty; try { dtlJson = ToolWeb.GetHtmlByUrl(dtlUrl, nvc); } catch { continue; } Dictionary <string, object> dtlDic = (Dictionary <string, object>)serializer.DeserializeObject(dtlJson); object[] dtlObjList = dtlDic["data"] as object[]; if (dtlObjList != null && dtlObjList.Length > 0) { Dictionary <string, object> dicDtl = dtlObjList[0] as Dictionary <string, object>; CertNo = Convert.ToString(dicDtl["certificateCode"]); stffType = Convert.ToString(dicDtl["major"]); } CorpTecStaff staff = ToolDb.GenCorpTecStaff(info.Id, StaffName, IdCard, CertLevel, CertNo, info.Url, stffType); ToolDb.SaveEntity(staff, string.Empty); } } }
private void AddCorpInfo(CorpInfo info, string ctx) { if (ToolDb.SaveEntity(info, string.Empty)) { string QualName = string.Empty, QualCode = string.Empty, QualSeq = string.Empty, qualNum = string.Empty, QualType = string.Empty, QualLevel = string.Empty, ValidDate = string.Empty, LicDate = string.Empty, LicUnit = string.Empty; QualName = QualType = "物业管理"; QualCode = ctx.GetRegexBegEnd("zzzshm.value", ";").GetReplace(new string[] { "=", "'" }); LicDate = ctx.GetRegexBegEnd("zzzsfzrq.value", ";").GetReplace(new string[] { "=", "'" }); QualLevel = ctx.GetRegexBegEnd("qyzzmc.value", ";").GetReplace(new string[] { "=", "'" }); qualNum = QualLevel.GetLevel(); CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, "广东省", "深圳市"); ToolDb.SaveEntity(qual, string.Empty); } }
public CorpDetailResp GetCorpInfo(string symbol, string cookie) { CorpDetailResp resp = new CorpDetailResp(); try { CorpInfo response = RestServiceUtils.MakeGetRestCallByTimeOut <CorpInfo>(string.Format(URLConstants.NSEGetCorpDetail, symbol), "https://www.nseindia.com/", 1, cookie); long p = default(long); resp.mfSold = response.corporate.sastRegulations_29.HasRecords() && response.corporate.sastRegulations_29.Where(x => DateTime.Parse(x.timestamp) > DateTime.Now.AddMonths(-5)).HasRecords() ? response.corporate.sastRegulations_29.Where(x => DateTime.Parse(x.timestamp) > DateTime.Now.AddMonths(-5)).Any(y => long.TryParse(y.noOfShareSale, out p)) : default(bool); resp.pledged = response.corporate.pledgedetails.HasRecords() ? decimal.Parse(response.corporate.pledgedetails.First().per3) > default(decimal) : default(bool); resp.PromoterDetails = response.corporate.shareholdingPatterns.data.HasRecords() ?response.corporate.shareholdingPatterns.data.First().ToJson() : string.Empty; resp.IsNotEligible = resp.mfSold || resp.pledged; return(resp.IsNotEligible ? null : resp); } catch (Exception) { return(null); } }
protected void AddCorpLeader(CorpInfo info, string enterpriseId) { string url = "http://202.104.65.182:8081/G2/webdrive/web-enterprise-leader.do?enterpriseId=" + enterpriseId + "&data&filter_params_=rowNum,leaderId,name,title,safetyLicenseCode,safetyLicenseIssuer,safetyLicenseValidEnd&defined_operations_=&nocheck_operations_=&"; string gridSearch = "false"; string nd = ToolHtml.GetDateTimeLong(DateTime.Now).ToString(); string PAGESIZE = "1000"; string PAGE = "1"; string sortField = ""; string sortDirection = "asc"; NameValueCollection nvc = ToolWeb.GetNameValueCollection(new string[] { "gridSearch", "nd", "PAGESIZE", "PAGE", "sortField", "sortDirection" }, new string[] { gridSearch, nd, PAGESIZE, PAGE, sortField, sortDirection }); string strJson = string.Empty; try { strJson = ToolWeb.GetHtmlByUrl(url, nvc); } catch { return; } JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(strJson); object[] objList = smsTypeJson["data"] as object[]; if (objList != null) { foreach (object obj in objList) { Dictionary <string, object> dic = obj as Dictionary <string, object>; string LeaderName = string.Empty, LeaderDuty = string.Empty, LeaderType = string.Empty, htlCtx = string.Empty, phone = string.Empty; LeaderName = Convert.ToString(dic["name"]); LeaderType = Convert.ToString(dic["title"]); CorpLeader corpLeader = ToolDb.GenCorpLeader(info.Id, LeaderName, LeaderDuty, LeaderType, info.Url, phone); ToolDb.SaveEntity(corpLeader, string.Empty); } } }
protected void Page_Load(object sender, EventArgs e) { /** * 연동회원의 회사정보를 수정합니다. * - https://docs.popbill.com/kakao/dotnet/api#UpdateCorpInfo */ // 팝빌회원 사업자번호, '-' 제외 10자리 String testCorpNum = "1234567890"; // 팝빌회원 아이디 String testUserID = "testkorea"; CorpInfo corpInfo = new CorpInfo(); // 대표자성명(최대 100자) corpInfo.ceoname = "대표자명 테스트"; // 상호(최대 200자) corpInfo.corpName = "업체명"; // 주소(최대 100자) corpInfo.addr = "주소정보 수정"; // 업태(최대 100자) corpInfo.bizType = "업태정보 수정"; // 종목(최대 100자) corpInfo.bizClass = "종목 수정"; try { Response response = Global.kakaoService.UpdateCorpInfo(testCorpNum, corpInfo, testUserID); code = response.code.ToString(); message = response.message; } catch (PopbillException ex) { code = ex.code.ToString(); message = ex.Message; } }
/// <summary> /// 企业认证信息 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpCert(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "rzxx"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("tbody"), new HasAttributeFilter("id", "rzInfo"))); if (dtlNode != null && dtlNode.Count > 0) { string temp = dtlNode[0].ToNodePlainString(); if (temp.Contains("没有显示结果") || string.IsNullOrEmpty(temp)) { return; } CorpCert cert = ToolDb.GenCorpCert(info.Id, temp, info.Url); ToolDb.SaveEntity(cert, string.Empty); } } }
protected void Page_Load(object sender, EventArgs e) { /** * 연동회원의 회사정보를 확인합니다. * - https://docs.popbill.com/taxinvoice/dotnet/api#GetCorpInfo */ // 팝빌회원 사업자번호, '-' 제외 10자리 String testCorpNum = "1234567890"; // 팝빌회원 아이디 String testUserID = "testkorea"; try { corpInfo = Global.taxinvoiceService.GetCorpInfo(testCorpNum, testUserID); } catch (PopbillException ex) { code = ex.code.ToString(); message = ex.Message; } }
protected void AddCorpPrompt(CorpInfo info, string infoUrl) { string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(infoUrl); } catch { } Parser parser = new Parser(new Lexer(htmldtl)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { if (table.Rows[i].ColumnCount <= 1) { break; } string prov = string.Empty, city = string.Empty, area = string.Empty, corpId = string.Empty, RecordCode = string.Empty, RecordName = string.Empty, RecordInfo = string.Empty, ImplUnit = string.Empty, BeginDate = string.Empty, InfoUrl = string.Empty; bool IsGood = false; TableRow tr = table.Rows[i]; RecordCode = tr.Columns[0].ToNodePlainString(); RecordName = tr.Columns[1].ToNodePlainString(); RecordInfo = tr.Columns[2].ToNodePlainString(); ImplUnit = tr.Columns[3].ToNodePlainString(); BeginDate = tr.Columns[4].ToPlainTextString().GetDateRegex(); CorpPrompt corp = ToolDb.GetCorpPrompt(info.Province, info.City, "", info.Id, RecordCode, RecordName, RecordInfo, ImplUnit, BeginDate, IsGood, infoUrl); ToolDb.SaveEntity(corp, string.Empty); } } }
/// <summary> /// 企业安全许可 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpSecLic(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "aqsc"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag table = tableNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } string SecLicCode = string.Empty, SecLicDesc = string.Empty, ValidStartDate = string.Empty, ValidStartEnd = string.Empty, SecLicUnit = string.Empty; SecLicCode = tr.Columns[1].ToNodePlainString(); SecLicDesc = tr.Columns[2].ToNodePlainString(); ValidStartDate = tr.Columns[3].ToPlainTextString().GetDateRegex(); ValidStartEnd = tr.Columns[4].ToPlainTextString().GetDateRegex(); SecLicUnit = tr.Columns[5].ToNodePlainString(); if (Encoding.Default.GetByteCount(SecLicDesc) > 1000) { SecLicDesc = string.Empty; } CorpSecLic seclic = ToolDb.GenCorpSecLic(info.Id, SecLicCode, SecLicDesc, ValidStartDate, ValidStartEnd, SecLicUnit, info.Url); ToolDb.SaveEntity(seclic, string.Empty); } } } }
protected void AddCorpResults(CorpInfo info, string infoUrl) { string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(infoUrl); } catch { } Parser parser = new Parser(new Lexer(htmldtl)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { if (table.Rows[i].ColumnCount <= 1) { break; } string PrjName = string.Empty, PrjCode = string.Empty, BuildUnit = string.Empty, GrantDate = string.Empty, PrjAddress = string.Empty, ChargeDept = string.Empty, PrjClassLevel = string.Empty, PrjClass = string.Empty, BuildArea = string.Empty, InviteArea = string.Empty, ProspUnit = string.Empty, DesignUnit = string.Empty, SuperUnit = string.Empty, ConstUnit = string.Empty, PrjStartDate = string.Empty, PrjEndDate = string.Empty; TableRow tr = table.Rows[i]; PrjCode = tr.Columns[1].ToNodePlainString(); PrjName = tr.Columns[2].ToNodePlainString(); PrjAddress = tr.Columns[3].ToNodePlainString(); PrjClass = tr.Columns[4].ToNodePlainString(); BuildUnit = tr.Columns[5].ToNodePlainString(); CorpResults result = ToolDb.GenCorpResults(info.Id, PrjName, PrjCode, BuildUnit, GrantDate, PrjAddress, ChargeDept, PrjClassLevel, PrjClass, BuildArea, InviteArea, ProspUnit, DesignUnit, SuperUnit, ConstUnit, PrjStartDate, PrjEndDate, info.Url); ToolDb.SaveEntity(result, string.Empty); } } }
/// <summary> /// 保存企业技术管理人员情况 /// </summary> /// <param name="info"></param> /// <param name="html"></param> private void AddCorpTecStaff(CorpInfo info, string html) { string viewState = string.Empty; string eventValidation = string.Empty; string cookiestr = string.Empty; viewState = ToolWeb.GetAspNetViewState(html); eventValidation = ToolWeb.GetAspNetEventValidation(html); int pageInt = 1; NameValueCollection nvc = ToolWeb.GetNameValueCollection(new string[] { "ctl00$MainContent$ScriptManager1", "__EVENTTARGET", "__EVENTARGUMENT", "__VIEWSTATE", "__EVENTVALIDATION", "__ASYNCPOST" }, new string[] { "ctl00$MainContent$UpdatePanel1|ctl00$MainContent$step3", "ctl00$MainContent$step3", "", viewState, eventValidation, "true" }); string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(info.Url, nvc, Encoding.UTF8, ref cookiestr); } catch { } //Parser parser = new Parser(new Lexer(htmldtl)); //NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new HasParentFilter(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "MainContent_AspNetPager1")), true), new TagNameFilter("a"))); //if (pageNode != null && pageNode.Count > 0) //{ // try // { // string temp = pageNode[pageNode.Count - 1].GetATagHref().Replace("'", "").Replace(")", "kdxx").Replace(",", "xxdk"); // pageInt = int.Parse(temp.GetRegexBegEnd("xxdk", "kdxx")); // } // catch { } //} //for (int i = 1; i <= pageInt; i++) //{ // if (i > 1) // { // NameValueCollection nvc1 = ToolWeb.GetNameValueCollection(new string[]{ // "ctl00$MainContent$ScriptManager1", // "__EVENTTARGET", // "__EVENTARGUMENT", // "__VIEWSTATE", // "__EVENTVALIDATION", // "__ASYNCPOST" // }, new string[]{ // "ctl00$MainContent$UpdatePanel1|ctl00$MainContent$AspNetPager1", // "ctl00$MainContent$AspNetPager1", // i.ToString(), // viewState, // eventValidation, // "true" // }); // try // { // htmldtl = ToolWeb.GetHtmlByUrl("http://113.108.219.40/intogd/Open/EnterpriseInfo.aspx?ID=1aNTSgxf1zvCznU8XPW9UQ==", nvc1, Encoding.UTF8, ref cookiestr); // } // catch { continue; } // } Parser parser = new Parser(new Lexer(htmldtl)); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "data-grid"))); if (dtlNode != null && dtlNode.Count > 0) { TableTag table = dtlNode[0] as TableTag; for (int j = 1; j < table.RowCount; j++) { TableRow tr = table.Rows[j]; string StaffName = string.Empty, IdCard = string.Empty, CertLevel = string.Empty, CertNo = string.Empty, stffType = string.Empty; StaffName = tr.Columns[0].ToNodePlainString(); stffType = tr.Columns[1].ToNodePlainString(); string aHref = "http://113.108.219.40/intogd/Open/" + tr.Columns[0].GetATagHref(); string staffDtl = string.Empty; try { staffDtl = ToolWeb.GetHtmlByUrl(aHref, Encoding.UTF8); } catch { } parser = new Parser(new Lexer(staffDtl)); NodeList staffNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("width", "100%"))); if (staffNode != null && staffNode.Count > 0) { string ctx = string.Empty; TableTag dtlTable = staffNode[1] as TableTag; for (int k = 0; k < dtlTable.RowCount; k++) { for (int d = 0; d < dtlTable.Rows[k].ColumnCount; d++) { TableColumn col = dtlTable.Rows[k].Columns[d]; if (col.GetAttribute("class") == "td-left") { ctx += col.ToNodePlainString() + ":"; } else { ctx += col.ToNodePlainString() + "\r\n"; } } } CertNo = ctx.GetRegex("职称证号"); } CorpTecStaff staff = ToolDb.GenCorpTecStaff(info.Id, StaffName, IdCard, CertLevel, CertNo, info.Url, stffType); ToolDb.SaveEntity(staff, string.Empty); } } // } }
protected override IList ExecuteCrawl(bool crawlAll) { IList list = new List <CorpInfo>(); string html = string.Empty; string cookiestr = string.Empty; string viewState = string.Empty; int pageInt = 1, count = 0; string eventValidation = string.Empty; try { html = ToolWeb.GetHtmlByUrl(this.SiteUrl, Encoding.UTF8); } catch { return(null); } Parser parser = new Parser(new Lexer(html)); NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("align", "center"))); if (pageNode != null && pageNode.Count > 0) { try { string countTemp = pageNode.AsString().GetRegexBegEnd("\r", "条").Replace(" ", "").Replace("\r", "").Replace("\n", ""); string temp = pageNode.AsString().GetRegexBegEnd("/", "页").Replace(" ", ""); pageInt = int.Parse(temp); count = int.Parse(countTemp); } catch { } } for (int i = 1; i <= pageInt; i++) { if (i > 1) { NameValueCollection nvc = ToolWeb.GetNameValueCollection( new string[] { "datainfo_id", "datainfo_action", "count", "pages", "page", "dwmc", "zzdj", "zsbh", "szss" }, new string[] { string.Empty, string.Empty, count.ToString(), pageInt.ToString(), i.ToString(), string.Empty, string.Empty, string.Empty, string.Empty } ); try { html = ToolWeb.GetHtmlByUrl(this.SiteUrl, nvc, Encoding.UTF8); } catch { continue; } } parser = new Parser(new Lexer(html)); NodeList listNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "list-table"))); if (listNode != null && listNode.Count > 0) { TableTag table = listNode[0] as TableTag; for (int j = 1; j < table.RowCount; j++) { TableRow tr = table.Rows[j]; string CorpId = string.Empty, QualName = string.Empty, QualCode = string.Empty, QualSeq = string.Empty, qualNum = string.Empty, QualType = string.Empty, QualLevel = string.Empty, ValidDate = string.Empty, LicDate = string.Empty, LicUnit = string.Empty; QualName = "计算机信息系统集成"; QualCode = tr.Columns[3].ToNodePlainString(); QualLevel = tr.Columns[2].ToNodePlainString(); LicDate = tr.Columns[5].ToPlainTextString().GetDateRegex(); qualNum = QualLevel.GetLevel(); string corpName = tr.Columns[1].ToNodePlainString(); string city = tr.Columns[6].ToNodePlainString(); object isCorp = ToolDb.ExecuteScalar("select Id from CorpInfo where CorpName='" + corpName + "'"); if (isCorp == null || isCorp.ToString() == "") { string CorpName = string.Empty, CorpCode = string.Empty, CorpAddress = string.Empty, RegDate = string.Empty, RegFund = string.Empty, BusinessCode = string.Empty, BusinessType = string.Empty, LinkMan = string.Empty, LinkPhone = string.Empty, Fax = string.Empty, Email = string.Empty, CorpSite = string.Empty, cUrl = string.Empty, ISOQualNum = string.Empty, ISOEnvironNum = string.Empty, OffAdr = string.Empty, Cert = string.Empty, ctxKc = string.Empty, corpRz = string.Empty; CorpInfo info = ToolDb.GenCorpInfo(corpName, CorpCode, CorpAddress, RegDate, RegFund, BusinessCode, BusinessType, LinkMan, LinkPhone, Fax, Email, CorpSite, string.Empty, city, city, "中华人民共和国工业和信息化部", this.SiteUrl, ISOQualNum, ISOEnvironNum, OffAdr); if (ToolDb.SaveEntity(info, null)) { CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, city, city); ToolDb.SaveEntity(qual, ""); } } else { CorpQual qual = ToolDb.GenCorpQual(isCorp.ToString(), QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, this.SiteUrl, qualNum, city, city); ToolDb.SaveEntity(qual, "QualCode,CorpId,QualName", true); } } } } return(list); }
/// <summary> /// 企业安全许可 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpSecLic(CorpInfo info, string param, string corpType) { string url = "http://portal.szjs.gov.cn:8888/publicShow/querySafeProduction.html"; string[] postParams = new string[] { "param", "corpType", "orgCode", "page" }; string[] postValues = new string[] { param, corpType, info.CorpCode, "1" }; NameValueCollection nvc = ToolWeb.GetNameValueCollection(postParams, postValues); string html = string.Empty; try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); return; } } JavaScriptSerializer java = new JavaScriptSerializer(); Dictionary <string, object> jsonResults = (Dictionary <string, object>)java.DeserializeObject(html); int pageInt = 1; try { pageInt = (int)jsonResults["totalPage"]; } catch { } for (int i = 1; i <= pageInt; i++) { if (i > 1) { postValues = new string[] { param, corpType, info.CorpCode, i.ToString() }; nvc = ToolWeb.GetNameValueCollection(postParams, postValues); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); continue; } } jsonResults = (Dictionary <string, object>)java.DeserializeObject(html); } object[] dicRecords = (object[])jsonResults["records"]; foreach (object dicRecord in dicRecords) { Dictionary <string, object> dic = (Dictionary <string, object>)dicRecord; string SecLicCode = string.Empty, SecLicDesc = string.Empty, ValidStartDate = string.Empty, ValidStartEnd = string.Empty, SecLicUnit = string.Empty; SecLicCode = Convert.ToString(dic["lics_id"]); SecLicDesc = Convert.ToString(dic["lics_range"]); ValidStartDate = Convert.ToString(dic["valid_start_date"]); ValidStartEnd = Convert.ToString(dic["valid_end_date"]); SecLicUnit = Convert.ToString(dic["issue_dept"]); if (Encoding.Default.GetByteCount(SecLicDesc) > 1000) { SecLicDesc = string.Empty; } CorpSecLic seclic = ToolDb.GenCorpSecLic(info.Id, SecLicCode, SecLicDesc, ValidStartDate, ValidStartEnd, SecLicUnit, info.Url); ToolDb.SaveEntity(seclic, string.Empty); } } }
/// <summary> /// 企业安全人员证书 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpSecLicStaff(CorpInfo info, string param, string corpType) { string url = "http://portal.szjs.gov.cn:8888/publicShow/queryPersonSafe.html"; string[] postParams = new string[] { "param", "corpType", "orgCode", "page" }; string[] postValues = new string[] { param, corpType, info.CorpCode, "1" }; NameValueCollection nvc = ToolWeb.GetNameValueCollection(postParams, postValues); string html = string.Empty; try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); return; } } JavaScriptSerializer java = new JavaScriptSerializer(); Dictionary <string, object> jsonResults = (Dictionary <string, object>)java.DeserializeObject(html); int pageInt = 1; try { pageInt = (int)jsonResults["totalPage"]; } catch { } for (int i = 1; i <= pageInt; i++) { if (i > 1) { postValues = new string[] { param, corpType, info.CorpCode, i.ToString() }; nvc = ToolWeb.GetNameValueCollection(postParams, postValues); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); continue; } } jsonResults = (Dictionary <string, object>)java.DeserializeObject(html); } object[] dicRecords = (object[])jsonResults["records"]; foreach (object dicRecord in dicRecords) { string PersonName = string.Empty, PersonCertNo = string.Empty, GrantUnit = string.Empty, GrantDate = string.Empty; Dictionary <string, object> dic = (Dictionary <string, object>)dicRecord; PersonName = Convert.ToString(dic["name"]); PersonCertNo = Convert.ToString(dic["lics_id"]); GrantUnit = Convert.ToString(dic["issue_dept"]); GrantDate = Convert.ToString(dic["issue_date"]); CorpSecLicStaff SecLicStaff = ToolDb.GenCorpSecLicStaff(info.Id, PersonName, PersonCertNo, GrantUnit, GrantDate, info.Url); ToolDb.SaveEntity(SecLicStaff, string.Empty); } } }
/// <summary> /// 企业资质信息 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpQual(CorpInfo info, string param, string corpType) { string url = "http://portal.szjs.gov.cn:8888/publicShow/queryCertificateInfo.html"; string[] postParams = new string[] { "param", "corpType", "orgCode", "page" }; string[] postValues = new string[] { param, corpType, info.CorpCode, "1" }; NameValueCollection nvc = ToolWeb.GetNameValueCollection(postParams, postValues); string html = string.Empty; try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); return; } } JavaScriptSerializer java = new JavaScriptSerializer(); Dictionary <string, object> jsonResults = (Dictionary <string, object>)java.DeserializeObject(html); int pageInt = 1; try { pageInt = (int)jsonResults["totalPage"]; } catch { } for (int i = 1; i <= pageInt; i++) { if (i > 1) { postValues = new string[] { param, corpType, info.CorpCode, i.ToString() }; nvc = ToolWeb.GetNameValueCollection(postParams, postValues); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); continue; } } jsonResults = (Dictionary <string, object>)java.DeserializeObject(html); } object[] dicQuals = (object[])jsonResults["records"]; foreach (object dicQual in dicQuals) { Dictionary <string, object> dic = (Dictionary <string, object>)dicQual; string CorpId = string.Empty, QualName = string.Empty, QualCode = string.Empty, QualSeq = string.Empty, qualNum = string.Empty, QualType = string.Empty, QualLevel = string.Empty, ValidDate = string.Empty, LicDate = string.Empty, LicUnit = string.Empty; QualType = Convert.ToString(dic["name"]); QualCode = Convert.ToString(dic["cert_no"]); string certType = Convert.ToString(dic["cert_type"]); string certId = Convert.ToString(dic["cert_id"]); string htmldtl = string.Empty; string urlDtl = "http://portal.szjs.gov.cn:8888/publicShow/queryCertificateDetail.html"; NameValueCollection dtlNvc = ToolWeb.GetNameValueCollection(new string[] { "param", "corpType", "cert_id" }, new string[] { param, certType, certId }); try { htmldtl = ToolWeb.GetHtmlByUrl(urlDtl, dtlNvc, Encoding.UTF8); } catch { Thread.Sleep(12 * 60 * 1000); try { htmldtl = ToolWeb.GetHtmlByUrl(urlDtl, dtlNvc, Encoding.UTF8); } catch { Thread.Sleep(8 * 60 * 1000); continue; } } object[] dtlQuals = (object[])java.DeserializeObject(htmldtl); foreach (object objQual in dtlQuals) { Dictionary <string, object> dicDtl = (Dictionary <string, object>)objQual; QualName = Convert.ToString(dicDtl["name1"]); QualLevel = Convert.ToString(dicDtl["name2"]); LicUnit = Convert.ToString(dicDtl["appr_org"]); LicDate = Convert.ToString(dicDtl["appr_date"]); ValidDate = Convert.ToString(dicDtl["valid_period"]); qualNum = QualLevel.GetLevel(); CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, "广东省", "深圳市"); ToolDb.SaveEntity(qual, string.Empty); } } } }
protected override IList ExecuteCrawl(bool crawlAll) { string html = string.Empty; string cookiestr = string.Empty; string viewState = string.Empty; int pageInt = 1; string eventValidation = string.Empty; try { html = ToolWeb.GetHtmlByUrl(this.SiteUrl, Encoding.UTF8, ref cookiestr); } catch { return(null); } Parser parser = new Parser(new Lexer(html)); NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new HasParentFilter(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "ContentPlaceHolder1_AspNetPager1")), true), new TagNameFilter("a"))); if (pageNode != null && pageNode.Count > 0) { try { string temp = pageNode[pageNode.Count - 1].GetATagHref().Replace("'", "").Replace(")", "kdxx").Replace(",", "xxdk"); pageInt = int.Parse(temp.GetRegexBegEnd("xxdk", "kdxx")); } catch { } } for (int i = 1; i <= pageInt; i++) { if (i > 1) { try { if (i == 2) { viewState = ToolWeb.GetAspNetViewState(html); eventValidation = ToolWeb.GetAspNetEventValidation(html); } NameValueCollection nvc = ToolWeb.GetNameValueCollection( new string[] { "ctl00$ContentPlaceHolder1$ScriptManager1", "ctl00$ContentPlaceHolder1$txtORGNAME", "ctl00$ContentPlaceHolder1$txtORGCODE", "ctl00$ContentPlaceHolder1$txtPNAME", "ctl00$ContentPlaceHolder1$txtIDNUM", "ctl00$ContentPlaceHolder1$txtHIREERORGNAME", "ctl00$ContentPlaceHolder1$txtHIREERORGCODE", "ctl00$ContentPlaceHolder1$ddlRegType", "ctl00$ContentPlaceHolder1$ddlTitle", "ctl00$ContentPlaceHolder1$ddlABC", "ctl00$ContentPlaceHolder1$ddlCert", "__VIEWSTATE", "__EVENTTARGET", "__EVENTARGUMENT", "__EVENTVALIDATION", "__ASYNCPOST" }, new string[] { "ctl00$ContentPlaceHolder1$UpdatePanel1|ctl00$ContentPlaceHolder1$AspNetPager1", "", "", "", "", "", "", "", "", "", "", viewState, "ctl00$ContentPlaceHolder1$AspNetPager1", i.ToString(), eventValidation, "true" } ); html = ToolWeb.GetHtmlByUrl(SiteUrl, nvc, Encoding.UTF8, ref cookiestr); } catch { continue; } } parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "data-grid"))); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int j = 1; j < table.RowCount; j++) { string CorpName = string.Empty, CorpCode = string.Empty, CorpAddress = string.Empty, RegDate = string.Empty, RegFund = string.Empty, BusinessCode = string.Empty, BusinessType = string.Empty, LinkMan = string.Empty, LinkPhone = string.Empty, Fax = string.Empty, Email = string.Empty, CorpSite = string.Empty, cUrl = string.Empty, CorpType, ISOQualNum = string.Empty, ISOEnvironNum = string.Empty, OffAdr = string.Empty, Cert = string.Empty; TableRow tr = table.Rows[j]; CorpName = tr.Columns[0].ToNodePlainString(); LinkMan = tr.Columns[1].ToNodePlainString(); cUrl = tr.Columns[0].GetATagValue("onclick").Replace("OpenWin('", ""); if (cUrl.IndexOf("'") > 0) { cUrl = "http://113.108.219.40/intogd/" + cUrl.Remove(cUrl.IndexOf("'")); } string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(cUrl, Encoding.UTF8); } catch { continue; } parser = new Parser(new Lexer(htmldtl)); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "data-table"))); if (dtlNode != null && dtlNode.Count > 0) { string ctx = string.Empty; TableTag dtlTable = dtlNode[0] as TableTag; for (int k = 0; k < dtlTable.RowCount; k++) { for (int d = 0; d < dtlTable.Rows[k].ColumnCount; d++) { TableColumn col = dtlTable.Rows[k].Columns[d]; if (col.GetAttribute("class") == "td-left") { ctx += col.ToNodePlainString() + ":"; } else { ctx += col.ToNodePlainString() + "\r\n"; } } } RegDate = ctx.GetRegex("成立时间,注册时间").GetDateRegex(); RegFund = ctx.GetRegex("注册资本"); BusinessCode = ctx.GetRegex("营业执照注册号"); CorpType = "外地进粤企业"; CorpAddress = ctx.GetRegex("注册详细地址"); if (!string.IsNullOrEmpty(RegFund) && !RegFund.Contains("万")) { RegFund += "万"; } CorpInfo corp = ToolDb.GenCorpInfo(CorpName, CorpCode, CorpAddress, RegDate, RegFund, BusinessCode, BusinessType, LinkMan, LinkPhone, Fax, Email, CorpSite, CorpType, "广东省", "广东地区", "广东省住房和城乡建设厅", cUrl, ISOQualNum, ISOEnvironNum, OffAdr); string strSql = string.Format("select Id from CorpInfo where CorpName='{0}' and CorpType='{1}'", corp.CorpName, corp.CorpType); DataTable dt = ToolCoreDb.GetDbData(strSql); if (dt != null && dt.Rows.Count > 0) { string id = dt.Rows[0]["Id"].ToString(); StringBuilder delCorpQual = new System.Text.StringBuilder(); StringBuilder delCorpLeader = new System.Text.StringBuilder(); StringBuilder delCorpSecLicStaff = new System.Text.StringBuilder(); StringBuilder delCorpInstitution = new StringBuilder(); delCorpInstitution.AppendFormat("delete from CorpInstitution where CorpId='{0}'", id); delCorpQual.AppendFormat("delete from CorpQual where CorpId='{0}'", id); delCorpLeader.AppendFormat("delete from CorpLeader where CorpId='{0}'", id); delCorpSecLicStaff.AppendFormat("delete from CorpTecStaff where CorpId='{0}'", id); ToolCoreDb.ExecuteSql(delCorpInstitution.ToString()); ToolCoreDb.ExecuteSql(delCorpQual.ToString()); ToolCoreDb.ExecuteSql(delCorpLeader.ToString()); ToolCoreDb.ExecuteSql(delCorpSecLicStaff.ToString()); string corpSql = string.Format("delete from CorpInfo where Id='{0}'", id); ToolCoreDb.ExecuteSql(corpSql); } if (ToolDb.SaveEntity(corp, this.ExistCompareFields)) { if (!string.IsNullOrEmpty(LinkMan)) { CorpLeader leader = ToolDb.GenCorpLeader(corp.Id, LinkMan, "", "企业法定代表人", cUrl); ToolDb.SaveEntity(leader, ""); } if (!string.IsNullOrEmpty(tr.Columns[2].ToNodePlainString())) { CorpLeader leader = ToolDb.GenCorpLeader(corp.Id, tr.Columns[2].ToNodePlainString(), "", "技术负责人", cUrl); ToolDb.SaveEntity(leader, ""); } if (!string.IsNullOrEmpty(tr.Columns[3].ToNodePlainString())) { CorpLeader leader = ToolDb.GenCorpLeader(corp.Id, tr.Columns[3].ToNodePlainString(), "", "驻粤负责人", cUrl); ToolDb.SaveEntity(leader, ""); } AddCorpQual(corp, htmldtl); AddCorpTecStaff(corp, htmldtl); GetOffAddress(htmldtl, cUrl, corp); } } } } } return(null); }
/// <summary> /// 企业资质信息 /// </summary> /// <param name="info"></param> /// <param name="html"></param> protected void AddCorpQual(CorpInfo info, string html) { Parser parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "zzzsxx"))); if (nodeList != null && nodeList.Count > 0) { parser = new Parser(new Lexer(nodeList.ToHtml().Replace("th", "td"))); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (dtlNode != null && dtlNode.Count > 0) { TableTag table = dtlNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { string CorpId = string.Empty, QualName = string.Empty, QualCode = string.Empty, QualSeq = string.Empty, qualNum = string.Empty, QualType = string.Empty, QualLevel = string.Empty, ValidDate = string.Empty, LicDate = string.Empty, LicUnit = string.Empty; TableRow tr = table.Rows[i]; if (tr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { break; } QualType = tr.Columns[1].ToNodePlainString(); QualCode = tr.Columns[2].ToNodePlainString(); parser = new Parser(new Lexer(html)); NodeList listDtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "qyzz"))); if (listDtlNode != null && listDtlNode.Count > 0) { parser = new Parser(new Lexer(listDtlNode.ToHtml().Replace("th", "td"))); NodeList tableNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table")); if (tableNode != null && tableNode.Count > 0) { TableTag dtlTable = tableNode[0] as TableTag; bool isAdd = false; for (int k = 1; k < dtlTable.RowCount; k++) { TableRow dr = dtlTable.Rows[k]; if (dr.Columns[0].ToPlainTextString().Contains("没有显示结果")) { isAdd = true; break; } QualName = dr.Columns[1].ToNodePlainString(); QualLevel = dr.Columns[2].ToNodePlainString(); LicUnit = dr.Columns[3].ToNodePlainString(); LicDate = dr.Columns[4].ToNodePlainString(); if (info.CorpType.Contains("监理")) { QualName = QualName + "监理"; } qualNum = QualLevel.GetLevel(); CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, "广东省", "深圳市"); ToolDb.SaveEntity(qual, string.Empty); } if (isAdd) { if (info.CorpType.Contains("监理")) { QualName = QualName + "监理"; } qualNum = QualLevel.GetLevel(); LicUnit = tr.Columns[3].ToNodePlainString(); LicDate = tr.Columns[4].ToPlainTextString().GetDateRegex(); QualName = QualType; CorpQual qual = ToolDb.GenCorpQual(info.Id, QualName, QualCode, QualSeq, QualType, QualLevel, ValidDate, LicDate, LicUnit, info.Url, qualNum, "广东省", "深圳市"); ToolDb.SaveEntity(qual, string.Empty); } } } } } } }
/// <summary> /// 获取办公地址并保存分支机构信息 /// </summary> /// <param name="html"></param> /// <param name="url"></param> /// <returns></returns> private string GetOffAddress(string html, string url, CorpInfo info) { string viewState = string.Empty; string eventValidation = string.Empty; string cookiestr = string.Empty; viewState = ToolWeb.GetAspNetViewState(html); eventValidation = ToolWeb.GetAspNetEventValidation(html); string returnValue = string.Empty; int pageInt = 1; NameValueCollection nvc = ToolWeb.GetNameValueCollection(new string[] { "ctl00$MainContent$ScriptManager1", "__EVENTTARGET", "__EVENTARGUMENT", "__VIEWSTATE", "__EVENTVALIDATION", "__ASYNCPOST" }, new string[] { "ctl00$MainContent$UpdatePanel1|ctl00$MainContent$step2", "ctl00$MainContent$step2", "", viewState, eventValidation, "true" }); string htmldtl = string.Empty; try { htmldtl = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8, ref cookiestr); } catch { } Parser parser = new Parser(new Lexer(htmldtl)); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "data-grid"))); if (dtlNode != null && dtlNode.Count > 0) { TableTag table = dtlNode[0] as TableTag; for (int i = 1; i < table.RowCount; i++) { string CorpName = string.Empty, CorpCode = string.Empty, Location = string.Empty, DtlAddress = string.Empty, PostalCode = string.Empty, ResInstitution = string.Empty, LinkMan = string.Empty, LinPhone = string.Empty, Fax = string.Empty, BusinessCode = string.Empty, RegDate = string.Empty, Email = string.Empty, SafetyCode = string.Empty, TotalReMan = string.Empty, TechReMan = string.Empty, SafeReMan = string.Empty, QualityReMan = string.Empty, Url = string.Empty, TotalSafetyCode = string.Empty, TechSafetyCode = string.Empty, QualitySafetyCode = string.Empty; TableRow tr = table.Rows[i]; Url = "http://113.108.219.40/intogd/Open/" + tr.Columns[0].GetATagHref(); CorpName = tr.Columns[0].ToNodePlainString(); TotalReMan = tr.Columns[2].ToNodePlainString(); TechReMan = tr.Columns[3].ToNodePlainString(); QualityReMan = tr.Columns[4].ToNodePlainString(); SafeReMan = tr.Columns[5].ToNodePlainString(); string dtlHtml = string.Empty; try { dtlHtml = ToolWeb.GetHtmlByUrl(Url, Encoding.UTF8); } catch { continue; } parser = new Parser(new Lexer(dtlHtml)); NodeList staffNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("width", "100%"))); if (staffNode != null && staffNode.Count > 1) { string ctx = string.Empty; TableTag dtlTable = staffNode[1] as TableTag; for (int k = 0; k < dtlTable.RowCount; k++) { for (int d = 0; d < dtlTable.Rows[k].ColumnCount; d++) { TableColumn col = dtlTable.Rows[k].Columns[d]; if (col.GetAttribute("class") == "td-left") { ctx += col.ToNodePlainString() + ":"; } else { ctx += col.ToNodePlainString() + "\r\n"; } } } if (string.IsNullOrEmpty(returnValue)) { returnValue = ctx.GetRegex("详细地址"); } CorpCode = ctx.GetRegex("组织机构代码"); Location = ctx.GetRegex("所在地"); DtlAddress = ctx.GetRegex("详细地址"); PostalCode = ctx.GetRegex("邮政编码"); ResInstitution = ctx.GetRegex("驻粤负责机构"); LinkMan = ctx.Replace(" ", "").GetRegex("联系人"); Fax = ctx.GetRegex("传真号码"); LinPhone = ctx.GetRegex("联系电话"); BusinessCode = ctx.GetRegex("营业执照注册号").Replace("分", ""); RegDate = ctx.GetRegex("设立时间").GetDateRegex(); Email = ctx.GetRegex("邮箱"); parser.Reset(); NodeList safeNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "data-table"))); if (safeNode != null && safeNode.Count > 2) { TableTag safeTable = safeNode[2] as TableTag; string TotalSafetyCodeCtx = string.Empty; string TechSafetyCodeCtx = string.Empty; for (int k = 0; k < safeTable.RowCount; k++) { for (int d = 0; d < safeTable.Rows[k].ColumnCount; d++) { TableColumn col = safeTable.Rows[k].Columns[d]; if (d >= 2) { if (col.GetAttribute("class") == "td-left") { TechSafetyCodeCtx += col.ToNodePlainString() + ":"; } else { TechSafetyCodeCtx += col.ToNodePlainString() + "\r\n"; } } else { if (col.GetAttribute("class") == "td-left") { TotalSafetyCodeCtx += col.ToNodePlainString() + ":"; } else { TotalSafetyCodeCtx += col.ToNodePlainString() + "\r\n"; } } } } TotalSafetyCode = ToolHtml.GetRegexStringNot(TotalSafetyCodeCtx, new string[] { "安全生产考核合格证号(A证)" }); TechSafetyCode = ToolHtml.GetRegexStringNot(TechSafetyCodeCtx, new string[] { "安全生产考核合格证号(A证)" }); } if (safeNode != null && safeNode.Count > 4) { TableTag safeTable = safeNode[4] as TableTag; string SafetyCodeCtx = string.Empty; string QualitySafetyCodeCtx = string.Empty; for (int k = 0; k < safeTable.RowCount; k++) { for (int d = 0; d < safeTable.Rows[k].ColumnCount; d++) { TableColumn col = safeTable.Rows[k].Columns[d]; if (d >= 2) { if (col.GetAttribute("class") == "td-left") { QualitySafetyCodeCtx += col.ToNodePlainString() + ":"; } else { QualitySafetyCodeCtx += col.ToNodePlainString() + "\r\n"; } } else { if (col.GetAttribute("class") == "td-left") { SafetyCodeCtx += col.ToNodePlainString() + ":"; } else { SafetyCodeCtx += col.ToNodePlainString() + "\r\n"; } } } } SafetyCode = ToolHtml.GetRegexStringNot(SafetyCodeCtx, new string[] { "安全生产考核合格证号(A或B证)" }); QualitySafetyCode = ToolHtml.GetRegexStringNot(QualitySafetyCodeCtx, new string[] { "安全生产考核合格证号" });// QualitySafetyCodeCtx.GetRegex("安全生产考核合格证号"); } CorpInstitution entity = ToolDb.GenCorpInstitution("广东省", "广东地区", info.Id, CorpName, CorpCode, Location, DtlAddress, PostalCode, ResInstitution, LinkMan, LinPhone, Fax, BusinessCode, RegDate, Email, SafetyCode, TotalReMan, TechReMan, SafeReMan, QualityReMan, Url, TotalSafetyCode, TechSafetyCode, QualitySafetyCode); ToolDb.SaveEntity(entity, string.Empty); } } } return(returnValue); }
protected override IList ExecuteCrawl(bool crawlAll) { int count = 1, totalCount = 1; string html = string.Empty; string cookiestr = string.Empty; string viewState = string.Empty; int pageInt = 1; string eventValidation = string.Empty; string pageHtl = string.Empty; try { html = ToolWeb.GetHtmlByUrl(this.SiteUrl, Encoding.Default); } catch { return(null); } Parser parser = new Parser(new Lexer(html)); NodeList pageNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("a"), new HasAttributeFilter("id", "lx"))); if (pageNode != null && pageNode.Count > 0) { try { string temp = pageNode.GetATagHref().GetRegexBegEnd("page=", "&"); pageInt = int.Parse(temp); } catch { pageInt = 1; } } for (int i = 1; i <= pageInt; i++) { if (i > 1) { try { html = ToolWeb.GetHtmlByUrl(this.SiteUrl + "&page=" + i.ToString(), Encoding.Default); } catch { continue; } } parser = new Parser(new Lexer(html)); NodeList nodeList = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("id", "bean"))); if (nodeList != null && nodeList.Count > 0) { TableTag table = nodeList[0] as TableTag; for (int j = 1; j < table.RowCount; j++) { string CorpName = string.Empty, CorpCode = string.Empty, CorpAddress = string.Empty, RegDate = string.Empty, RegFund = string.Empty, BusinessCode = string.Empty, BusinessType = string.Empty, LinkMan = string.Empty, LinkPhone = string.Empty, Fax = string.Empty, Email = string.Empty, CorpSite = string.Empty, cUrl = string.Empty, ISOQualNum = string.Empty, ISOEnvironNum = string.Empty, OffAdr = string.Empty, Cert = string.Empty, ctxKc = string.Empty, corpRz = string.Empty; TableRow tr = table.Rows[j]; CorpName = tr.Columns[1].ToNodePlainString(); CorpCode = tr.Columns[2].ToNodePlainString(); LinkMan = tr.Columns[3].ToNodePlainString(); string href = tr.Columns[1].GetATagValue("onclick"); string htmldtl = string.Empty; string[] url = null; try { string temp = href.Replace("doView", "").Replace("(", "").Replace(")", "").Replace("'", ""); url = temp.Split(','); cUrl = "http://61.144.226.2:8001/web/enterprs/unitInfoAction.do?method=toView&qybh=" + url[0] + "&certType=1&orgcode=" + url[1]; htmldtl = ToolWeb.GetHtmlByUrl(cUrl, Encoding.Default); } catch { continue; } parser = new Parser(new Lexer(htmldtl.Replace("th", "td"))); NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "infoTableL"))); if (dtlNode != null && dtlNode.Count > 0) { TableTag tabledtl = dtlNode[0] as TableTag; string ctx = string.Empty; for (int d = 0; d < tabledtl.RowCount; d++) { for (int k = 0; k < tabledtl.Rows[d].ColumnCount; k++) { string temp = tabledtl.Rows[d].Columns[k].ToNodePlainString(); if (k == 0) { ctx += temp + ":"; } else { ctx += temp + "\r\n"; } } } LinkPhone = ctx.GetRegex("联系电话"); Fax = ctx.GetRegex("传真"); Email = ctx.GetRegex("电子邮箱"); CorpAddress = ctx.GetRegex("注册地址"); RegFund = ctx.GetRegex("注册资金"); RegDate = ctx.GetRegex("设立时间"); } CorpInfo info = ToolDb.GenCorpInfo(CorpName, CorpCode, CorpAddress, RegDate, RegFund, BusinessCode, BusinessType, LinkMan, LinkPhone, Fax, Email, CorpSite, "设计与施工一体化企业", "广东省", "深圳市", "深圳市住房和建设局", cUrl, ISOQualNum, ISOEnvironNum, OffAdr); object obj = ToolDb.ExecuteScalar(string.Format("select Id from CorpInfo where CorpName='{0}' and CorpType='{1}' and InfoSource='{2}'", info.CorpName, info.CorpType, info.InfoSource)); int qualCount = 0, leaderCount = 0, awardCount = 0, certCount = 0, punishCount = 0, seclicCount = 0, seclicstaffCount = 0, tecstaffCount = 0, deviceCount = 0, resultCount = 0, infoCount = 0; bool isDel = false; if (obj != null && obj.ToString() != "") { isDel = true; string id = obj.ToString(); StringBuilder delCorpQual = new System.Text.StringBuilder(); StringBuilder delCorpLeader = new System.Text.StringBuilder(); StringBuilder delCorpAward = new System.Text.StringBuilder(); StringBuilder delCorpCert = new System.Text.StringBuilder(); StringBuilder delCorpPunish = new System.Text.StringBuilder(); StringBuilder delCorpSecLic = new System.Text.StringBuilder(); StringBuilder delCorpSecLicStaff = new System.Text.StringBuilder(); StringBuilder delCorpDevice = new System.Text.StringBuilder(); StringBuilder delCorpResults = new System.Text.StringBuilder(); StringBuilder delCorpTecStaff = new System.Text.StringBuilder(); delCorpQual.AppendFormat("delete from CorpQual where CorpId='{0}'", id); delCorpLeader.AppendFormat("delete from CorpLeader where CorpId='{0}'", id); delCorpAward.AppendFormat("delete from CorpAward where CorpId='{0}'", id); delCorpCert.AppendFormat("delete from CorpCert where CorpId='{0}'", id); delCorpPunish.AppendFormat("delete from CorpPunish where CorpId='{0}'", id); delCorpSecLic.AppendFormat("delete from CorpSecLic where CorpId='{0}'", id); delCorpSecLicStaff.AppendFormat("delete from CorpSecLicStaff where CorpId='{0}'", id); delCorpTecStaff.AppendFormat("delete from CorpTecStaff where CorpId='{0}'", id); delCorpDevice.AppendFormat("delete from CorpDevice where CorpId='{0}'", id); delCorpResults.AppendFormat("delete from CorpResults where CorpId='{0}'", id); qualCount = ToolCoreDb.ExecuteSql(delCorpQual.ToString()); leaderCount = ToolCoreDb.ExecuteSql(delCorpLeader.ToString()); awardCount = ToolCoreDb.ExecuteSql(delCorpAward.ToString()); certCount = ToolCoreDb.ExecuteSql(delCorpCert.ToString()); punishCount = ToolCoreDb.ExecuteSql(delCorpPunish.ToString()); seclicCount = ToolCoreDb.ExecuteSql(delCorpSecLic.ToString()); seclicstaffCount = ToolCoreDb.ExecuteSql(delCorpSecLicStaff.ToString()); tecstaffCount = ToolCoreDb.ExecuteSql(delCorpTecStaff.ToString()); deviceCount = ToolCoreDb.ExecuteSql(delCorpDevice.ToString()); resultCount = ToolCoreDb.ExecuteSql(delCorpResults.ToString()); string corpSql = string.Format("delete from CorpInfo where Id='{0}'", id); infoCount = ToolCoreDb.ExecuteSql(corpSql); } if (infoCount != -1 || !isDel) { if (ToolDb.SaveEntity(info, string.Empty)) { if (isDel) { if (qualCount != -1) { AddCorpQual(info, htmldtl); } if (awardCount != -1) { AddCorpAward(info, htmldtl); } if (certCount != -1) { AddCorpCert(info, htmldtl); } if (deviceCount != -1) { AddCorpDevice(info, htmldtl); } if (punishCount != -1) { AddCorpPunish(info, htmldtl); } if (resultCount != -1) { AddCorpResults(info, htmldtl); } if (seclicCount != -1) { AddCorpSecLic(info, htmldtl); } if (seclicstaffCount != -1) { AddCorpSecLicStaff(info, htmldtl); } if (tecstaffCount != -1) { AddCorpTecStaff(info, htmldtl); } if (leaderCount != -1) { AddCorpLeader(info, htmldtl); } } else { AddCorpQual(info, htmldtl); AddCorpAward(info, htmldtl); AddCorpCert(info, htmldtl); AddCorpDevice(info, htmldtl); AddCorpPunish(info, htmldtl); AddCorpResults(info, htmldtl); AddCorpSecLic(info, htmldtl); AddCorpSecLicStaff(info, htmldtl); AddCorpTecStaff(info, htmldtl); AddCorpLeader(info, htmldtl); } } } count++; totalCount++; if (count >= 90) { count = 1; Thread.Sleep(700000); } } } } ToolCoreDb.ExecuteProcedure(); string sql = "update a set a.FkId= c.Id FROM AttenCorp a left join CorpInfo c on c.CorpName=A.CorpName"; ToolDb.ExecuteSql(sql); return(null); }