aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/Entities/HardwareVersion.cs
blob: 98580f244c2acc4c3658cfa27e912abd079fb6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Serialization;

namespace Tango.BL.Entities
{
    public partial class HardwareVersion : HardwareVersionBase
    {
        public override HardwareVersion Clone()
        {
            var cloned = base.Clone();
            cloned.HardwareMotors = HardwareMotors.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            cloned.HardwareDancers = HardwareDancers.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            cloned.HardwarePidControls = HardwarePidControls.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            cloned.HardwareWinders = HardwareWinders.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            cloned.HardwareSpeedSensors = HardwareSpeedSensors.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            cloned.HardwareBlowers = HardwareBlowers.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            cloned.HardwareBreakSensors = HardwareBreakSensors.Select(x => x.Clone(y => y.HardwareVersion = cloned)).ToSynchronizedObservableCollection();
            return cloned;
        }

        public override void Delete(ObservablesContext context)
        {
            HardwareDancers.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareMotors.ToList().ForEach(x => x.DefferedDelete(context));
            HardwarePidControls.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareWinders.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareSpeedSensors.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareBlowers.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareBreakSensors.ToList().ForEach(x => x.DefferedDelete(context));
            base.Delete(context);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="HardwareVersion" /> class.
        /// </summary>
        public HardwareVersion() : base()
        {

        }
    }
}