Files
cms_thermo_active/Step.Model/DTOModels/ToolModels/DTONcShankModel.cs
T
Lucio Maranta d85bb1fd0e Added alarm notes
WIP Fanuc tool table
WIP Siemens Active program fix
2018-10-23 17:33:00 +02:00

79 lines
2.2 KiB
C#

using Step.Model.DatabaseModels;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Step.Model.DTOModels.ToolModels
{
public class DTONewNcShankModel
{
[Required]
public ushort? Balluf { get; set; }
[Required]
public byte MagazinePositionType { get; set; }
public static explicit operator DTONewNcShankModel(DbNcShankModel obj)
{
return new DTONewNcShankModel()
{
Balluf = (ushort)obj.Balluf,
MagazinePositionType = obj.MagazinePositionType
};
}
public static explicit operator DbNcShankModel(DTONewNcShankModel obj)
{
return new DbNcShankModel()
{
Balluf = obj.Balluf,
MagazinePositionType = obj.MagazinePositionType
};
}
}
public class DTONcShankModel : DTONewNcShankModel
{
public short Id { get; set; }
[Range(1, byte.MaxValue)]
public byte? MagazineId { get; set; }
[Range(1, byte.MaxValue)]
public byte? PositionId { get; set; }
public List<DTONcToolModel> ChildsTools { get; set; }
public static explicit operator DTONcShankModel(DbNcShankModel obj)
{
List<DTONcToolModel> tools = new List<DTONcToolModel>();
if (obj.Tools != null)
foreach (var tool in obj.Tools)
{
tools.Add((DTONcToolModel)tool);
}
return new DTONcShankModel()
{
Id = obj.ShankId,
Balluf = (ushort)obj.Balluf,
MagazinePositionType = obj.MagazinePositionType,
MagazineId = obj.MagazineId,
PositionId = obj.PositionId,
ChildsTools = tools
};
}
public static explicit operator DbNcShankModel(DTONcShankModel obj)
{
return new DbNcShankModel()
{
ShankId = obj.Id,
Balluf = obj.Balluf,
MagazinePositionType = obj.MagazinePositionType,
MagazineId = obj.MagazineId,
PositionId = obj.PositionId
};
}
}
}