protected override bool UpdateItemsToDb(List <Jc_McInfo> updateItems) { try { IEnumerable <IGrouping <string, Jc_McInfo> > groupYYYYMMDD = updateItems.GroupBy(p => p.Timer.ToString("yyyyMMdd")); foreach (IGrouping <string, Jc_McInfo> info in groupYYYYMMDD) { var initialinfolist = info.ToList(); var initialModels = ObjectConverter.CopyList <Jc_McInfo, Jc_McModel>(initialinfolist); if (!runLogRepositoty.BulkUpdate("KJ_DataDetail" + info.Key, initialModels, BuildDataColumn(columns), "ID")) { int isconn = runLogRepositoty.GetTotalRecord("DataToDb_GetDbServerIsNormal"); if (isconn <= 0) { AddDataToLocal(initialinfolist); } } } return(true); } catch (Exception ex) { LogHelper.Error("密采数据更新失败:" + "\r\n" + ex.Message); return(false); } }
protected override bool UpdateLocalDataToDb(List <Jc_McInfo> updateLocalItems) { if (updateLocalItems.Any()) { var key = updateLocalItems[0].Timer.ToString("yyyyMMdd"); var initialModels = ObjectConverter.CopyList <Jc_McInfo, Jc_McModel>(updateLocalItems); return(initialRepositoty.BulkUpdate("KJ_DataDetail" + key, initialModels, BuildDataColumn(columns), "ID")); } return(true); }