blob: 9dab200d6412d234fd059547fb908a8228446a3e (
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
/// <summary>
/// Contains <see cref="Configuration"/> extension methods.
/// </summary>
public static class ConfigurationExtensions
{
/// <summary>
/// Clones the configuration along with it's IDS packs.
/// </summary>
/// <param name="configuration">The configuration.</param>
/// <returns></returns>
public static Configuration CloneConfiguration(this Configuration configuration)
{
Configuration cloned = configuration.CloneEntity();
cloned.CreationDate = DateTime.UtcNow;
foreach (var idsPack in configuration.IdsPacks)
{
IdsPack clonedPack = idsPack.CloneEntity();
clonedPack.Configuration = cloned;
clonedPack.DispenserType = idsPack.DispenserType;
clonedPack.CartridgeType = idsPack.CartridgeType;
clonedPack.MidTankType = idsPack.MidTankType;
clonedPack.IdsPackFormula = idsPack.IdsPackFormula;
clonedPack.IsEmpty = idsPack.IsEmpty;
cloned.IdsPacks.Add(clonedPack);
}
return cloned;
}
}
|