Пример #1
0
        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            FirstWindowTherapist wind = new FirstWindowTherapist(user);

            wind.Show();
            Close();
        }
Пример #2
0
 private void EnterTher_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int    password = MyPassword.Password.GetHashCode();
         string login    = Login.Text;
         if (login != "" && MyPassword.Password != "")
         {
             var user = users.FirstOrDefault(x => x.PASSWORD_HASH == password && x.LOGIN == login);
             if (user != null)
             {
                 if (user.LOGIN == "admin")
                 {
                     AdminWindow wind = new AdminWindow();
                     wind.Show();
                     Close();
                 }
                 else
                 {
                     FirstWindowTherapist wind = new FirstWindowTherapist(user);
                     wind.Show();
                     Close();
                 }
             }
             else
             {
                 MessageBox.Show("Неправильный логин или пароль");
             }
         }
         else
         {
             MessageBox.Show("Заполните поля!");
         }
     }
     catch (ArgumentNullException ex)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
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();
                }
            }
        }