public void InitPatientGroupComboBox() { try { PatientGroupComboBoxItems.Clear(); using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); var list = patientGroupDao.SelectPatientGroup(condition); foreach (var type in list) { var patientGroupData = new PatientGroupData { Id = type.Id, Name = type.Name, Description = type.Description }; PatientGroupComboBoxItems.Add(patientGroupData.Name); } } if (PatientGroupComboBoxItems.Count != 0) { PatientGroupComboBox.SelectedIndex = 0; } /*if (PatientGroupComboBoxItems.Count != 0) * this.PatientGroupComboBox.SelectedValue = Basewindow.patientGroupPanel.ComboBoxPatientGroup.SelectedValue;*/ } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:ComboBoxPatientGroup_OnInitialized exception messsage: " + ex.Message); } }
private void ListViewPatientGroup_OnLoaded(object sender, RoutedEventArgs e) { //throw new NotImplementedException(); try { using (var patientGroupDao = new PatientGroupDao()) { Datalist.Clear(); var condition = new Dictionary <string, object>(); var list = patientGroupDao.SelectPatientGroup(condition); foreach (var type in list) { var patientGroupData = new PatientGroupData { Id = type.Id, Name = type.Name, Description = type.Description }; Datalist.Add(patientGroupData); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatient.xaml.cs:ListViewPatientGroup_OnLoaded exception messsage: " + ex.Message); } }
private void ButtonDelete_OnClick(object sender, RoutedEventArgs e) { if (ListViewPatientGroup.SelectedIndex == -1) { return; } //throw new NotImplementedException(); using (var patientGroupDao = new PatientGroupDao()) { Basewindow.patientGroupPanel.ComboBoxPatientGroup.Items.Remove(Datalist[ListViewPatientGroup.SelectedIndex].Name); Basewindow.sheduleContent.PatientGroupComboBoxItems.Remove(Datalist[ListViewPatientGroup.SelectedIndex].Name); patientGroupDao.DeletePatientGroup(Datalist[ListViewPatientGroup.SelectedIndex].Id); RefreshData(); } this.ButtonNew.IsEnabled = true; this.ButtonDelete.IsEnabled = false; this.ButtonApply.IsEnabled = false; this.ButtonCancel.IsEnabled = false; isNew = false; }
private void RefreshData() { try { using (var patientGroupDao = new PatientGroupDao()) { Datalist.Clear(); var condition = new Dictionary <string, object>(); var list = patientGroupDao.SelectPatientGroup(condition); foreach (var pa in list) { var patientGroupData = new PatientGroupData(); patientGroupData.Id = pa.Id; patientGroupData.Name = pa.Name; patientGroupData.Description = pa.Description; Datalist.Add(patientGroupData); } } Basewindow.patientGroupPanel.RefreshPatientGroupCombobox(); Basewindow.sheduleContent.InitPatientGroupComboBox(); } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientGroup.xaml.cs:RefreshData exception messsage: " + ex.Message); } }
private void ComboBoxPatientGroup_OnInitialized(object sender, EventArgs e) { try { ComboBoxPatientGroup.Items.Clear(); using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); var list = patientGroupDao.SelectPatientGroup(condition); foreach (var type in list) { var patientGroupData = new PatientGroupData { Id = type.Id, Name = type.Name, Description = type.Description }; ComboBoxPatientGroup.Items.Add(patientGroupData.Name); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:ComboBoxPatientGroup_OnInitialized exception messsage: " + ex.Message); } }
public void RefreshPatientGroupCombobox() { try { ComboBoxPatientGroup.Items.Clear(); using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); var list = patientGroupDao.SelectPatientGroup(condition); foreach (var type in list) { var patientGroupData = new PatientGroupData { Id = type.Id, Name = type.Name, Description = type.Description }; ComboBoxPatientGroup.Items.Add(patientGroupData.Name); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:RefreshPatientGroupCombobox exception messsage: " + ex.Message); } }
private bool CheckNameIsExist(string name) { using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); var list = patientGroupDao.SelectPatientGroup(condition); foreach (var pa in list) { if (name.Equals(pa.Name)) { return(false); } } return(true); } }
public void RefreshData() { MainWindow.ComboBoxPatientGroupIndex = this.ComboBoxPatientGroup.SelectedIndex; Datalist.Clear(); using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); condition["NAME"] = this.ComboBoxPatientGroup.SelectedItem; var list = patientGroupDao.SelectPatientGroup(condition); if (list.Count > 0) { using (var patientGroupParaDao = new PatientGroupParaDao()) { var conditionpara = new Dictionary <string, object>(); conditionpara["GROUPID"] = list[0].Id; var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara); if (listpara.Count > 0) { using (var patientDao = new PatientDao()) { var patientlist = patientDao.SelectPatientSpecial(listpara); foreach (var patient in patientlist) { var patientData = new PatientData(); patientData.Id = patient.Id; patientData.Name = patient.Name; Datalist.Add(patientData); } } } } } if (Datalist.Count > 0) { this.ListBoxPatient.SelectedIndex = 0; } } UpdateGroupCount(); }
private void ComboBoxPatientGroup_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { MainWindow.ComboBoxPatientGroupIndex = this.ComboBoxPatientGroup.SelectedIndex; Datalist.Clear(); using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); condition["NAME"] = this.ComboBoxPatientGroup.SelectedItem; var list = patientGroupDao.SelectPatientGroup(condition); if (list.Count > 0) { using (var patientGroupParaDao = new PatientGroupParaDao()) { var conditionpara = new Dictionary <string, object>(); conditionpara["GROUPID"] = list[0].Id; var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara); if (listpara.Count > 0) { using (var patientDao = new PatientDao()) { var patientlist = patientDao.SelectPatientSpecial(listpara); foreach (var patient in patientlist) { var patientData = new PatientData(); patientData.Id = patient.Id; patientData.Name = patient.Name; Datalist.Add(patientData); } } } } } } UpdateGroupCount(); //ListBoxPatient.SelectedIndex = Datalist.Count > 0 ? 1 : -1; }
private void QueryPatients() { try { int index = PatientGroupComboBox.SelectedIndex; if (index == -1) { return; } using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); condition["NAME"] = PatientGroupComboBoxItems[index]; var list = patientGroupDao.SelectPatientGroup(condition); if (list.Count > 0) { using (var patientGroupParaDao = new PatientGroupParaDao()) { var conditionpara = new Dictionary <string, object>(); conditionpara["GROUPID"] = list[0].Id; var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara); if (listpara.Count > 0) { using (var patientDao = new PatientDao()) { var patientlist = patientDao.SelectPatientSpecial(listpara); string areaid = GetPatientArea(listpara); if (!areaid.Equals("")) { Datalist.Clear(); QueryPatientsByArea(areaid); return; } Datalist.Clear(); foreach (var patient in patientlist) { using (var scheduleTemplateDao = new ScheduleTemplateDao()) { condition.Clear(); condition = new Dictionary <string, object>(); condition["PatientId"] = patient.Id; condition["DATE"] = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd"); var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition); foreach (var type in list22) { if (type.BedId == -1) { continue; } var rReportData = new ReportData(); rReportData.Id = type.Id; using (PatientDao patientDao1 = new PatientDao()) { var condition2 = new Dictionary <string, object>(); condition2["ID"] = type.PatientId; var list2 = patientDao1.SelectPatient(condition2); if ((list2 != null) && (list.Count > 0)) { rReportData.PatientName = list2[0].Name; rReportData.Description = list2[0].Description; } } rReportData.ShiftWork = type.AmPmE; rReportData.Method = type.Method; /*if (type.BedId == -1) * rReportData.BedId = ""; * else * { * rReportData.BedId = type.BedId.ToString(); * }*/ using (var bedDao = new BedDao()) { condition.Clear(); condition["Id"] = type.BedId; var bedlist = bedDao.SelectBed(condition); if (bedlist.Count == 1) { long areaId = bedlist[0].PatientAreaId; rReportData.BedId = bedlist[0].Name; using (var patientAreaDao = new PatientAreaDao()) { condition.Clear(); condition["Id"] = areaId; var arealist = patientAreaDao.SelectPatientArea(condition); if (arealist.Count == 1) { rReportData.Area = arealist[0].Name; } } } } //rReportData.Description = patient.Description; Datalist.Add(rReportData); } } } } } } } } UpdateGroupCount(); } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:Init_OnLoaded select patient exception messsage: " + ex.Message); } }
private void ButtonApply_OnClick(object sender, RoutedEventArgs e) { if (isNew) { //throw new NotImplementedException(); try { int index = ListViewPatientGroup.SelectedIndex; if (index == -1) { return; } if (Datalist[index].Name.Equals("") || !CheckNameIsExist(Datalist[index].Name)) { var a = new RemindMessageBox1(); a.remindText.Text = (string)FindResource("Message1001");; a.ShowDialog(); return; } using (PatientGroupDao patientGroupDao = new PatientGroupDao()) { PatientGroup patientGroup = new PatientGroup(); patientGroup.Name = Datalist[index].Name; patientGroup.Description = Datalist[index].Description; int lastInsertId = -1; patientGroupDao.InsertPatientGroup(patientGroup, ref lastInsertId); //UI //PatientGroupData patientGroupData = new PatientGroupData(); //patientGroupData.Id = lastInsertId; //patientGroupData.Name = patientGroup.Name; //patientGroupData.Description = patientGroup.Description; //Datalist.Add(patientGroupData); var patientData = new PatientData(); patientData.Id = lastInsertId; patientData.Name = patientGroup.Name; //Basewindow.patientGroupPanel.Datalist.Add(patientData); Basewindow.patientGroupPanel.ComboBoxPatientGroup.Items.Add(patientGroup.Name); Basewindow.sheduleContent.PatientGroupComboBoxItems.Add(patientGroup.Name); Datalist[index].Id = lastInsertId; } RefreshData(); } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientGroup.xaml.cs:ButtonApply_OnClick exception messsage: " + ex.Message); return; } this.ButtonNew.IsEnabled = true; this.ButtonDelete.IsEnabled = true; this.ButtonApply.IsEnabled = true; this.ButtonCancel.IsEnabled = true; isNew = false; } else { int index = ListViewPatientGroup.SelectedIndex; if (index == -1) { return; } if (this.Datalist[index].Name.Equals("")) { var a = new RemindMessageBox1(); a.remindText.Text = (string)FindResource("Message1001");; a.ShowDialog(); return; } //throw new NotImplementedException(); using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); condition["ID"] = Datalist[index].Id; var fileds = new Dictionary <string, object>(); fileds["NAME"] = Datalist[index].Name; fileds["DESCRIPTION"] = Datalist[index].Description; patientGroupDao.UpdatePatientGroup(fileds, condition); int temp = this.ListViewPatientGroup.SelectedIndex; RefreshData(); this.ListViewPatientGroup.SelectedIndex = temp; } } this.ButtonDelete.IsEnabled = true; this.ButtonApply.IsEnabled = false; this.ButtonCancel.IsEnabled = false; ParSettingGrid.IsEnabled = true; ListViewPatientGroupPara.IsEnabled = true; }