コード例 #1
0
ファイル: NewVisit.xaml.cs プロジェクト: pomazafa/KP_OOP
        private void Ok_Click(object sender, RoutedEventArgs e)
        {
            //не забыть про datetime1
            if (ResSet.SelectedItem != null && Dates.SelectedItem != null)
            {
                VISIT visit = new VISIT();
                visit.PATIENT_ID       = p.PATIENT_ID;
                visit.IS_PLANNED       = true;
                visit.IS_COMPLETED     = false;
                visit.USER_ID          = ((USERS)ResSet.SelectedItem).USER_ID;
                visit.VISIT_DATE_TIME2 = DateTime.MaxValue;
                visit.VISIT_DATE_TIME1 = calendar.SelectedDate.Value.Date.AddHours(((MyTime)Dates.SelectedItem).Hours).AddMinutes(((MyTime)Dates.SelectedItem).Minutes);
                u.Visits.Create(visit);
                u.Save();
                if (user == null)
                {
                    MainWindow wind = new MainWindow();
                    wind.Show();
                }
                MessageBox.Show("Посещение добавлено в базу данных");

                Close();
            }
            else
            {
                MessageBox.Show("Выберите терапевта, дату и время посещения");
            }
        }
コード例 #2
0
        public Visit(PATIENT p, USERS user, DateTime dt)
        {
            InitializeComponent();
            u = new UnitOfWork();

            currentPatient = u.Patients.Get(p.PATIENT_ID);
            this.user      = u.Users.Get(user.USER_ID);
            datetime1      = dt;
            visit          = null;
        }
コード例 #3
0
        public Visit(PATIENT p, USERS user, VISIT visit, DateTime dt)
        {
            InitializeComponent();

            u = new UnitOfWork();
            currentPatient = p;
            datetime1      = dt;

            this.user  = u.Users.Get(user.USER_ID);
            isPlanned  = true;
            this.visit = u.Visits.Get(visit.VISIT_ID);
        }
コード例 #4
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("Выберите пациента");
     }
 }
コード例 #5
0
        private void End_Click(object sender, RoutedEventArgs e)
        {
            bool isOk = true;

            if (visit == null)
            {
                visit = new VISIT();
            }

            visit.COMPLAINTS = Complaints.Text;
            visit.DIAGNOSIS  = Diagnosis.Text;
            decimal d;

            if (Height.Text != "")
            {
                if (decimal.TryParse(Height.Text, out d) && d > 0)
                {
                    visit.HEIGHT = d;
                }
                else
                {
                    isOk = false;
                    MessageBox.Show("Поле роста заполнено неверно, возможно Вы использовали '.' вместо ',' или использовали буквы", "Ошибка");
                }
            }
            if (Weight.Text != "")
            {
                if (decimal.TryParse(Weight.Text, out d) && d > 0)
                {
                    visit.WEIGHT = d;
                }
                else
                {
                    isOk = false;
                    MessageBox.Show("Поле веса заполнено неверно, возможно Вы использовали '.' вместо ',' или использовали буквы", "Ошибка");
                }
            }

            visit.VISIT_DATE_TIME1 = DateTime.Now;

            visit.ADDITIONAL_INFORMATION = Additing.Text;

            visit.PRESSURE = Pressure.Text;



            visit.PATIENT_ID = currentPatient.PATIENT_ID;

            visit.IS_PLANNED = isPlanned;

            visit.USER_ID = user.USER_ID;


            if (isPlanned && isOk)
            {
                visit.IS_COMPLETED     = true;
                visit.VISIT_DATE_TIME2 = DateTime.Now;
                visit.VISIT_DATE_TIME1 = datetime1;
                u.Save();
                FirstWindowTherapist wind = new FirstWindowTherapist(user);
                wind.Show();
                Close();
            }
            else
            {
                if (isOk)
                {
                    visit.IS_COMPLETED     = true;
                    visit.VISIT_DATE_TIME1 = datetime1;
                    visit.VISIT_DATE_TIME2 = DateTime.Now;
                    u.Visits.Create(visit);
                    u.Save();
                    FirstWindowTherapist wind = new FirstWindowTherapist(user);
                    wind.Show();
                    Close();
                }
            }
        }
コード例 #6
0
 public PatientTherapistVisit(PATIENT p, USERS user, VISIT v)
 {
     this.p    = p;
     this.user = user;
     this.v    = v;
 }