/// <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; } } return(data); }
private static void ValidateDetail(int i, Dictionary <string, string> errorDic, TR01BViewModel detail, EditType type) { string typeStr = type == EditType.Update ? "Update" : "Insert"; if (detail.ITM_NO != null || detail.ITM_NO.Length < 1) { errorDic.Add($"{typeStr}[{i}].ITM_NO", "必填");//display error in cell } if (detail.PUR_QT < 0) { errorDic.Add($"{typeStr}[{i}].OUT_QT", "不可為負");//display error in cell } }