/*获取医院信息:提交城市名,返回该城市的所有医院的信息*/
        public AllHospitalInfoEntity GetAllHospitalInfo(string city) {

            AllHospitalInfoEntity allHospitalInfoEntity = openAccessDAO.GetAllHospitalInfo(city);

            if (allHospitalInfoEntity == null) {
                allHospitalInfoEntity = new AllHospitalInfoEntity();
                allHospitalInfoEntity.ErrorMessage = "131 No Hospitals in " + city + "! @Logic";
            }

            return allHospitalInfoEntity;
        }
        /*获取医院信息:提交城市名,返回该城市的所有医院的信息*/
        public AllHospitalInfoEntity GetAllHospitalInfo(string city) {

            DrPEDatabaseEntities DEntities = new DrPEDatabaseEntities();

            /*查询City域匹配的所有Hospital记录*/
            var hospitals = from h in DEntities.Hospitals
                            where h.City == city
                            orderby h.HospitalID
                            select h;

            int cnt = 0;
            int hospitalCount = hospitals.Count();
            
            AllHospitalInfoEntity allHospitalInfoEntity = null;
            if (hospitalCount > 0) {
                allHospitalInfoEntity                       = new AllHospitalInfoEntity();
                allHospitalInfoEntity.Count                 = hospitalCount;
                allHospitalInfoEntity.hospitalInfoEntity    = new HospitalInfoEntity[hospitalCount];

                foreach (var h in hospitals) {
                    allHospitalInfoEntity.hospitalInfoEntity[cnt] = new HospitalInfoEntity();

                    allHospitalInfoEntity.hospitalInfoEntity[cnt].HospitalID    = h.HospitalID;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Name          = h.Name;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].City          = h.City;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Address       = h.Address;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Latitude      = h.Latitude;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Longitude     = h.Longitude;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Type          = h.Type;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Grade         = h.Grade;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Features      = h.Features;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Website       = h.Website;
                    allHospitalInfoEntity.hospitalInfoEntity[cnt].Bed           = h.Bed;

                    cnt++;
                }
            }

            return allHospitalInfoEntity;
        }
        /*获取医院信息:提交城市名,返回该城市的所有医院的信息*/
        public AllHospitalInfo GetAllHospitalInfo(string city) {

            AllHospitalInfoEntity allHospitalInfoEntity = null;

            if (city == null) {
                allHospitalInfoEntity = new AllHospitalInfoEntity();
                allHospitalInfoEntity.ErrorMessage = "101 Empty City! @Service";
            }
            else {
                allHospitalInfoEntity = openAccessLogic.GetAllHospitalInfo(city);
            }
            AllHospitalInfo allHospitalInfo = new AllHospitalInfo();
            TranslateAllHospitalInfoEntityToAllHospitalInfoContractData(allHospitalInfoEntity, allHospitalInfo);

            return allHospitalInfo;
        }
        /*将AllHospitalInfo对应的Entity翻译为数据契约,调用TranslateHospitalInfoEntityToHospitalInfoContractData()*/
        private void TranslateAllHospitalInfoEntityToAllHospitalInfoContractData(
            AllHospitalInfoEntity   allHospitalInfoEntity,
            AllHospitalInfo         allHospitalInfo) {

                int cnt = 0;

                allHospitalInfo.ErrorMessage    = allHospitalInfoEntity.ErrorMessage;
                allHospitalInfo.Count           = allHospitalInfoEntity.Count;

                if (allHospitalInfo.Count > 0) {
                    allHospitalInfo.hospitalInfo = new HospitalInfo[allHospitalInfo.Count];
                    for (cnt = 0; cnt < allHospitalInfo.Count; cnt++) {
                        allHospitalInfo.hospitalInfo[cnt] = new HospitalInfo();
                        TranslateHospitalInfoEntityToHospitalInfoContractData(
                            allHospitalInfoEntity.hospitalInfoEntity[cnt],
                            allHospitalInfo.hospitalInfo[cnt]);
                    }
                }
        }