Beispiel #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);
        }
Beispiel #2
0
        public static bool AddCable(CableInfo cable)
        {
            TmpCables.Add(cable);
            var circuitInfo = new CircuitInfo
            {
                ParentCableId = cable.CableId,
                CircuitId     = 0,
                Name          = "空点"
            };

            AddCircuit(circuitInfo);
            return(true);
        }