/// <summary> /// Entity转Model /// </summary> /// <param name="entity"></param> /// <returns></returns> private LaboratoryTestItem EntityToModel(HR_LABORATORYTESTITEM entity) { if (entity != null) { LaboratoryTestItem model = new LaboratoryTestItem() { TestitemId = entity.TESTITEMID, ItemId = entity.ITEMID, Ordernumber = entity.ORDERNUMBER, ItemName = entity.ITEMNAME, ItemNameEN = entity.ITEMNAMEEN, ItemValue = entity.ITEMVALUE, Reslut = entity.RESLUT, Uom = entity.UOM, NormalValue = entity.NORMALVALUE, ReferenceValue = entity.REFERENCEVALUE, LabresultId = entity.LABRESULTID, InspectedMeans = entity.INSPECTEDMEANS, ItemUnitId = entity.ITEMUNITID }; return(model); } return(null); }
/// <summary> /// Model转Entity /// </summary> /// <param name="model"></param> /// <returns></returns> private HR_LABORATORYTESTITEM ModelToEntity(LaboratoryTestItem model) { if (model != null) { HR_LABORATORYTESTITEM entity = new HR_LABORATORYTESTITEM() { TESTITEMID = model.TestitemId, ITEMID = model.ItemId, ORDERNUMBER = model.Ordernumber, ITEMNAME = model.ItemName, ITEMNAMEEN = model.ItemNameEN, ITEMVALUE = model.ItemValue, RESLUT = model.Reslut, UOM = model.Uom, NORMALVALUE = model.NormalValue, REFERENCEVALUE = model.ReferenceValue, LABRESULTID = model.LabresultId, INSPECTEDMEANS = model.InspectedMeans, ITEMUNITID = model.ItemUnitId }; return(entity); } return(null); }
/// <summary> /// 更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Edit(LaboratoryTestItem model) { if (model == null) { return(false); } using (LaboratoryTestItemDAL dal = new LaboratoryTestItemDAL()) { HR_LABORATORYTESTITEM entity = ModelToEntity(model); return(dal.Edit(entity)); } }
/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(LaboratoryTestItem model) { if (model == null) { return(string.Empty); } using (LaboratoryTestItemDAL dal = new LaboratoryTestItemDAL()) { HR_LABORATORYTESTITEM entity = ModelToEntity(model); entity.TESTITEMID = string.IsNullOrEmpty(model.TestitemId) ? Guid.NewGuid().ToString("N") : model.TestitemId; return(dal.Add(entity)); } }