You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.9 KiB
C#
93 lines
3.9 KiB
C#
using AutoMapper;
|
|
using DSWeb.Common.DB;
|
|
using DSWeb.Areas.CompanyManage.Models;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using DSWeb.Areas.CmaCtrn.Models;
|
|
using DSWeb.Areas.SysMng.Models.OpRecord;
|
|
using DSWeb.Filter;
|
|
using DSWeb.Common.Helper;
|
|
using DSWeb.Areas.SysMng.Models.AccountConfig;
|
|
using DSWeb.Common.Model;
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeCustFee;
|
|
using DSWeb.Areas.SysMng.Models.OpTask;
|
|
using DSWeb.Areas.MvcShipping.Models.MsOpRule;
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeEdi;
|
|
using DSWeb.Areas.SysMng.Models.MpConfig;
|
|
|
|
namespace DSWeb
|
|
{
|
|
public static class AutoMapperConfig
|
|
{
|
|
public static void Init()
|
|
{
|
|
Mapper.Initialize(cfg =>
|
|
{
|
|
|
|
cfg.CreateMap<CompanyBank, BankListModel>();
|
|
|
|
|
|
|
|
cfg.CreateMap<CmaCtrnRecord, CmaCtrnRecordListViewModel>()
|
|
;
|
|
|
|
cfg.CreateMap<SysOpRecord, RespModelOpRecordData>()
|
|
.ForMember(x => x.ModuleName, map => map.MapFrom(t => EnumHelper.GetDescription(typeof(OpRecordModule), t.ModuleId)))
|
|
.ForMember(x => x.CateName, map => map.MapFrom(t => EnumHelper.GetDescription(typeof(OpRecordCate), t.CateId)))
|
|
;
|
|
|
|
|
|
cfg.CreateMap<SysAccountConfig, AccountConfigListViewModel>()
|
|
.ForMember(x => x.TypeName, map => map.MapFrom(t => EnumHelper.GetDescription(typeof(AccountConfigType), t.Type)))
|
|
.ForMember(x => x.CategoryName, map => map.MapFrom(t => EnumHelper.GetDescription(typeof(AccountConfigCate), t.Category)))
|
|
.ForMember(x => x.CreateTime, map => map.MapFrom(t => t.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")))
|
|
;
|
|
|
|
|
|
cfg.CreateMap<AccountConfigSaveViewModel, SysAccountConfig>()
|
|
;
|
|
|
|
cfg.CreateMap<AddFeeViewModel, CustFee>()
|
|
;
|
|
|
|
|
|
#region op_rule
|
|
cfg.CreateMap<OpRule, OpRuleListViewModel>()
|
|
.ForMember(x => x.EnableDisableTime, m =>
|
|
{
|
|
m.MapFrom(d => d.EnableDisableTime.HasValue ? d.EnableDisableTime.Value.ToString("yyyy/MM/dd HH:mm:ss") : "");
|
|
});
|
|
cfg.CreateMap<OpRule, OpRuleEditViewModel>();
|
|
cfg.CreateMap<OpRuleEditViewModel, OpRule>();
|
|
cfg.CreateMap<OpRuleItemEditViewModel, OpRuleItem>();
|
|
cfg.CreateMap<OpRule, OpRuleCheckListViewModel>();
|
|
cfg.CreateMap<OpRuleItem, OpRuleItemCheckListViewModel>();
|
|
#endregion
|
|
|
|
|
|
//个人邮箱配置
|
|
cfg.CreateMap<MailUserAccountSaveModel, MailUserAccountInfo>()
|
|
.ForMember(x => x.ReceiveSSL, map => map.MapFrom(t => t.ReceiveSSL.ToLower() == "on" ? true : false))
|
|
.ForMember(x => x.SmtpSSL, map => map.MapFrom(t => t.SmtpSSL.ToLower() == "on" ? true : false))
|
|
;
|
|
|
|
//舱单EDI
|
|
cfg.CreateMap<OpSeaeEdi, MsOpSeaeEdi>().ReverseMap();
|
|
|
|
//公众号配置
|
|
cfg.CreateMap<MpConfigInfo, MpConfigListViewModel>()
|
|
.ForMember(x => x.CreateTime, map => map.MapFrom(t => t.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")))
|
|
.ForMember(x => x.ModifyTime, map => map.MapFrom(t => t.ModifyTime.HasValue ? t.ModifyTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
|
|
cfg.CreateMap<MpConfigSaveViewModel, MpConfigInfo>();
|
|
cfg.CreateMap<MpConfigTemplate, MpConfigTemplateListViewModel>()
|
|
.ForMember(x => x.CreateTime, map => map.MapFrom(t => t.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")))
|
|
.ForMember(x => x.ModifyTime, map => map.MapFrom(t => t.ModifyTime.HasValue ? t.ModifyTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
|
|
cfg.CreateMap<MpConfigTemplateSaveViewModel, MpConfigTemplate>();
|
|
|
|
});
|
|
}
|
|
}
|
|
} |