private void PatientScreen_Load(object sender, EventArgs e) { Text = "HCS | " + patient.name + " " + patient.surname + "(" + patient.id + ") Patient Screen"; // Form'un ismini düzenle // Formdaki hasta bilgilerini getir txtName.Text = patient.name; txtSurname.Text = patient.surname; txtIdentity.Text = patient.identity; dtpShipment.Value = patient.shipment; chkDischarged.Checked = patient.is_discharged; // Action(İşlem) eklemedeki Policlinics ve Doctors comboboxlarını doldur. // Policlinic cbxPoliclinic.Items.Clear(); foreach (Polyclinic polyclinic in PolyclinicManager.All()) { cbxPoliclinic.Items.Add(polyclinic.name); } // Doctor cbxDoctor.Items.Clear(); foreach (Doctor doctor in DoctorManager.All()) { cbxDoctor.Items.Add(doctor.name); } refreshActions(); }
// Comboboxtaki poliklinikleri günceller private void refreshPolyclinics() { cbxPolyclinics.Items.Clear(); // Combobox'ın içine veritabanından gelen Polyclinic leri dolduralım. foreach (Polyclinic polyclinic in PolyclinicManager.All()) { cbxPolyclinics.Items.Add(polyclinic.name); } }
private void btnDelete_Click(object sender, EventArgs e) { if (Program.DeleteConfirm("Do you want delete this polyclinic? The polyclinic's patient actions also be deleted.")) { PolyclinicManager.Delete(poly); // Veritabanından polikliniği sil MessageBox.Show("Polyclinic successfully deleted!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); refreshPolyclinics(); // Combobox'ı güncelle changeVisible(false); // formu gizle txtDesc.Text = ""; // formu boş hale al chkStatus.Checked = true; // formu boş hale al cbxPolyclinics.Text = ""; // Combobox'taki ismi sil } }
private void btnInsert_Click(object sender, EventArgs e) { string polyclinicName = cbxPoliclinic.Text; string doctorName = cbxDoctor.Text; if (cbxPoliclinic.SelectedIndex != -1 && cbxDoctor.SelectedIndex != -1 && cbxAction.SelectedIndex != -1 && txtPrice.Text != "") { Polyclinic policlinic = PolyclinicManager.Get(polyclinicName); Doctor doctor = DoctorManager.Get(doctorName); PatientManager.AddAction(patient, policlinic, doctor, nupOrder.Value, cbxAction.Text, nupQuantity.Value, txtPrice.Text); MessageBox.Show("Action successfully added!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); refreshActions(); } }
private void button1_Click(object sender, EventArgs e) { string polyclinicName = cbxPolyclinics.Text; if (polyclinicName != "") { if (PolyclinicManager.Check(polyclinicName)) // Poliklinik var mı diye kontrol et { // Varsa, düzenleme formu changeVisible(true); // formu görünür yap poly = PolyclinicManager.Get(polyclinicName); // Veritabanından o polikliniği getir txtDesc.Text = poly.description; chkStatus.Checked = poly.status; } else { // Yoksa, oluşturma formu txtDesc.Text = ""; // Formu eski hale getir chkStatus.Checked = true; // Formu eski hale getir changeVisible(true); // formu görünür yap PolyclinicManager.Create(cbxPolyclinics.Text); // Combobox'ı yenile cbxPolyclinics.Items.Clear(); foreach (Polyclinic polyclinic in PolyclinicManager.All()) { cbxPolyclinics.Items.Add(polyclinic.name); } // Düzenlenen poliklinik olarak yeni eklenen polikliniği seç poly = PolyclinicManager.Get(polyclinicName); refreshPolyclinics(); // Combobox'ı güncelle } } }