aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Configuration.cs
blob: 2b06733170dd781a2fda4a9aca7b8eca3d43c87a (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
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Tango.BL.Entities
{
    public partial class Configuration
    {
        [NotMapped]
        [XmlIgnore]
        [JsonIgnore]
        public IEnumerable<IdsPack> NoneEmptyIdsPacks
        {
            get { return IdsPacks.Where(x => !x.IsEmpty); }
        }

        public override void DefferedDelete(ObservablesContext context)
        {
            IdsPacks.ToList().ForEach(x => x.DefferedDelete(context));
            var machine_configurations = context.MachinesConfigurations.Where(x => x.Configuration == this);
            MachinesConfigurations.ToList().ForEach(x => x.DefferedDelete(context));
            base.DefferedDelete(context);
            IdsPacks.Clear();
        }

        public override void Delete(ObservablesContext context)
        {
            IdsPacks.ToList().ForEach(x => x.DefferedDelete(context));
            var machine_configurations = context.MachinesConfigurations.Where(x => x.Configuration == this);
            MachinesConfigurations.ToList().ForEach(x => x.DefferedDelete(context));
            base.Delete(context);
            IdsPacks.Clear();
        }
    }
}