Example #1
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            var name    = txName.Text.Trim();
            var surname = txSurname.Text.Trim();
            var phone   = txPhone.Text.Trim();
            var adres   = txAdress.Text.Trim();
            var tc      = txTc.Text.Trim();

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(surname) ||
                string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(adres) ||
                string.IsNullOrEmpty(tc) || string.IsNullOrEmpty(pickbirthDay.Text))
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }

            var birthday = DateTime.ParseExact(pickbirthDay.Text.ToString(), "d.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture);

            ProgressOn();
            using (var db = new DentistDbEntities())
            {
                //insert
                if (updateDoktor.ID == 0)
                {
                    var model = db.Doctors.Add(db.Doctors.Create());
                    model.NAME       = name;
                    model.SURNAME    = surname;
                    model.BIRTHDAY   = birthday;
                    model.PHONE      = phone;
                    model.ADRESS     = adres;
                    model.PERSONELID = tc;
                    db.SaveChanges();
                }
                //update
                else
                {
                    var model = db.Doctors.SingleOrDefault(row => row.ID == updateDoktor.ID);
                    model.NAME       = name;
                    model.SURNAME    = surname;
                    model.BIRTHDAY   = birthday;
                    model.PHONE      = phone;
                    model.ADRESS     = adres;
                    model.PERSONELID = tc;
                    db.SaveChanges();
                }
            }

            ProgressOf();
            DialogHost.CloseDialogCommand.Execute(false, null);
        }
Example #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            ProgressOn();
            Patient clickedDoctor = ((FrameworkElement)sender).DataContext as Patient;

            using (var db = new DentistDbEntities())
            {
                var query = db.Patients.SingleOrDefault(x => x.ID == clickedDoctor.ID);
                query.ISDELETE = true;
                db.SaveChanges();
            }
            ProgressOf();
            getList();
        }
Example #3
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            ProgressOn();
            VW_Appointment clickedDoctor = ((FrameworkElement)sender).DataContext as VW_Appointment;

            using (var db = new DentistDbEntities())
            {
                var query = db.Appointments.SingleOrDefault(x => x.ID == clickedDoctor.ID);
                db.Appointments.Attach(query);
                db.Appointments.Remove(query);
                db.SaveChanges();
            }
            ProgressOf();
            getList();
        }
Example #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txEmail.Text) || string.IsNullOrEmpty(txName.Text) ||
                string.IsNullOrEmpty(txSurname.Text) || string.IsNullOrEmpty(txUsername.Text))
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }
            ProgressOn();
            using (var db = new DentistDbEntities())
            {
                var model = db.Users.SingleOrDefault(row => row.ID == user.ID);
                model.NAME     = txName.Text;
                model.SURNAME  = txSurname.Text;
                model.USERNAME = txUsername.Text;
                model.EMAIL    = txEmail.Text;
                db.SaveChanges();
                user = Shared.OnlineUser = model;
                MessageBox.Show("Başarılı İşlem.", "");
            }

            ProgressOf();
        }
Example #5
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            if ((comboDoctor.SelectedItem) == null)
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }


            if ((comboHasta.SelectedItem) == null)
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }

            if ((comboType.SelectedItem) == null)
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }


            if ((comboHour.SelectedItem) == null)
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }


            var price = txPrice.Text.Trim();
            var desc  = txDescription.Text.Trim();

            var doctor  = ((SimpleModel)comboDoctor.SelectedItem).ID;
            var patient = ((SimpleModel)comboHasta.SelectedItem).ID;
            var type    = ((SimpleModel)comboType.SelectedItem).NAME;
            var hour    = ((SimpleModel)comboHour.SelectedItem).ID;
            var isPaid  = chPaid.IsChecked;
            var isCame  = chCame.IsChecked;


            if (string.IsNullOrEmpty(price) || string.IsNullOrEmpty(desc) || string.IsNullOrEmpty(pickerDate.Text))
            {
                MessageBox.Show("Lütfen Bütün Alanları Doldurunuz.", "");
                return;
            }

            var date = DateTime.ParseExact(pickerDate.Text.ToString(), "d.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture);


            ProgressOn();
            using (var db = new DentistDbEntities())
            {
                //insert
                if (updateAppointment.ID == 0)
                {
                    var model = db.Appointments.Add(db.Appointments.Create());
                    model.DOCTORID    = doctor;
                    model.PATIENTID   = patient;
                    model.DATE        = date;
                    model.HOUR        = hour;
                    model.PRICE       = decimal.Parse(price);
                    model.ISCAME      = (bool)isCame;
                    model.ISPAID      = (bool)isPaid;
                    model.TYPE        = type;
                    model.DESCRIPTION = desc;
                    db.SaveChanges();
                }
                //update
                else
                {
                    var model = db.Appointments.SingleOrDefault(row => row.ID == updateAppointment.ID);
                    model.DOCTORID    = doctor;
                    model.PATIENTID   = patient;
                    model.DATE        = date;
                    model.HOUR        = hour;
                    model.PRICE       = decimal.Parse(price);
                    model.ISCAME      = (bool)isCame;
                    model.ISPAID      = (bool)isPaid;
                    model.TYPE        = type;
                    model.DESCRIPTION = desc;
                    db.SaveChanges();
                }
            }

            ProgressOf();
            DialogHost.CloseDialogCommand.Execute(false, null);
        }