public frm_SearchPatient() { InitializeComponent(); IsFirst = false; // 由调用程序设定 sSearchString = ""; // 由调用程序设定 CreatDataTable(); IsSelectNew = false; Patient_New = new MyData.PatientInfo_Struct(); Record_New = null; }
public bool GetAllPatient(ref MyData.PatientInfo_Struct[] pPatientInfo, ref string sErr) { bool bResult = false; DataSet DS = null; string sSql = "Select * from Patient"; try { if (!ReadData(sSql, ref DS, ref sErr)) { goto Eend; } if (DS != null && DS.Tables[0].Rows.Count > 0) { pPatientInfo = new MyData.PatientInfo_Struct[DS.Tables[0].Rows.Count]; for (int i = 0; i < DS.Tables[0].Rows.Count; i++) { pPatientInfo[i].FileID = DS.Tables[0].Rows[i]["FileID"].ToString(); pPatientInfo[i].PatientID = DS.Tables[0].Rows[i]["PatientID"].ToString(); pPatientInfo[i].Name = DS.Tables[0].Rows[i]["Name"].ToString(); pPatientInfo[i].Birthday = DS.Tables[0].Rows[i]["Birthday"].ToString(); pPatientInfo[i].Sex = DS.Tables[0].Rows[i]["Sex"].ToString(); pPatientInfo[i].Address = DS.Tables[0].Rows[i]["Address"].ToString(); pPatientInfo[i].Tele = DS.Tables[0].Rows[i]["Tele"].ToString(); pPatientInfo[i].IdentifyID = DS.Tables[0].Rows[i]["IdentifyID"].ToString(); pPatientInfo[i].Memo = DS.Tables[0].Rows[i]["Memo"].ToString(); } } else { pPatientInfo = null; } bResult = true; sErr = ""; } catch (Exception ex) { sErr = ex.Message; pPatientInfo = null; } Eend: if (DS != null) { DS = null; } return(bResult); }
private void button_Select_Click(object sender, RoutedEventArgs e) { if (Patient_DataTable.Rows.Count > 0 && datagrid_Patient.SelectedIndex >= 0) { Patient_New.FileID = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["FileID"].ToString(); Patient_New.PatientID = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["PatientID"].ToString(); Patient_New.Name = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["Name"].ToString(); Patient_New.Birthday = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["Birthday"].ToString(); Patient_New.Sex = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["Sex"].ToString(); Patient_New.Address = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["Address"].ToString(); Patient_New.Tele = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["Tele"].ToString(); Patient_New.IdentifyID = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["IdentifyID"].ToString(); Patient_New.Memo = Patient_DataTable.Rows[datagrid_Patient.SelectedIndex]["Memo"].ToString(); if (Record_DataTable.Rows.Count > 0) { string sTmp = ""; Record_New = new MyData.CheckRecord_Struct[Record_DataTable.Rows.Count]; for (int i = 0; i < Record_DataTable.Rows.Count; i++) { Record_New[i].RecordID = Record_DataTable.Rows[i]["RecordID"].ToString(); Record_New[i].FileID = Record_DataTable.Rows[i]["FileID"].ToString(); Record_New[i].CheckTime = Record_DataTable.Rows[i]["CheckTime"].ToString(); Record_New[i].Doctor = Record_DataTable.Rows[i]["Doctor"].ToString(); Record_New[i].CheckInfo = Record_DataTable.Rows[i]["CheckInfo"].ToString(); sTmp = System.Environment.CurrentDirectory + "\\Data\\" + Record_New[i].FileID.Trim() + "\\"; Record_New[i].SmallPict = sTmp + "Small\\" + Record_DataTable.Rows[i]["SmallPict"].ToString(); Record_New[i].BigPict = sTmp + "Big\\" + Record_DataTable.Rows[i]["BigPict"].ToString(); Record_New[i].SelectPict = ""; } iSelectRecordID = int.Parse(Record_DataTable.Rows[datagrid_Record.SelectedIndex]["RecordID"].ToString()); // 选定的检查记录的RecordID } else { Record_New = null; } IsSelectNew = true; if (IsShowInput) // 从frm_Start调用 { pfrm_Start.Show(); pfrm_Start.IsEnabled = true; pfrm_Start.ShowInTaskbar = true; this.Hide(); } else // 从frm_Start调用 { frm_Main Frm_Main = new frm_Main(); Frm_Main.IsFirst = true; Frm_Main.Patient_New = Patient_New; Frm_Main.Record_New = Record_New; Frm_Main.pfrm_Search = this; this.ShowInTaskbar = false; pfrm_Start.Hide(); this.Hide(); Frm_Main.ShowDialog(); } } else { Patient_New = new MyData.PatientInfo_Struct(); Record_New = null; IsSelectNew = false; } }