コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (IsDigitsOnly(txtPhone.Text) == false)
            {
                MessageBox.Show("Broj telefona mora sadržati samo cifre.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtPhone.Focus();
                return;
            }
            else if (!txtEmail.Text.Contains("@"))
            {
                MessageBox.Show("E-mail mora biti u formatu [email protected]", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtEmail.Focus();
                return;
            }
            else if (!txtEmail.Text.Contains(".com"))
            {
                MessageBox.Show("E-mail mora biti u formatu [email protected]", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtEmail.Focus();
                return;
            }

            Doctor d1 = doc;

            d1.HomeAddress = txtAdress.Text;
            d1.Email       = txtEmail.Text;
            d1.Phone       = txtPhone.Text;

            if (comboSpecial.SelectedItem.ToString().Equals("Dermatolog"))
            {
                d1.Type = TypeOfDoctor.Dermatolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("drOpstePrakse"))
            {
                d1.Type = TypeOfDoctor.drOpstePrakse;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Endokrinolog"))
            {
                d1.Type = TypeOfDoctor.Endokrinolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Ginekolog"))
            {
                d1.Type = TypeOfDoctor.Ginekolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("KardioVaskularniHirurg"))
            {
                d1.Type = TypeOfDoctor.KardioVaskularniHirurg;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Neurolog"))
            {
                d1.Type = TypeOfDoctor.Neurolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Oftamolog"))
            {
                d1.Type = TypeOfDoctor.Oftamolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Onkolog"))
            {
                d1.Type = TypeOfDoctor.Onkolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Ortoped"))
            {
                d1.Type = TypeOfDoctor.Ortoped;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Pulmolog"))
            {
                d1.Type = TypeOfDoctor.Pulmolog;
            }
            else
            {
                d1.Type = TypeOfDoctor.Radiolog;
            }

            List <City> cities = cc.ViewCities();

            foreach (City c in cities)
            {
                if (comboCity.SelectedItem.ToString().Equals(c.Name))
                {
                    d1.City = c;
                }
            }

            uc.EditProfile(d1);

            List <Examination> examinations = ec.ViewExaminationsByDoctor(doc.Jmbg);

            foreach (Examination exm in examinations)
            {
                exm.doctor = d1;
                ec.EditExamination(exm);
            }

            WorkingTime work = wc.viewWorkingTimeDoctor(doc.Jmbg);

            work.doctor = d1;
            wc.EditWorkingTime(work);

            var s = new MessageEditProfile();

            s.Show();

            this.Close();
        }