/*搜索药物信息:提交关键词,返回含有该关键词的所有药物的信息*/ public AllPhysicInfo FindPhysicByName(string keyword) { AllPhysicInfoEntity allPhysicInfoEntity = null; if (keyword == null) { allPhysicInfoEntity = new AllPhysicInfoEntity(); allPhysicInfoEntity.ErrorMessage = "123 Empty Keyword of Physic Name! @Service"; } else { allPhysicInfoEntity = openAccessLogic.FindPhysicByName(keyword); } AllPhysicInfo allPhysicInfo = new AllPhysicInfo(); TranslateAllPhysicInfoEntityToAllPhysicInfoContractData(allPhysicInfoEntity, allPhysicInfo); return allPhysicInfo; }
/*将AllPhysicInfo对应的Entity翻译为数据契约,调用TranslatePhysicInfoEntityToPhysicInfoContractData()*/ private void TranslateAllPhysicInfoEntityToAllPhysicInfoContractData( AllPhysicInfoEntity allPhysicInfoEntity, AllPhysicInfo allPhysicInfo) { int cnt = 0; allPhysicInfo.ErrorMessage = allPhysicInfoEntity.ErrorMessage; allPhysicInfo.Count = allPhysicInfoEntity.Count; if (allPhysicInfo.Count > 0) { allPhysicInfo.physicInfo = new PhysicInfo[allPhysicInfo.Count]; for (cnt = 0; cnt < allPhysicInfo.Count; cnt++) { allPhysicInfo.physicInfo[cnt] = new PhysicInfo(); TranslatePhysicInfoEntityToPhysicInfoContractData( allPhysicInfoEntity.physicInfoEntity[cnt], allPhysicInfo.physicInfo[cnt]); } } }
/*取回所有药物编号和名称*/ public AllPhysicInfo RetrievePhysicList() { AllPhysicInfoEntity allPhysicInfoEntity = openAccessLogic.RetrievePhysicList(); AllPhysicInfo allPhysicInfo = new AllPhysicInfo(); TranslateAllPhysicInfoEntityToAllPhysicInfoContractData(allPhysicInfoEntity, allPhysicInfo); return allPhysicInfo; }