private void filter_patient_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { PatientListFilter pFilter = new PatientListFilter(); pFilter.ShowDialog(); if (pFilter.status_ok) { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select p.id,p.name,p.address,p.age,p.m_status,p.health_status,d.doctorName,p.p_status from patient p left join doctor d on p.doctor_id=d.id where p.ts>='" + WsApplication.fd + "' and p.ts<='" + WsApplication.td + "'"; MySqlDataReader reader = cmd.ExecuteReader(); gc_patient_list.ItemsSource = reader; MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } MessageBox.Show(pFilter.patientstatus); pFilter.Close(); } }
private void btnCreateDoctor_Click(object sender, RoutedEventArgs e) { string docName = doctorName.Text; string dpo = position.Text; string dsp = specialist.Text; string wexp = work_experience.Text; int dage = int.Parse(age.Text); string ddegree = degree.Text; status_Ok = true; this.Close(); MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "insert into doctor(doctorName,position,specialist,work_experience,age,degree,active,is_delete,ts) values('" + docName + "','" + dpo + "','" + dsp + "','" + wexp + "','" + dage + "','" + ddegree + "','" + 1 + "','" + 0 + "','" + DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "');"; MySqlDataReader reader = cmd.ExecuteReader(); MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnFilterPatient_Click(object sender, RoutedEventArgs e) { string pname = patientname.Text; string paddress = address.Text; string phone = phoneno.Text; int page = Int32.Parse(age.Text); string m_status = combo_marital_status.SelectedValue.ToString(); string h_status = healthstatus.Text; string d_id = combo_doctor_name.SelectedValue.ToString(); Decimal scharges = Decimal.Parse(servicecharges.Text); string pstatus = "Booking"; decimal tamt = 0; status_ok = true; this.Close(); if (refercheck.IsChecked == true) { string refname = referdoctor.SelectedValue.ToString(); } MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "insert into patient(name,address,phone,doctor_id,age,m_status,health_status,service_charges,p_status,total_amount,active,is_delete,ts) values('" + pname + "','" + paddress + "','" + phone + "','" + d_id + "','" + page + "','" + m_status + "','" + h_status + "','" + scharges + "','" + pstatus + "','" + tamt + "','" + 1 + "','" + 0 + "','" + DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "');"; MySqlDataReader reader = cmd.ExecuteReader(); MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Cancel_Booking_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { if (WsApplication.pid != null) { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select name from patient where id='" + WsApplication.pid + "'"; MySqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { //I would also check for DB.Null here before reading the value. string item = reader.GetString(reader.GetOrdinal("name")); WsApplication.pname = item; spatientname = item; } } MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } MessageBoxResult result = MessageBox.Show("Do you want to Cancel the Booking Patient =" + WsApplication.pname + " ?", "Confirm To Cancel Booking Patient!!", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "delete from patient where id='" + WsApplication.pid + "'"; MySqlDataReader reader = cmd.ExecuteReader(); MyCon.Close(); MessageBox.Show(" Successfully Cancel Booking Patient!!"); LoadPatientData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } break; case MessageBoxResult.No: LoadPatientData(); break; } } else { MessageBox.Show("No Patient to Cancel(Please Double Click To Select Booking Patient!!"); LoadPatientData(); } }
private void Add_Patient_History_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { if (WsApplication.pid != null) { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select name from patient where id='" + WsApplication.pid + "'"; MySqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { //I would also check for DB.Null here before reading the value. string item = reader.GetString(reader.GetOrdinal("name")); WsApplication.pname = item; spatientname = item; } } MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } MessageBoxResult result = MessageBox.Show("Do You Want to History For Patient=" + spatientname + "?", "Confirm To Add Patient History!!", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: AddPatientHistory npatient = new AddPatientHistory(); npatient.ShowDialog(); if (npatient.status_ok) { LoadPatientData(); } break; case MessageBoxResult.No: LoadPatientData(); break; } } else { MessageBox.Show("Please Select At Least One Patient to Add History"); } }
private void ThemedWindow_Loaded(object sender, RoutedEventArgs e) { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select p.name,p.address,p.phone,p.age,p.m_status,p.health_status,p.service_charges,d.doctorName as doctor_name,p.ts from patient p left join doctor d on p.doctor_id=d.id where p.id='" + WsApplication.pid + "'"; MySqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { //I would also check for DB.Null here before reading the value. string item = reader.GetString(reader.GetOrdinal("name")); WsApplication.pname = item; patientname.Text = reader.GetString(reader.GetOrdinal("name")); address.Text = reader.GetString(reader.GetOrdinal("address")); phoneno.Text = reader.GetString(reader.GetOrdinal("phone")); age.Text = reader.GetString(reader.GetOrdinal("age")); marital_status.Text = reader.GetString(reader.GetOrdinal("m_status")); healthstatus.Text = reader.GetString(reader.GetOrdinal("health_status")); servicecharges.Text = reader.GetString(reader.GetOrdinal("service_charges")); dtpDate.SelectedDate = reader.GetDateTime(reader.GetOrdinal("ts")); doctor_name.Text = reader.GetString(reader.GetOrdinal("doctor_name")); } } MyCon.Close(); MyCon.Open(); MySqlCommand cmd1 = MyCon.CreateCommand(); cmd.CommandText = "select h.lineno,p.name,h.history_amount,h.history_status,h.doctor_fee,h.medical_fee,h.tax,h.service_charges,h.appointment_date,d.doctorName as doctor_name,d1.doctorName as hand_over_name from history h left join patient p on h.patient_id=p.id left join doctor d on d.id=h.doctor_id left join doctor d1 on d1.id=h.hand_over_by where p.id='" + WsApplication.pid + "'"; MySqlDataReader reader1 = cmd.ExecuteReader(); gc_patient_history.ItemsSource = reader1; MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } status_ok = true; }
private void LoadPatientData() { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select p.id,p.name,p.address,p.age,p.m_status,p.health_status,d.doctorName,p.p_status from patient p left join doctor d on p.doctor_id=d.id order by p.ts desc"; MySqlDataReader reader = cmd.ExecuteReader(); gc_booking_patient_list.ItemsSource = reader; MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadDoctorDate() { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select d.doctorName,d.position,d.specialist,d.work_experience,d.age,d.degree,d.id from doctor d order by d.ts desc;"; MySqlDataReader reader = cmd.ExecuteReader(); gc_doctor_list.ItemsSource = reader; MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadDoctorData() { MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "select r.id,r.name,r.address,r.remark from refer_doctor r order by r.ts;"; MySqlDataReader reader = cmd.ExecuteReader(); gc_doctor_list.ItemsSource = reader; MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnCreateHistory_Click(object sender, RoutedEventArgs e) { string lineno = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString(); lineno = "111"; string h_status = history_status.Text; decimal h_amount = Decimal.Parse(history_amount.Text); decimal d_fee = Decimal.Parse(doctor_fee.Text); decimal m_fee = Decimal.Parse(history_amount.Text); decimal ptax = Decimal.Parse(tax.Text); decimal s_charges = Decimal.Parse(servicecharges.Text); //DateTime fs = new DateTime(dtpDate.SelectedDate.Value.Year, // dtpDate.SelectedDate.Value.Month, dtpDate.SelectedDate.Value.Day, dtpDate.SelectedDate.Value.Hour, dtpDate.SelectedDate.Value.Minute, dtpDate.SelectedDate.Value.Second); string fs = dtpDate.SelectedDate.Value.ToString("yyyy-MM-dd 00:00:00"); string d_id = combo_doctor_name.SelectedItem.ToString(); string h_id = ""; if (handovercheck.IsChecked == true) { h_id = combo_handover_doctor.SelectedItem.ToString(); } MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "insert into history(patient_id,lineno,history_status,history_amount,doctor_fee,medical_fee,tax,service_charges,appointment_date,doctor_id,hand_over_by,active,is_delete,ts) values('" + WsApplication.pid + "','" + lineno + "','" + h_status + "','" + h_amount + "','" + d_fee + "','" + m_fee + "','" + ptax + "','" + s_charges + "','" + fs + "','" + d_id + "','" + h_id + "','" + 1 + "','" + 0 + "','" + DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "');"; MySqlDataReader reader = cmd.ExecuteReader(); MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } status_ok = true; this.Close(); }
private void btnCreateDoctor_Click(object sender, RoutedEventArgs e) { string docName = doctorName.Text; string d_address = address.Text; string d_remark = remark.Text; status_Ok = true; this.Close(); MySqlConnection MyCon = WsApplication.ConnectionString(); try { MyCon.Open(); MySqlCommand cmd = MyCon.CreateCommand(); cmd.CommandText = "insert into refer_doctor(name,address,remark,count_point,active,is_delete,ts) values('" + docName + "','" + d_address + "','" + d_remark + "','" + 0 + "','" + 1 + "','" + 0 + "','" + DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "');"; MySqlDataReader reader = cmd.ExecuteReader(); MyCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }