Syncher fix

This commit is contained in:
Mikhail Kuznetsov
2023-06-05 16:28:36 +10:00
parent 730293f9fa
commit 8a72550ff0
12 changed files with 290 additions and 21 deletions

View File

@@ -0,0 +1,35 @@
using AutoMapper;
using System.Xml;
namespace PARR.AIHIT.MappingProfiles
{
internal class RequestToDomain : Profile
{
public RequestToDomain()
{
CreateMap<XmlNode, PARR.DAL.Models.Host>()
.ForMember(d => d.HostName, o => o.MapFrom(s => (s.Attributes!["ХОСТ"] != null) ? s.Attributes!["ХОСТ"]!.Value.Trim() : ""))
.ForMember(d => d.IP, o => o.MapFrom(s => s.Attributes!["IP_АДРЕС"]!.Value.Trim()))
.ForMember(d => d.RegionalEK, o => o.MapFrom(s => s.Attributes!["РЕГИОНАЛЬНЫЙ_ЭК"]!.Value.Trim()))
.ForMember(d => d.LinkEK, o => o.MapFrom(s => s.Attributes!["СВЯЗАННЫЙ_ЭК"]!.Value.Trim()))
.ForMember(d => d.Status, o => o.MapFrom(s => s.Attributes!["СТАТУС"]!.Value.Trim()))
.ForMember(d => d.WorkGroup, o => o.MapFrom(s => (s.Attributes!["РАБОЧАЯ_ГР_ОТВ_ЗАК"] != null) ? s.Attributes!["РАБОЧАЯ_ГР_ОТВ_ЗАК"]!.Value.Trim() : ""))
.ForMember(d => d.Responsible, o => o.MapFrom(s => s.Attributes!["ОТВЕТСТВЕННЫЙ_ЗАК"]!.Value.Trim()))
.ForMember(d => d.OS, o => o.MapFrom(s => (s.Attributes!["ОС"] != null) ? s.Attributes!["ОС"]!.Value.Trim() : ""))
.ForMember(d => d.DB, o => o.MapFrom(s => (s.Attributes!["СУБД"] != null) ? s.Attributes!["СУБД"]!.Value.Trim() : ""))
.ForMember(d => d.APP, o => o.MapFrom(s => (s.Attributes!["СП"] != null) ? s.Attributes!["СП"]!.Value.Trim() : ""));
//CreateMap<PARR.DAL.Models.Host, PARR.DAL.Models.Host>()
// .ForMember(d => d.HostName, o => o.MapFrom(s => s.HostName))
// .ForMember(d => d.IP, o => o.MapFrom(s => s.IP))
// .ForMember(d => d.RegionalEK, o => o.MapFrom(s => s.RegionalEK))
// .ForMember(d => d.LinkEK, o => o.MapFrom(s => s.LinkEK))
// .ForMember(d => d.Status, o => o.MapFrom(s => s.Status))
// .ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.WorkGroup))
// .ForMember(d => d.Responsible, o => o.MapFrom(s => s.Responsible))
// .ForMember(d => d.OS, o => o.MapFrom(s => s.OS))
// .ForMember(d => d.DB, o => o.MapFrom(s => s.DB))
// .ForMember(d => d.APP, o => o.MapFrom(s => s.APP));
}
}
}