private List <Centerr> GetListOfNewRecords(List <Centerr> checkRows) // проверка по всем записям - ДОЛЬШЕ { List <Centerr> inpList = (List <Centerr>) this.ListResponse; List <Centerr> result = new List <Centerr>(); if (inpList == null) { lastError = MyRequest.LastError(); return(result); } bool needBreak = false; for (int i = 0; i < inpList.Count; i++) { for (int j = 0; j < checkRows.Count; j++) { //if (inpList[i].ToString() == checkRows[j].ToString()) if (inpList[i].Equals(checkRows[j])) { needBreak = true; break; } } if (needBreak) { continue; } result.Add(inpList[i]); } return(result); }
public string NewRecordsOutput(IResponse checkResponse = null, bool html = true) { if (!haveNewRecords) { if (!HaveNewRecords(checkResponse)) { if (MyRequest.LastError() != null) { return("ERROR: " + MyRequest.LastError().Message); } else { return(""); } } } string itemsTable = CreateTableForMailing(html); return(PrepareMailBody(itemsTable, NewRecords.Count(), html)); /* * if (HaveNewRecords(checkResponse)) * { * string itemsTable = CreateTableForMailing(html); * return PrepareMailBody(itemsTable, NewRecords.Count(), html); * } * return MyRequest.LastError.Message; */ }
/// <summary> /// Выполняет проверку каждого результата с каждым объектом из переданного списка /// </summary> /// <param name="checkRows">Передаваемый список для сравнения</param> /// <returns>Список новых результатов, не найденных в списке старых результатов</returns> private List <IObject> GetListOfNewRecords(IEnumerable <IObject> checkRows) // проверка по всем записям - ДОЛЬШЕ { IEnumerable <IObject> inpList = this.ListResponse; List <IObject> result = new List <IObject>(); if (inpList == null) { lastError = MyRequest.LastError(); return(result); } if (checkRows == null) // Если старый список пуст (такое возможно, если был таймаут при получении первых результатов), { return(inpList.ToList()); // то возвращать список нового запроса. } bool needBreak = false; for (int i = 0; i < inpList.Count(); i++) { for (int j = 0; j < checkRows.Count(); j++) { //if (inpList[i].ToString() == checkRows[j].ToString()) if (inpList.ElementAt(i).Equals(checkRows.ElementAt(j))) { needBreak = true; break; } } if (needBreak) { continue; } result.Add(inpList.ElementAt(i)); } return(result); }
/// <summary> /// Заполняет объекты торга по результатам запроса /// </summary> protected virtual bool FillListResponse() { lastAnswer = MyRequest.GetResponse; if (lastAnswer == null) { if (lastError == null) { lastError = MyRequest.LastError(); } return(false); } return(true); }
private List <Centerr> GetListOfNewRecords(Centerr checkRowItem) // проверка только по одной записи { List <Centerr> inpList = (List <Centerr>) this.ListResponse; List <Centerr> result = new List <Centerr>(); if (inpList == null) { lastError = MyRequest.LastError(); return(result); } for (int i = 0; i < inpList.Count; i++) { //if (inpList[i].ToString() == checkRowItem.ToString()) if (inpList[i].Equals(checkRowItem)) { break; } result.Add(inpList[i]); } return(result); }
/// <summary> /// Выполняет поиск переданного объекта среди новых результатов запроса /// </summary> /// <param name="checkRowItem">Передаваемый объект для поиска</param> /// <returns>Список новых результатов</returns> private List <IObject> GetListOfNewRecords(IObject checkRowItem) // проверка только по одной записи { IEnumerable <IObject> inpList = this.ListResponse; List <IObject> result = new List <IObject>(); if (inpList == null) { lastError = MyRequest.LastError(); return(result); } for (int i = 0; i < inpList.Count(); i++) { //if (inpList[i].ToString() == checkRowItem.ToString()) if (inpList.ElementAt(i).Equals(checkRowItem)) { break; } result.Add(inpList.ElementAt(i)); } return(result); }