public int CompareTo(object obj) { int res = -1; VashmagazinPhone phone = obj as VashmagazinPhone; if (phone != null) { res = this.Phone.CompareTo(phone.Phone); if (res == 0) { if (this.Rubric < phone.Rubric) { res = -1; } else { if (this.Rubric > phone.Rubric) { res = 1; } else { if (this.Rubric == phone.Rubric) { res = 0; } } } } } return(res); }
protected ICollection <VashmagazinPhone> parseHtmlPageForGetPhone(string pageHtml, Rubrics rubric, out bool hasError) { ICollection <VashmagazinPhone> phones = new List <VashmagazinPhone>(); HtmlDocument page = new HtmlDocument(); page.LoadHtml(pageHtml); hasError = containErrorBlock(page); if (!hasError) { HtmlNode table = page.DocumentNode.SelectSingleNode(xpathRows);//xpathRows IEnumerable <HtmlNode> rows = table.Elements("tr"); hasError = rows.Count() == 0; if (!hasError) { IEnumerator <HtmlNode> currentRow = rows.GetEnumerator(); while (currentRow.MoveNext()) { if (isNewRow(currentRow.Current)) { if (currentRow.MoveNext()) { string phone = getPhoneFromRow(currentRow); VashmagazinPhone vashmagazinPhone = new VashmagazinPhone(); vashmagazinPhone.Phone = phone; vashmagazinPhone.Rubric = rubric; phones.Add(vashmagazinPhone); currentRow.MoveNext(); currentRow.MoveNext(); currentRow.MoveNext(); } } } } } return(phones); }