public List <MyDoctorDataContract> GetDoctorAroundUserList(string username) { echelperDBEntities context = new echelperDBEntities(); context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Doctor); context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Patient); List <MyDoctorDataContract> temp = new List <MyDoctorDataContract>(); List <Doctor> tempuser = context.Doctor.ToList(); List <string> keylist = context.Patient.Select(c => c.LiveID).Distinct().ToList(); echelperDBEntities context_ = new echelperDBEntities(); Patient data = context_.GetObjectByKey(new System.Data.EntityKey("echelperDBEntities.Patient", "LiveID", username)) as Patient; foreach (Doctor i in tempuser) { if (i.Status == 1) { bool ismy = false; if (i.Patient.Contains(data)) { ismy = true; } temp.Add(ConvertMyDoctorToDataContract(i, ismy)); } } return(temp); }
public PatientUserDataContract GetPatientUser(string username) { echelperDBEntities context = new echelperDBEntities(); context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Patient); List <string> keylist = context.Patient.Select(c => c.LiveID).Distinct().ToList(); echelperDBEntities context_ = new echelperDBEntities(); Patient data = context_.GetObjectByKey(new System.Data.EntityKey("echelperDBEntities.Patient", "LiveID", username)) as Patient; return(ConvertPatientUserToDataContract(data)); }