diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-03 13:36:10 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-03 13:36:10 +0200 |
| commit | 185865c043b5fdaffef5356e305e0cc553ccc126 (patch) | |
| tree | 307084e5e9eb63e68356a1b5908edde068ca7a21 /Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs | |
| parent | 25f5e6ddef7ef2fa0a747305847eeb4ceee5a2c9 (diff) | |
| download | Tango-185865c043b5fdaffef5356e305e0cc553ccc126.tar.gz Tango-185865c043b5fdaffef5356e305e0cc553ccc126.zip | |
Added new BL entities with inheritance !!!!
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs | 221 |
1 files changed, 29 insertions, 192 deletions
diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs index 3380f9b90..56fa7d0aa 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs @@ -1,214 +1,55 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Tango Observables Generator -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. Do not modify! -// </auto-generated> -//------------------------------------------------------------------------------ - using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Xml.Serialization; -using Newtonsoft.Json; +using System.Data.Entity; using System.Linq; -using Tango.DAL.Remote.DB; -using Tango.Core; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Builders; namespace Tango.BL.Entities { - [Table("MACHINE_VERSIONS")] - public partial class MachineVersion : ObservableEntity<MachineVersion> + public partial class MachineVersion : MachineVersionBase { - - public event EventHandler<Double> VersionChanged; - - public event EventHandler<String> NameChanged; - - public event EventHandler<String> PrototypeMachineDataChanged; - - public event EventHandler<SynchronizedObservableCollection<Machine>> MachinesChanged; - - public event EventHandler<SynchronizedObservableCollection<TangoVersion>> TangoVersionsChanged; - - protected Double _version; - - /// <summary> - /// Gets or sets the machineversion version. - /// </summary> - - [Column("VERSION")] - - public Double Version + public async Task ApplyPrototypeMachine(Machine machine, ObservablesContext context) { - get - { - return _version; - } - - set - { - if (_version != value) - { - _version = value; - - OnVersionChanged(value); + machine = await new MachineBuilder(context) + .Set(machine) + .WithOrganization() + .WithConfiguration() + .WithSpools() + .WithCats() + .BuildAsync(); - } - } + PrototypeMachineData = machine.ToJson(); } - protected String _name; - - /// <summary> - /// Gets or sets the machineversion name. - /// </summary> - - [Column("NAME")] - - public String Name + public Machine CreatePrototypeMachine(ObservablesContext context) { - get - { - return _name; - } + Machine machine = Machine.FromJson(PrototypeMachineData); + machine.OrganizationGuid = null; + machine.ConfigurationGuid = null; + machine.ConfigurationGuid = machine.Configuration.Guid; - set + foreach (var cat in machine.Cats) { - if (_name != value) - { - _name = value; - - OnNameChanged(value); - - } + cat.MachineGuid = machine.Guid; } - } - - protected String _prototypemachinedata; - /// <summary> - /// Gets or sets the machineversion prototype machine data. - /// </summary> - - [Column("PROTOTYPE_MACHINE_DATA")] - - public String PrototypeMachineData - { - get - { - return _prototypemachinedata; - } + machine.MachineVersionGuid = Guid; + machine.ProductionDate = DateTime.UtcNow; - set + foreach (var idsPack in machine.Configuration.IdsPacks) { - if (_prototypemachinedata != value) - { - _prototypemachinedata = value; - - OnPrototypeMachineDataChanged(value); - - } + idsPack.DispenserGuid = null; + idsPack.ConfigurationGuid = machine.ConfigurationGuid; } - } - - protected SynchronizedObservableCollection<Machine> _machines; - /// <summary> - /// Gets or sets the machineversion machines. - /// </summary> - - public virtual SynchronizedObservableCollection<Machine> Machines - { - get + foreach (var spool in machine.Spools) { - return _machines; + spool.MachineGuid = machine.Guid; } - set - { - if (_machines != value) - { - _machines = value; - - OnMachinesChanged(value); - - } - } - } - - protected SynchronizedObservableCollection<TangoVersion> _tangoversions; - - /// <summary> - /// Gets or sets the machineversion tango versions. - /// </summary> - - public virtual SynchronizedObservableCollection<TangoVersion> TangoVersions - { - get - { - return _tangoversions; - } - - set - { - if (_tangoversions != value) - { - _tangoversions = value; - - OnTangoVersionsChanged(value); - - } - } - } - - /// <summary> - /// Called when the Version has changed. - /// </summary> - protected virtual void OnVersionChanged(Double version) - { - VersionChanged?.Invoke(this, version); - RaisePropertyChanged(nameof(Version)); - } - - /// <summary> - /// Called when the Name has changed. - /// </summary> - protected virtual void OnNameChanged(String name) - { - NameChanged?.Invoke(this, name); - RaisePropertyChanged(nameof(Name)); - } - - /// <summary> - /// Called when the PrototypeMachineData has changed. - /// </summary> - protected virtual void OnPrototypeMachineDataChanged(String prototypemachinedata) - { - PrototypeMachineDataChanged?.Invoke(this, prototypemachinedata); - RaisePropertyChanged(nameof(PrototypeMachineData)); - } - - /// <summary> - /// Called when the Machines has changed. - /// </summary> - protected virtual void OnMachinesChanged(SynchronizedObservableCollection<Machine> machines) - { - MachinesChanged?.Invoke(this, machines); - RaisePropertyChanged(nameof(Machines)); - } - - /// <summary> - /// Called when the TangoVersions has changed. - /// </summary> - protected virtual void OnTangoVersionsChanged(SynchronizedObservableCollection<TangoVersion> tangoversions) - { - TangoVersionsChanged?.Invoke(this, tangoversions); - RaisePropertyChanged(nameof(TangoVersions)); + return machine; } /// <summary> @@ -217,10 +58,6 @@ namespace Tango.BL.Entities public MachineVersion() : base() { - Machines = new SynchronizedObservableCollection<Machine>(); - - TangoVersions = new SynchronizedObservableCollection<TangoVersion>(); - } } } |
