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();
            }
        }
Ejemplo n.º 2
0
        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
                }
            }
        }