/*获取特定药房信息:提交PharmacyID,返回该药房的信息*/ public PharmacyInfo GetPharmacyInfo(string pharmacyID) { PharmacyInfoEntity pharmacyInfoEntity = null; if (pharmacyID == null) { pharmacyInfoEntity = new PharmacyInfoEntity(); pharmacyInfoEntity.ErrorMessage = "116 Empty pharmacyID! @Service"; } else { pharmacyInfoEntity = openAccessLogic.GetPharmacyInfo(pharmacyID); } PharmacyInfo pharmacyInfo = new PharmacyInfo(); TranslatePharmacyInfoEntityToPharmacyInfoContractData(pharmacyInfoEntity, pharmacyInfo); return pharmacyInfo; }
/*药房登录:若ID和Password均不为空,则转发至DL,将结果翻译为数据契约*/ public PharmacyInfo Login(string pharmacyID, string password) { PharmacyInfoEntity pharmacyInfoEntity = null; if (pharmacyID == null) { pharmacyInfoEntity = new PharmacyInfoEntity(); pharmacyInfoEntity.ErrorMessage = "201 Empty PharmacyID! @Service"; } else if (password == null) { pharmacyInfoEntity = new PharmacyInfoEntity(); pharmacyInfoEntity.ErrorMessage = "202 Empty Password! @Service"; } else { pharmacyInfoEntity = pharmacyLogic.Login(pharmacyID, password); } PharmacyInfo pharmacyInfo = new PharmacyInfo(); TranslatePharmacyInfoEntityToPharmacyInfoContractData(pharmacyInfoEntity, pharmacyInfo); return pharmacyInfo; }
/*将PharmacyInfo对应的Entity翻译为数据契约*/ private void TranslatePharmacyInfoEntityToPharmacyInfoContractData( PharmacyInfoEntity pharmacyInfoEntity, PharmacyInfo pharmacyInfo) { pharmacyInfo.ErrorMessage = pharmacyInfoEntity.ErrorMessage; pharmacyInfo.PharmacyID = pharmacyInfoEntity.PharmacyID; pharmacyInfo.Name = pharmacyInfoEntity.Name; pharmacyInfo.City = pharmacyInfoEntity.City; pharmacyInfo.Address = pharmacyInfoEntity.Address; pharmacyInfo.Latitude = pharmacyInfoEntity.Latitude; pharmacyInfo.Longitude = pharmacyInfoEntity.Longitude; pharmacyInfo.HospitalID = pharmacyInfoEntity.HospitalID; pharmacyInfo.Phone = pharmacyInfoEntity.Phone; pharmacyInfo.Fax = pharmacyInfoEntity.Fax; pharmacyInfo.LastLoginDate = pharmacyInfoEntity.LastLoginDate; }