/// <summary> /// 保存明细表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="dataItemDetailEntity">明细实体</param> /// <returns></returns> public void SaveForm(string keyValue, DataItemDetailEntity dataItemDetailEntity) { if (!string.IsNullOrEmpty(keyValue)) { dataItemDetailEntity.Modify(keyValue); Base_DataItemDetail detail = Base_DataItemDetail.SingleOrDefault("where ItemDetailId=@0", keyValue); detail = EntityConvertTools.CopyToModel <DataItemDetailEntity, Base_DataItemDetail>(dataItemDetailEntity, detail); detail.ItemDetailId = keyValue; detail.Update(); } else { dataItemDetailEntity.Create(); Base_DataItemDetail detail = EntityConvertTools.CopyToModel <DataItemDetailEntity, Base_DataItemDetail>(dataItemDetailEntity, null); detail.Insert(); } }
/// <summary> /// 明细实体 /// </summary> /// <param name="keyValue">主键值</param> /// <returns></returns> public DataItemDetailEntity GetEntity(string keyValue) { var detail = Base_DataItemDetail.SingleOrDefault("where ItemDetailId=@0", keyValue); return(EntityConvertTools.CopyToModel <Base_DataItemDetail, DataItemDetailEntity>(detail, null)); }