Ejemplo n.º 1
0
        /*获取特定药品信息:输入PhysicID,返回该药品的完整信息*/
        public PhysicInfoEntity GetPhysicInfo(string physicID) {

            DrPEDatabaseEntities DEntities = new DrPEDatabaseEntities();

            var physic = (from d in DEntities.Physics
                          where d.PhysicID == physicID
                          select d).FirstOrDefault();

            PhysicInfoEntity physicInfoEntity = null;
            if (physic != null) {
                physicInfoEntity = new PhysicInfoEntity();

                physicInfoEntity.PhysicID       = physic.PhysicID;
                physicInfoEntity.Name           = physic.Name;
                physicInfoEntity.Description    = physic.Description;
                physicInfoEntity.Method         = physic.Method;
                physicInfoEntity.Notice         = physic.Notice;
            }

            return physicInfoEntity;
        }
        /*将PhysicInfo对应的Entity翻译为数据契约*/
        private void TranslatePhysicInfoEntityToPhysicInfoContractData(
            PhysicInfoEntity    physicInfoEntity,
            PhysicInfo          physicInfo) {

                physicInfo.ErrorMessage = physicInfoEntity.ErrorMessage;
                physicInfo.PhysicID     = physicInfoEntity.PhysicID;
                physicInfo.Name         = physicInfoEntity.Name;
                physicInfo.Description  = physicInfoEntity.Description;
                physicInfo.Method       = physicInfoEntity.Method;
                physicInfo.Notice       = physicInfoEntity.Notice;
        }
        /*获取特定药品信息:输入PhysicID,返回该药品的完整信息*/
        public PhysicInfoEntity GetPhysicInfo(string physicID) {

            PhysicInfoEntity physicInfoEntity = openAccessDAO.GetPhysicInfo(physicID);

            if (physicInfoEntity == null) {
                physicInfoEntity = new PhysicInfoEntity();
                physicInfoEntity.ErrorMessage = "144 No Physic of " + physicID + "! @Logic";
            }

            return physicInfoEntity;
        }
        /*获取特定药品信息:输入PhysicID,返回该药品的完整信息*/
        public PhysicInfo GetPhysicInfo(string physicID) {

            PhysicInfoEntity physicInfoEntity = null;

            if (physicID == null) {
                physicInfoEntity = new PhysicInfoEntity();
                physicInfoEntity.ErrorMessage = "114 Empty physicID! @Service";
            }
            else {
                physicInfoEntity = openAccessLogic.GetPhysicInfo(physicID);
            }
            PhysicInfo physicInfo = new PhysicInfo();
            TranslatePhysicInfoEntityToPhysicInfoContractData(physicInfoEntity, physicInfo);

            return physicInfo;
        }