public ObservableCollection <ImageInfo> QueryNewInsertImage(Agencys agencys, Patients patients, DateTime registrationDate, ObservableCollection <ImageInfo> oriImageInfos) { using (var ide = new iDentalEntities()) { var queryID = from ori in oriImageInfos select ori.Image_ID; var qi = from i in ide.Images where i.Registrations.Patient_ID == patients.Patient_ID && i.Registrations.Registration_Date == registrationDate.Date && i.Image_IsEnable == true && !queryID.Contains(i.Image_ID) select i; ObservableCollection <ImageInfo> observableCollection = new ObservableCollection <ImageInfo>(qi.ToList().Select(s => new ImageInfo { Registration_Date = s.Registrations.Registration_Date, Image_ID = s.Image_ID, Image_Path = s.Image_Path, Image_FullPath = agencys.Agency_ImagePath + s.Image_Path, Image_FileName = s.Image_FileName, Image_Extension = s.Image_Extension, Registration_ID = s.Registration_ID, CreateDate = s.CreateDate, IsSelected = false })); return(observableCollection); } }
/// <summary> /// 新增或更新Templates_Images /// </summary> /// <param name="patients"></param> /// <param name="templates"></param> /// <param name="templateImportDate"></param> /// <param name="imageID"></param> /// <param name="imagePath"></param> /// <param name="tiNumber"></param> public string InsertOrUpdateTemplatesImages(Patients patients, Templates templates, DateTime templateImportDate, int imageID, string imagePath, string tiNumber) { using (var ide = new iDentalEntities()) { Templates_Images templates_Images = new Templates_Images(); var IsImageExist = from iie in ide.Templates_Images where iie.Template_ID == templates.Template_ID && iie.Template_Image_Number == tiNumber && iie.Template_Image_ImportDate == templateImportDate.Date && iie.Patient_ID == patients.Patient_ID select iie; if (IsImageExist.Count() > 0) { templates_Images = IsImageExist.First(); templates_Images.Image_ID = imageID; templates_Images.Image_Path = imagePath; ide.SaveChanges(); } else { templates_Images.Template_Image_Number = tiNumber; templates_Images.Template_ID = templates.Template_ID; templates_Images.Template_Image_ImportDate = templateImportDate.Date; templates_Images.Image_ID = imageID; templates_Images.Image_Path = imagePath; templates_Images.Patient_ID = patients.Patient_ID; ide.Templates_Images.Add(templates_Images); ide.SaveChanges(); } return(templates_Images.Template_Image_ID.ToString()); } }
/// <summary> /// /// </summary> /// <returns></returns> public ObservableCollection <PatientCategorys> QueryAllPatientCategory() { using (var ide = new iDentalEntities()) { return(new ObservableCollection <PatientCategorys>(ide.PatientCategorys.OrderByDescending(o => o.PatientCategory_ID))); } }
public List <PatientCategorys> QueryPatientCategoryItem(string keyword) { using (var ide = new iDentalEntities()) { return(ide.PatientCategorys.Where(pc => pc.PatientCategory_Title.Contains(keyword)).ToList()); } }
/// <summary> /// /// </summary> /// <param name="patients"></param> /// <param name="templates"></param> /// <returns></returns> public ObservableCollection <Templates_Images> QueryTemplatesImagesImportDateAndReturnFullImagePath(Agencys agencys, Patients patients, Templates templates, DateTime templateImportDate) { using (var ide = new iDentalEntities()) { ObservableCollection <Templates_Images> observableCollection; var queryTemplatesImages = (from iie in ide.Templates_Images where iie.Template_ID == templates.Template_ID && iie.Patient_ID == patients.Patient_ID && iie.Template_Image_ImportDate == templateImportDate.Date select new { Template_Image_ID = iie.Template_Image_ID, Template_Image_Number = iie.Template_Image_Number, Template_Image_ImportDate = iie.Template_Image_ImportDate, Template_ID = iie.Template_ID, Image_ID = iie.Image_ID, Image_FullPath = agencys.Agency_ImagePath + iie.Image_Path, Patient_ID = iie.Patient_ID }).ToList().Select(s => new Templates_Images { Template_Image_ID = s.Template_Image_ID, Template_Image_Number = s.Template_Image_Number, Template_Image_ImportDate = s.Template_Image_ImportDate, Template_ID = s.Template_ID, Image_ID = s.Image_ID, Image_Path = s.Image_FullPath, Patient_ID = s.Patient_ID }); observableCollection = new ObservableCollection <Templates_Images>(queryTemplatesImages); return(observableCollection); } }
public List <PatientInfo> QueryPatientAllToPatientInfo() { using (var ide = new iDentalEntities()) { var qp = (from p in ide.Patients select new { Patient_ID = p.Patient_ID, Patient_Number = p.Patient_Number, Patient_Name = p.Patient_Name, Patient_Gender = p.Patient_Gender, Patient_Birth = p.Patient_Birth, Patient_IDNumber = p.Patient_IDNumber, Patient_Photo = p.Patient_Photo, Patient_FirstRegistrationDate = (DateTime)p.Patient_FirstRegistrationDate, Patient_LastRegistrationDate = p.Registrations.OrderByDescending(o => o.Registration_Date).Count() > 0 ? p.Registrations.OrderByDescending(o => o.Registration_Date).FirstOrDefault().Registration_Date : (DateTime)p.Patient_FirstRegistrationDate, Patient_PatientCategorys = p.PatientCategorys.ToList() }).ToList().Select(s => new PatientInfo() { Patient_ID = s.Patient_ID, Patient_Number = s.Patient_Number, Patient_Name = s.Patient_Name, Patient_Gender = s.Patient_Gender, Patient_Birth = s.Patient_Birth, Patient_IDNumber = s.Patient_IDNumber, Patient_Photo = s.Patient_Photo, Patient_FirstRegistrationDate = s.Patient_FirstRegistrationDate, Patient_LastRegistrationDate = s.Patient_LastRegistrationDate, Patient_PatientCategorys = s.Patient_PatientCategorys.ToList() }); return(qp.ToList()); } }
/// <summary> /// 寫入連線資訊 /// </summary> /// <param name="connectingLogs">ConnectingLogs</param> public void InsertConnectingLog(ConnectingLogs connectingLogs) { using (var ide = new iDentalEntities()) { ide.ConnectingLogs.Add(connectingLogs); ide.SaveChanges(); } }
public PatientSearchViewModel() { using (var ide = new iDentalEntities()) { ListPatientCategorys = ide.PatientCategorys.ToList(); DisplayPatientInfo = ListPatientInfo = new TablePatients().QueryPatientAllToPatientInfo(); } }
/// <summary> /// 寫入資訊者資訊 /// </summary> /// <param name="clients">Clients</param> public void InsertClient(Clients clients) { using (var ide = new iDentalEntities()) { ide.Clients.Add(clients); ide.SaveChanges(); } }
private void Button_PatientCategorySearchAll_Click(object sender, RoutedEventArgs e) { using (var ide = new iDentalEntities()) { patientSearchViewModel.ListPatientCategorys = ide.PatientCategorys.ToList(); textPatientCategoryKeyword.Text = string.Empty; } }
/// <summary> /// /// </summary> /// <param name="patientCategorys"></param> public void InsertPatientCategorys(PatientCategorys patientCategorys) { using (var ide = new iDentalEntities()) { ide.PatientCategorys.Add(patientCategorys); ide.SaveChanges(); } }
/// <summary> /// /// </summary> /// <param name="patients"></param> public Patients InsertPatients(Patients patients) { using (var ide = new iDentalEntities()) { ide.Patients.Add(patients); ide.SaveChanges(); return(patients); } }
/// <summary> /// 查詢登入者資訊 /// </summary> /// <param name="hostName">登入者電腦名稱</param> /// <returns></returns> public Clients QueryClient(string hostName) { using (var ide = new iDentalEntities()) { var queryClients = from c in ide.Clients where c.Client_HostName == hostName select c; return(queryClients.Count() > 0 ? queryClients.First() : null); } }
/// <summary> /// /// </summary> /// <param name="newPatientID"></param> /// <returns></returns> public bool IsUniquePatientID(string newPatientID) { using (var ide = new iDentalEntities()) { var checkUnique = from p in ide.Patients where p.Patient_ID == newPatientID select p; return(checkUnique.Count() > 0 ? false : true); } }
/// <summary> /// 查詢已認證的機構 /// </summary> /// <returns>Agencys</returns> public Agencys QueryVerifyAgencys() { using (var ide = new iDentalEntities()) { var queryAgencys = from a in ide.Agencys where a.Agency_IsVerify == true select a; return(queryAgencys.Count() > 0 ? queryAgencys.First() : null); } }
/// <summary> /// 查詢病患並回傳 /// </summary> /// <param name="patients">Patients</param> /// <returns></returns> public Patients QueryPatient(string patient_ID) { using (var ide = new iDentalEntities()) { var queryPatient = from p in ide.Patients where p.Patient_ID == patient_ID select p; return(queryPatient.First()); } }
/// <summary> /// /// </summary> /// <param name="patientCategorys"></param> /// <param name="newTitle"></param> public void DeletePatientCategorys(PatientCategorys patientCategorys) { using (var ide = new iDentalEntities()) { var deleteItem = ide.PatientCategorys.Where(w => w.PatientCategory_ID == patientCategorys.PatientCategory_ID).First(); deleteItem.Patients.Remove(new Patients()); ide.PatientCategorys.Remove(deleteItem); ide.SaveChanges(); } }
/// <summary> /// /// </summary> /// <param name="patientCategorys"></param> /// <param name="newTitle"></param> public void UpdatePatientCategorysTitle(PatientCategorys patientCategorys, string newTitle) { using (var ide = new iDentalEntities()) { PatientCategorys updateItem = (from pc in ide.PatientCategorys where pc.PatientCategory_ID == patientCategorys.PatientCategory_ID select pc).First(); updateItem.PatientCategory_Title = newTitle; ide.SaveChanges(); } }
/// <summary> /// /// </summary> /// <param name="patients"></param> /// <returns></returns> public DateTime QueryLastRegistrationDate(Patients patients) { using (var ide = new iDentalEntities()) { var queryRegistrationDate = from r in ide.Registrations where r.Patient_ID == patients.Patient_ID && r.Images.Where(s => s.Image_IsEnable == true).Count() > 0 orderby r.Registration_Date descending select r; return(queryRegistrationDate.Count() > 0 ? queryRegistrationDate.First().Registration_Date : (DateTime)patients.Patient_FirstRegistrationDate); } }
/// <summary> /// 更新病患大頭照 /// </summary> /// <param name="patients"></param> /// <param name="photoPath"></param> public void UpdatePatientPhoto(Patients patients, string photoPath) { using (var ide = new iDentalEntities()) { Patients p = (from qp in ide.Patients where qp.Patient_ID == patients.Patient_ID select qp).First(); p.Patient_Photo = photoPath; p.UpdateDate = DateTime.Now; ide.SaveChanges(); } }
/// <summary> /// 病患有無勾選的分類 /// </summary> /// <param name="patients"></param> /// <returns></returns> public List <PatientCategoryInfo> QueryPatientPatientCategoryInfo(Patients patients) { using (var ide = new iDentalEntities()) { var qpc = from pc in ide.PatientCategorys select new PatientCategoryInfo() { PatientCategory_ID = pc.PatientCategory_ID, PatientCategory_Title = pc.PatientCategory_Title, IsChecked = pc.Patients.Where(p => p.Patient_ID == patients.Patient_ID).Count() > 0 ? true : false }; return(qpc.ToList()); } }
/// <summary> /// 所有病患分類並轉換成PatientCategoryInfo /// </summary> /// <returns></returns> public List <PatientCategoryInfo> QueryAllPatientCategoryInfo() { using (var ide = new iDentalEntities()) { var qpc = from pc in ide.PatientCategorys select new PatientCategoryInfo() { PatientCategory_ID = pc.PatientCategory_ID, PatientCategory_Title = pc.PatientCategory_Title, IsChecked = false }; return(qpc.ToList()); } }
public ObservableCollection <Templates> QueryAllTemplates() { using (var ide = new iDentalEntities()) { ObservableCollection <Templates> observableCollection; var temp = from t in ide.Templates where t.Template_IsEnable == true select t; observableCollection = new ObservableCollection <Templates>(temp); return(observableCollection); } }
/// <summary> /// 更新機構資訊 /// </summary> /// <param name="agencys"></param> /// <param name="imagePath"></param> /// <param name="wifiCardPath"></param> /// <param name="viewType"></param> /// <param name="functionID"></param> /// <returns></returns> public void UpdateAgency(Agencys agencys, string imagePath, string wifiCardPath, string viewType, int functionID) { using (var ide = new iDentalEntities()) { Agencys newAgencys = (from a in ide.Agencys where a.Agency_Code == agencys.Agency_Code select a).First(); newAgencys.Agency_ImagePath = imagePath; newAgencys.Agency_WifiCardPath = wifiCardPath; newAgencys.Agency_ViewType = viewType; newAgencys.Function_ID = functionID; ide.SaveChanges(); } }
/// <summary> /// 病患分類 /// </summary> /// <param name="patients"></param> /// <returns></returns> public List <PatientCategoryInfo> QueryPatientCheckedPatientCategoryInfo(Patients patients) { using (var ide = new iDentalEntities()) { var qpc = from pc in ide.PatientCategorys where pc.Patients.Any(p => p.Patient_ID == patients.Patient_ID) select new PatientCategoryInfo() { PatientCategory_ID = pc.PatientCategory_ID, PatientCategory_Title = pc.PatientCategory_Title, IsChecked = true }; return(qpc.ToList()); } }
private void Button_PatientSearch_Click(object sender, RoutedEventArgs e) { using (var ide = new iDentalEntities()) { patientSearchViewModel.DisplayPatientInfo = (from lp in patientSearchViewModel.ListPatientInfo where lp.Patient_Number.ToUpper().Contains(textPatientKeyword.Text.ToUpper()) || lp.Patient_Name.ToUpper().Contains(textPatientKeyword.Text.ToUpper()) || lp.Patient_IDNumber.ToUpper().Contains(textPatientKeyword.Text.ToUpper()) || lp.Patient_Birth.ToString("yyyyMMdd").Contains(textPatientKeyword.Text) || lp.Patient_Birth.ToString("yyyy-MM-dd").Contains(textPatientKeyword.Text) || lp.Patient_Birth.ToString("yyyy/MM/dd").Contains(textPatientKeyword.Text) select lp).ToList(); textPatientKeyword.Text = string.Empty; } }
/// <summary> /// 載入功能頁面 /// </summary> /// <returns></returns> public static List <Functions> QueryFunctions() { using (var ide = new iDentalEntities()) { List <Functions> list = new List <Functions>(); var queryFunctions = from f in ide.Functions where f.Function_IsEnable == true select f; if (queryFunctions.Count() > 0) { list = queryFunctions.ToList(); } return(list); } }
/// <summary> /// 尋找病患模板的匯入日期 /// </summary> /// <param name="patients"></param> /// <param name="templates"></param> /// <returns></returns> public ObservableCollection <string> QueryAllTemplatesImagesImportDate(Patients patients, Templates templates) { using (var ide = new iDentalEntities()) { ObservableCollection <string> observableCollection; var queryImportDate = (from ti in ide.Templates_Images where ti.Patient_ID == patients.Patient_ID && ti.Template_ID == templates.Template_ID group ti by ti.Template_Image_ImportDate into tii select new { ImportDate = tii.Key }).ToList().Select(s => s.ImportDate.ToString("yyyy/MM/dd")); observableCollection = new ObservableCollection <string>(queryImportDate); return(observableCollection); } }
/// <summary> /// 更新病患大頭照 /// </summary> /// <param name="patients"></param> /// <param name="photoPath"></param> public Patients UpdatePatients(Patients patients) { using (var ide = new iDentalEntities()) { Patients p = (from qp in ide.Patients where qp.Patient_ID == patients.Patient_ID select qp).First(); p.Patient_Number = patients.Patient_Number; p.Patient_Name = patients.Patient_Name; p.Patient_Gender = patients.Patient_Gender; p.Patient_Birth = patients.Patient_Birth; p.Patient_IDNumber = patients.Patient_IDNumber; p.Patient_Photo = patients.Patient_Photo; p.Patient_FirstRegistrationDate = patients.Patient_FirstRegistrationDate; p.UpdateDate = patients.UpdateDate; ide.SaveChanges(); return(p); } }
/// <summary> /// 取得所有掛號清單 /// </summary> /// <param name="patients"></param> /// <returns></returns> public ObservableCollection <ComboBoxItemInfo> QueryRegistrationsList(Patients patients) { using (var ide = new iDentalEntities()) { var queryRegistrations = (from r in ide.Registrations where r.Patient_ID == patients.Patient_ID && r.Images.Where(s => s.Image_IsEnable == true).Count() > 0 select new { Registration_ID = r.Registration_ID, Registration_Date = r.Registration_Date }).ToList().Select(s => new ComboBoxItemInfo { DisplayName = s.Registration_Date.ToString("yyyy/MM/dd"), SelectedValue = s.Registration_ID }); return(new ObservableCollection <ComboBoxItemInfo>(queryRegistrations.ToList().OrderByDescending(o => o.DisplayName))); } }