Esempio n. 1
0
 private void Choose_Click(object sender, RoutedEventArgs e)
 {
     if (ResSet.SelectedItem != null)
     {
         VISIT v   = ((PatientTherapistVisit)ResSet.SelectedItem).v;
         int   pat = v.PATIENT_ID.Value;
         currentPatient = u.Patients.Get(pat);
         Visit wind = new Visit(currentPatient, user, v, datetime1);
         wind.Show();
         Close();
     }
     else
     {
         MessageBox.Show("Выберите пациента");
     }
 }
Esempio n. 2
0
        public PastVisits(PATIENT p, USERS user, DateTime dt)
        {
            u = new UnitOfWork();
            currentPatient = null;
            InitializeComponent();
            datetime1 = dt;
            this.user = user;
            var elements = from a1 in u.Visits.GetAll() where a1.PATIENT_ID == p.PATIENT_ID select a1;

            foreach (VISIT v in elements)
            {
                ResSet.Items.Add(new PatientTherapistVisit(u.Patients.Get(v.PATIENT_ID.Value), u.Users.Get(v.USER_ID.Value), v));
            }

            Choose.Visibility    = System.Windows.Visibility.Hidden;
            this.Title           = "Предыдущие посещения пациента " + p.SURNAME + " " + p.FATHERSNAME;
            ResSet.SelectionMode = DataGridSelectionMode.Single;
        }
Esempio n. 3
0
 public NewRecipe(PATIENT pat, USERS user)
 {
     InitializeComponent();
     currentPat = pat;
     this.user  = user;
 }
Esempio n. 4
0
 public PatientTherapistVisit(PATIENT p, USERS user, VISIT v)
 {
     this.p    = p;
     this.user = user;
     this.v    = v;
 }
Esempio n. 5
0
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            if (Surname.Text != "" && FirstName.Text != "" && Street.Text != "" && House.Text != "" &&
                ValidationText(Surname.Text) && ValidationText(FirstName.Text) &&
                ValidationNumber(House.Text) && ValidationText(Street.Text))
            {
                PATIENT newP;
                if (isNew)
                {
                    newP = new PATIENT();
                }
                else
                {
                    newP = u.Patients.Get(pat.PATIENT_ID);
                }
                newP.SURNAME   = Surname.Text;
                newP.FIRSTNAME = FirstName.Text;
                if (FatherName.Text != "")
                {
                    newP.FATHERSNAME = FatherName.Text;
                }
                if (GenderW.IsChecked == true)
                {
                    newP.GENDER = "ж";
                }
                else
                {
                    newP.GENDER = "м";
                }

                DateTime dt;
                if (DateTime.TryParse(DateBlock.Text, out dt))
                {
                    newP.BDAY = dt;
                }
                else
                {
                    MessageBox.Show("Дата рождения введена некорректно.\nЭто поле не будет занесено в базу данных");
                }

                if (Telephone.Text != "")
                {
                    newP.TELEPHONE = Telephone.Text;
                }
                else
                {
                    newP.TELEPHONE = null;
                }

                ADDRESS newAdr;
                if (isNew)
                {
                    newAdr = new ADDRESS();
                }
                else
                {
                    newAdr = a;
                }
                newAdr.STREET = Street.Text;
                newAdr.HOUSE  = House.Text;

                if (Housing.Text != "")
                {
                    newAdr.HOUSING = Housing.Text;
                }
                else
                {
                    newAdr.HOUSING = null;
                }
                int flat;
                if (Flat.Text != "" && int.TryParse(Flat.Text, out flat))
                {
                    newAdr.FLAT = flat;
                }
                else
                {
                    newAdr.FLAT = null;
                }

                if (isNew)
                {
                    u.Addresses.Create(newAdr);
                }

                //db.SaveChanges();
                u.Save();
                if (isNew)
                {
                    newP.ADDRESS_ID = newAdr.ADDRESS_ID;

                    u.Patients.Create(newP);
                    u.Save();
                }

                SearchPatient wind = new SearchPatient(user, datetime1);
                wind.Show();
                Close();
            }
            else
            {
                MessageBox.Show("Заполните поля корректной информацией!");
            }
        }