protected override bool UpdateItemsToDb(List <Jc_MInfo> updateItems) { try { IEnumerable <IGrouping <string, Jc_MInfo> > groupYYYYMMDD = updateItems.GroupBy(p => p.Timer.ToString("yyyyMMdd")); foreach (IGrouping <string, Jc_MInfo> info in groupYYYYMMDD) { var fivemininfolist = info.ToList(); var fivemModels = ObjectConverter.CopyList <Jc_MInfo, Jc_MModel>(fivemininfolist); if (!fiveMinRepository.BulkUpdate("KJ_StaFiveMinute" + info.Key, fivemModels, BuildDataColumn(columns), "ID")) { int isconn = fiveMinRepository.GetTotalRecord("DataToDb_GetDbServerIsNormal"); if (isconn <= 0) { AddDataToLocal(fivemininfolist); } } } return(true); } catch (Exception ex) { LogHelper.Error("五分钟数据更新失败:" + "\r\n" + ex.Message); return(false); } }
protected override bool UpdateLocalDataToDb(List <Jc_MInfo> updateLocalItems) { if (updateLocalItems.Any()) { updateLocalItems.ForEach(o => o.Bz4 = "2"); var key = updateLocalItems[0].Timer.ToString("yyyyMMdd"); var fivemModels = ObjectConverter.CopyList <Jc_MInfo, Jc_MModel>(updateLocalItems); return(fiveMinRepository.BulkUpdate("KJ_StaFiveMinute" + key, fivemModels, BuildDataColumn(columns), "ID")); } return(true); }