Exemple #1
0
        public static bool CopyCable(CableInfo cable, string username)
        {
            var newCbale = new CableInfo(cable)
            {
                CableName  = cable.CableName + " 副本",
                CreateUser = username,
                ModifyDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            };

            TmpCables.Add(newCbale);

            var circuits = TmpCircuits.Where(circuit => circuit.ParentCableId == cable.CableId).ToList();

            foreach (var srcCircuit in circuits)
            {
                var circuit = new CircuitInfo(srcCircuit)
                {
                    ParentCableId = newCbale.CableId,
                };
                TmpCircuits.Add(circuit);
            }

            var dots = TmpDots.Where(dot => dot.ParentCableId == cable.CableId).ToList();

            foreach (var srcDot in dots)
            {
                var dot = new DotInfo(srcDot)
                {
                    ParentCableId = newCbale.CableId
                };
                TmpDots.Add(dot);
            }
            return(true);
        }
Exemple #2
0
 public static int GetMaxCircuitId(CableInfo cable)
 {
     if (TmpCircuits == null || TmpCircuits.Count <= 0)
     {
         return(0);
     }
     return(TmpCircuits.Where(circuit => circuit.ParentCableId == cable.CableId).Max(x => x.CircuitId));
 }