/// <summary> /// Create a new PCGSMSPR6070 object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="pCGSNo">Initial value of the PCGSNo property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="desig">Initial value of the Desig property.</param> /// <param name="s60">Initial value of the S60 property.</param> /// <param name="s61">Initial value of the S61 property.</param> /// <param name="s62">Initial value of the S62 property.</param> /// <param name="s63">Initial value of the S63 property.</param> /// <param name="s64">Initial value of the S64 property.</param> /// <param name="s65">Initial value of the S65 property.</param> /// <param name="s66">Initial value of the S66 property.</param> /// <param name="s67">Initial value of the S67 property.</param> /// <param name="s68">Initial value of the S68 property.</param> /// <param name="s69">Initial value of the S69 property.</param> /// <param name="s70">Initial value of the S70 property.</param> /// <param name="total">Initial value of the Total property.</param> public static PCGSMSPR6070 CreatePCGSMSPR6070(global::System.Guid id, global::System.String pCGSNo, global::System.String description, global::System.String desig, global::System.String s60, global::System.String s61, global::System.String s62, global::System.String s63, global::System.String s64, global::System.String s65, global::System.String s66, global::System.String s67, global::System.String s68, global::System.String s69, global::System.String s70, global::System.String total) { PCGSMSPR6070 pCGSMSPR6070 = new PCGSMSPR6070(); pCGSMSPR6070.Id = id; pCGSMSPR6070.PCGSNo = pCGSNo; pCGSMSPR6070.Description = description; pCGSMSPR6070.Desig = desig; pCGSMSPR6070.S60 = s60; pCGSMSPR6070.S61 = s61; pCGSMSPR6070.S62 = s62; pCGSMSPR6070.S63 = s63; pCGSMSPR6070.S64 = s64; pCGSMSPR6070.S65 = s65; pCGSMSPR6070.S66 = s66; pCGSMSPR6070.S67 = s67; pCGSMSPR6070.S68 = s68; pCGSMSPR6070.S69 = s69; pCGSMSPR6070.S70 = s70; pCGSMSPR6070.Total = total; return pCGSMSPR6070; }
/// <summary> /// Deprecated Method for adding a new object to the PCGSMSPR6070 EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPCGSMSPR6070(PCGSMSPR6070 pCGSMSPR6070) { base.AddObject("PCGSMSPR6070", pCGSMSPR6070); }
public static int ImportPCGSMSPR6070() { HtmlWeb webClient = new HtmlWeb(); HtmlAgilityPack.HtmlDocument doc = webClient.Load("http://www.pcgs.com/pop/detail.aspx?c=4207&t=3"); IList<PCGSMSPR6070> pcgss = new List<PCGSMSPR6070>(); foreach (var tr in doc.DocumentNode.SelectNodes("//tr")) { HtmlAgilityPack.HtmlDocument trDoc = new HtmlAgilityPack.HtmlDocument(); trDoc.LoadHtml(tr.InnerHtml); var tds = trDoc.DocumentNode.SelectNodes("//td"); if (tds != null) { PCGSMSPR6070 pcgs = new PCGSMSPR6070(); pcgs.Id = Guid.NewGuid(); for (int i = 0; i < tds.Count; i++) { switch (i) { case 0: pcgs.PCGSNo = tds[i].InnerText.Trim(); break; case 1: pcgs.Description = tds[i].InnerText. Replace("Shop", "").Replace("\n", "").Trim(); break; case 2: pcgs.Desig = tds[i].InnerText.Replace("\n", "").Trim(); break; case 3: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S60 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 4: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S61 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 5: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S62 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 6: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S63 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 7: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S64 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 8: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S65 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 9: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S66 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 10: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S67 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 11: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S68 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 12: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S69 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 13: { var score = Regex.Split(tds[i].InnerHtml, "<br>"); foreach (var s in score) pcgs.S70 += s.Replace("\n", "").Replace(" ", "").Trim() + " "; } break; case 14: pcgs.Total = tds[i].InnerText.Replace("\n", "").Replace(" ", "").Trim(); break; } } if (!pcgs.PCGSNo.ToLower().Contains("total")) pcgss.Add(pcgs); } } using (Entities ctx = new Entities()) { foreach (var pcgs in pcgss) { ctx.PCGSMSPR6070.AddObject(pcgs); } ctx.SaveChanges(); } return pcgss.Count; }