public static bool CacheDelCable() { var delCables = DbCables.Except(TmpCables).ToList(); if (delCables.Count > 0) { foreach (var cable in delCables) { DbCables.Remove(cable); } DbGraph.DelCables(delCables); } var delCircuits = DbCircuits.Except(TmpCircuits).ToList(); if (delCircuits.Count > 0) { foreach (var circuit in delCircuits) { DbCircuits.Remove(circuit); } DbGraph.DelCircuits(delCircuits); } var delDots = DbDots.Except(TmpDots).ToList(); if (delDots.Count > 0) { foreach (var dot in delDots) { DbDots.Remove(dot); } DbGraph.DelDots(delDots); } return(true); }
public static bool CacheCopyCable() { var newCables = TmpCables.Except(DbCables).ToList(); if (newCables.Count > 0) { DbCables.AddRange(newCables); DbGraph.InsertCables(newCables); } var newCircusts = TmpCircuits.Except(DbCircuits).ToList(); if (newCircusts.Count > 0) { DbCircuits.AddRange(newCircusts); DbGraph.InsertCircuits(newCircusts); } var newDots = TmpDots.Except(DbDots).ToList(); if (newDots.Count > 0) { DbDots.AddRange(newDots); DbGraph.InsertDots(newDots); } return(true); }
public bool CacheInit() { List <CableInfo> cableList; DbGraph.SelectCables(out cableList); DbCables = cableList; TmpCables = new List <CableInfo>(cableList); List <CircuitInfo> circuitList; DbGraph.SelectCircuits(out circuitList); DbCircuits = circuitList; TmpCircuits = new List <CircuitInfo>(circuitList); List <DotInfo> dotList; DbGraph.SelectDots(out dotList); DbDots = dotList; TmpDots = new List <DotInfo>(dotList); return(true); }
public static bool CacheAddCable() { var updataCables = TmpCables.Intersect(DbCables).ToList(); if (updataCables.Count > 0) { DbGraph.UpdateCables(updataCables); } var newCables = TmpCables.Except(DbCables).ToList(); if (newCables.Count > 0) { DbCables.AddRange(newCables); DbGraph.InsertCables(newCables); } var newCircusts = TmpCircuits.Except(DbCircuits).ToList(); if (newCircusts.Count > 0) { DbCircuits.AddRange(newCircusts); DbGraph.InsertCircuits(newCircusts); } return(true); }
//更新所有样线记录 public static bool CacheSaveCable() { //cable var updataCables = TmpCables.Intersect(DbCables).ToList(); if (updataCables.Count > 0) { DbGraph.UpdateCables(updataCables); } var newCables = TmpCables.Except(DbCables).ToList(); if (newCables.Count > 0) { DbCables.AddRange(newCables); DbGraph.InsertCables(newCables); } var delCables = DbCables.Except(TmpCables).ToList(); if (delCables.Count > 0) { foreach (var cable in delCables) { DbCables.Remove(cable); } DbGraph.DelCables(delCables); } //circuit var updataCircuits = TmpCircuits.Intersect(DbCircuits).ToList(); if (updataCircuits.Count > 0) { DbGraph.UpdataCircuits(updataCircuits); } var newCircusts = TmpCircuits.Except(DbCircuits).ToList(); if (newCircusts.Count > 0) { DbCircuits.AddRange(newCircusts); DbGraph.InsertCircuits(newCircusts); } var delCircuits = DbCircuits.Except(TmpCircuits).ToList(); if (delCircuits.Count > 0) { foreach (var circuit in delCircuits) { DbCircuits.Remove(circuit); } DbGraph.DelCircuits(delCircuits); } //dot var updataDots = TmpDots.Intersect(DbDots).ToList(); if (updataDots.Count > 0) { DbGraph.UpdataDots(updataDots); } var newDots = TmpDots.Except(DbDots).ToList(); if (newDots.Count > 0) { DbDots.AddRange(newDots); DbGraph.InsertDots(newDots); } var delDots = DbDots.Except(TmpDots).ToList(); if (delDots.Count > 0) { foreach (var dot in delDots) { DbDots.Remove(dot); } DbGraph.DelDots(delDots); } return(true); }