Exemplo n.º 1
0
        private void СhangeHistory_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // check patient was chosen in list
                if (datagridHistory.SelectedItems.Count <= 0)
                {
                    return;
                }
                // get selected patient
                HistoryVisiting historychange = datagridHistory.SelectedItem as HistoryVisiting;

                // show confirmation message box
                if (MessageBox.Show($"Вы уверенны, что хотите изменить ?",
                                    "Подтвердите", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    using (MyDbContext db = new MyDbContext())
                    {
                        // save position to restore
                        int selectedIndex = datagridHistory.SelectedIndex;
                        historychange = db.HistoryVisitings.FirstOrDefault(p => p.Id == historychange.Id);

                        db.HistoryVisitings.Find(historychange.Id).Info = InfoForCheck.Text;
                        // save
                        db.SaveChanges();

                        MaterialMessageBox.Show("Данные изменены", "Уведомление");
                        InfoForCheck.Text = "";
                        ShowHistory();
                    }
                }
            }
            catch (Exception) {}
        }
Exemplo n.º 2
0
        public void ShowHistory()
        {
            using (MyDbContext db = new MyDbContext())
            {
                //select only patient
                datagridHistory.ItemsSource = db.HistoryVisitings.Where(p => p.UserId == userr.Id).ToList();

                a = db.HistoryVisitings.Where(p => p.UserId == userr.Id).FirstOrDefault();
            }
        }
Exemplo n.º 3
0
        public void ShowHistory()
        {
            using (MyDbContext db = new MyDbContext())
            {
                User thisUser = db.Users.Find(App.CurrentUser.Id);
                //select only patient
                datagridPatiens.ItemsSource = db.HistoryVisitings.Where(p => p.UserId == thisUser.Id).ToList();

                a = db.HistoryVisitings.Where(p => p.UserId == thisUser.Id).FirstOrDefault();
            }
        }
Exemplo n.º 4
0
        private void ConfirmVisiting_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // check patient was chosen in list
                if (datagridPatiens.SelectedItems.Count <= 0)
                {
                    return;
                }
                // get selected patient
                Recording recording = datagridPatiens.SelectedItem as Recording;

                // show confirmation message box
                if (MessageBox.Show($"Вы уверенны, что хотите сделать это?",
                                    "Подтвердите", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    using (MyDbContext db = new MyDbContext())
                    {
                        // save position to restore
                        int selectedIndex = datagridPatiens.SelectedIndex;
                        recording = db.Recordings.FirstOrDefault(p => p.Id == recording.Id);

                        HistoryVisiting histoty = new HistoryVisiting();
                        histoty.Id        = recording.Id;
                        histoty.UserId    = recording.UserId;
                        histoty.FIO       = recording.FIO;
                        histoty.Doctor    = recording.Doctor;
                        histoty.Cabinet   = recording.Cabinet;
                        histoty.VisitDay  = recording.VisitDay;
                        histoty.VisitTime = recording.VisitTime;
                        histoty.Info      = InfoForCardConfirm.Text;

                        db.HistoryVisitings.Add(histoty);
                        db.Recordings.Remove(recording);
                        // save
                        db.SaveChanges();

                        MaterialMessageBox.Show("Талон подтверждён", "Уведомление");
                        InfoForCardConfirm.Text = "";
                        showInfo();
                        ShowHistory();
                    }
                }
            }
            catch (Exception)
            {
            }
        }