Esempio n. 1
0
        private void cbChoseSpesialty_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetRadioButtons();

            mcThisMonth.Enabled = false;
            RadioButtonsEnabledFalse();

            using (var client = new HaServiceClient())
            {
                var check = client.GetDoctorsBySpecialy(client.GetSpecialtyIdByName(cbChoseSpesialty.SelectedItem.ToString()));
                if (check.Length > 0)
                {
                    cbChoseDoctor.DataSource =
                        client.GetDoctorsBySpecialy(client.GetSpecialtyIdByName(cbChoseSpesialty.SelectedItem.ToString()));
                    cbChoseDoctor.DisplayMember = "FirstName";
                    cbChoseDoctor.ValueMember   = "DoctorId";
                }
                else
                {
                    cbChoseDoctor.Enabled = false;
                    //mcThisMonth.Enabled = false;
                    //RadioButtonsEnabledFalse();
                }
                cbChoseDoctor.Enabled = true;
            }
        }
Esempio n. 2
0
        private void btSpecialtyDelete_Click(object sender, EventArgs e)
        {
            int selectedDoctorssCount = lvSpecialty.SelectedItems.Count;

            if (selectedDoctorssCount != 0)
            {
                ListViewItem selectedSpecialty = lvSpecialty.SelectedItems[0];
                int          selectedId        = int.Parse(selectedSpecialty.SubItems[0].Text);
                var          confirmResult     = MessageBox.Show("Are you sure to delete this Specialty?\nSpecialty :  " + selectedSpecialty.SubItems[1].Text, "Confirm delete!", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    using (var client = new HaServiceClient())
                    {
                        Specialty specialty            = client.GetSpecialtyById(selectedId);
                        var       getAllDocBySpecialty = client.GetDoctorsBySpecialy(selectedId);
                        if (getAllDocBySpecialty.Length != 0)
                        {
                            tsslSpecialty.ForeColor = Color.Crimson;
                            tsslSpecialty.Text      = "Unable to delete, doctors with this sp exist";
                            return;
                        }
                        client.DeleteSpecialty(specialty);
                        FillSpecialtyListView();
                        FillCbChoseSpesialty();
                        tsslSpecialty.ForeColor = Color.Green;
                        tsslSpecialty.Text      = "Specialty sucssesfuly deleted";
                    }
                }
                else
                {
                    //DialogResult = DialogResult.None;
                    return;
                }
            }
        }