/// <summary>viewmodel to entity </summary> /// <param name="entity"></param> private static TR01B ToEntity(TR01BViewModel data) { var entity = new TR01B(); if (data != null) { //資料處理 var objectHelper = new ActWeis.Utility.ObjectHelper(); objectHelper.CopyValue(data, entity); } return(entity); }
/// <summary>Entity to viewmodel Single</summary> /// <param name="entity">TR01B</param> public static TR01BViewModel FromEntity(TR01B entity) { var data = new TR01BViewModel(); if (entity != null) { var objectHelper = new ActWeis.Utility.ObjectHelper(); objectHelper.CopyValue(entity, data); //資料處理 var item = CacheCommonDataModule.GetBA02A().Where(x => x.BA02A_ID == entity.BA02A_ID).FirstOrDefault(); if (item != null) { data.ITM_NO = item.ITM_NO; data.ITM_NM = item.ITM_NM; data.ITM_SP = item.ITM_SP; } } return(data); }