예제 #1
0
        private void ListBoxVisits_DoubleClick(object sender, EventArgs e)
        {
            SubjectState selected = (SubjectState)listBoxVisits.SelectedItem;

            if (selected == null)
            {
                return;
            }

            MessageBox.Show($" STNR: {selected.Stnr}\n " +
                            $"ATNR: {selected.Atnr}\n " +
                            $"Galant: {selected.Galant}\n " +
                            $"TLRH: {selected.TlrH}\n " +
                            $"ejtőernyős: {selected.Ejto}\n " +
                            $"TLRE: {selected.TlrE}\n " +
                            $"Schilder: {selected.Schilder}\n " +
                            $"Babinski: {selected.Babinski}\n " +
                            $"Markoló: {selected.Mar}\n " +
                            $"Szopó: {selected.Szo}\n " +
                            $"Moro: {selected.Mor}\n " +
                            $"Nystagmus: {selected.Niszt}\n " +
                            $"bal agyfélteke: {selected.Left}\n " +
                            $"jobb agyfélteke: {selected.Right}"
                            , "Részletes eredmény", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #2
0
 public void NewSubjectState(SubjectState subjState)
 {
     Connect();
     try
     {
         command.Parameters.Clear();
         command.CommandText = "INSERT INTO SubjectState VALUES(@id, @lastVisit, @stnr, @atnr, @galant, @tlre, @tlrh, @mar, @szo, @mor, @left, @right, @niszt, @notes, @subjId, @ejto, @bab, @schi)";
         command.Parameters.AddWithValue("@id", null);
         command.Parameters.AddWithValue("@lastVisit", subjState.LastVisit);
         command.Parameters.AddWithValue("@stnr", subjState.Stnr);
         command.Parameters.AddWithValue("@atnr", subjState.Atnr);
         command.Parameters.AddWithValue("@galant", subjState.Galant);
         command.Parameters.AddWithValue("@tlre", subjState.TlrE);
         command.Parameters.AddWithValue("tlrh", subjState.TlrH);
         command.Parameters.AddWithValue("@mar", subjState.Mar);
         command.Parameters.AddWithValue("@szo", subjState.Szo);
         command.Parameters.AddWithValue("@mor", subjState.Mor);
         command.Parameters.AddWithValue("@left", subjState.Left);
         command.Parameters.AddWithValue("@right", subjState.Right);
         command.Parameters.AddWithValue("@niszt", subjState.Niszt);
         command.Parameters.AddWithValue("@notes", subjState.Notes);
         command.Parameters.AddWithValue("@subjId", subjState.SubjectId);
         command.Parameters.AddWithValue("@ejto", subjState.Ejto);
         command.Parameters.AddWithValue("@bab", subjState.Babinski);
         command.Parameters.AddWithValue("@schi", subjState.Schilder);
         command.ExecuteNonQuery();
         CloseConnection();
     }
     catch (Exception ex)
     {
         throw new DbException("Adding this parameter was not successful!", ex);
     }
 }
예제 #3
0
        public static SubjectState Difference(Subject subject)
        {
            SubjectState current = subject.SubjectStates.LastOrDefault();
            SubjectState before  = subject.SubjectStates[subject.SubjectStates.Count - 2];

            SubjectState difference = new SubjectState(
                current.LastVisit,
                current.Stnr - before.Stnr,
                current.Atnr - before.Atnr,
                current.Galant - before.Galant,
                current.TlrE - before.TlrE,
                current.TlrH - before.TlrH,
                current.Mar - before.Mar,
                current.Szo - before.Szo,
                current.Mor - before.Mor,
                current.Left - before.Left,
                current.Right - before.Right,
                current.Niszt - before.Niszt,
                current.Notes,
                current.Ejto - before.Ejto,
                current.Babinski - before.Babinski,
                current.Schilder - before.Schilder
                );

            return(difference);
        }
예제 #4
0
        public static double PercentageDiff(Subject subject)
        {
            SubjectState current = subject.SubjectStates.LastOrDefault();
            SubjectState before  = subject.SubjectStates[subject.SubjectStates.Count - 2];

            double oneBeforeLastPercentage =
                (before.Stnr +
                 before.Atnr +
                 before.Galant +
                 before.TlrH +
                 before.TlrE +
                 before.Mar +
                 before.Szo +
                 before.Mor +
                 before.Niszt +
                 before.Ejto +
                 before.Babinski +
                 before.Schilder) / 24.00;

            double currentPercentage =
                (current.Stnr +
                 current.Atnr +
                 current.Galant +
                 current.TlrH +
                 current.TlrE +
                 current.Mar +
                 current.Szo +
                 current.Mor +
                 current.Niszt +
                 current.Ejto +
                 current.Babinski +
                 current.Schilder) / 24.00;

            return(Math.Round((currentPercentage - oneBeforeLastPercentage), 2) * 100);
        }
예제 #5
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            //manager = new SQLiteManager();
            IsNoteOnly = checkBoxNotesOnly.Checked;

            SubjectState = new SubjectState(
                dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm"),
                (int)numericUpDownStnr.Value,
                (int)numericUpDownAtnr.Value,
                (int)numericUpDownGalant.Value,
                (int)numericUpDownTlre.Value,
                (int)numericUpDownTlrh.Value,
                (int)numericUpDownMarkolo.Value,
                (int)numericUpDownSzopo.Value,
                (int)numericUpDownMoro.Value,
                (int)numericUpDownBal.Value,
                (int)numericUpDownJobb.Value,
                (int)numericUpDownNyrt.Value,
                textBoxNotes.Text,
                (int)numericUpDownEjto.Value,
                (int)numericUpDownBabinski.Value,
                (int)numericUpDownSchilder.Value
                )
            ;

            if (IsNoteOnly)
            {
                manager.UpdateNotes(Subject, Note);
            }
            else
            {
                if (IsNewSubject)
                {
                    Subject = new Subject(
                        textBoxFirstName.Text,
                        textBoxLastName.Text,
                        dateTimePickerBirthDay.Value.ToString("yyyy-MM-dd")
                        );

                    SubjectState.SubjectId = Subject.Id;
                    Subject.SubjectStates.Add(SubjectState);
                    manager.NewSubjectWithState(Subject, SubjectState);
                }
                else if (!IsNewSubject)
                {
                    SubjectState.SubjectId = Subject.Id;
                    SubjectState.Notes     = textBoxNotes.Text;
                    Note = textBoxNotes.Text;
                    manager.NewSubjectState(SubjectState);
                }
            }
        }
예제 #6
0
 public void DeleteSubjectState(Subject subject, SubjectState state)
 {
     Connect();
     try
     {
         command.Parameters.Clear();
         command.CommandText = "DELETE FROM SubjectState WHERE Id = (SELECT Id FROM SubjectState WHERE SubjectId = @Id AND LastVisit = @lv LIMIT 1)";
         command.Parameters.AddWithValue("@Id", subject.Id);
         command.Parameters.AddWithValue("@lv", state.LastVisit);
         command.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         throw new Exception("Deleting SubjectState was unsuccessful." + ex.Message);
     }
     CloseConnection();
 }
예제 #7
0
        public void NewSubjectWithState(Subject subject, SubjectState subjState)
        {
            Connect();
            string query = "INSERT INTO Subject VALUES (@id, @FirstName, @LastName, @BirthDate); SELECT last_insert_rowid();";

            try
            {
                command = new SQLiteCommand(query, connection);
                command.Parameters.AddWithValue("id", null);
                command.Parameters.AddWithValue("@FirstName", subject.FirstName);
                command.Parameters.AddWithValue("@LastName", subject.LastName);
                command.Parameters.AddWithValue("@BirthDate", subject.BirthDate);

                subjState.SubjectId = (int)((long)command.ExecuteScalar());

                command.CommandText = "INSERT INTO SubjectState VALUES (@id, @lastVisit, @stnr, @atnr, @galant, @tlre, @tlrh, @mar, @szo, @mor, @left, @right, @niszt, @notes, @subjId, @ejto, @bab, @schi)";
                command.Parameters.AddWithValue("id", null);
                command.Parameters.AddWithValue("@lastVisit", subjState.LastVisit);
                command.Parameters.AddWithValue("@stnr", subjState.Stnr);
                command.Parameters.AddWithValue("@atnr", subjState.Atnr);
                command.Parameters.AddWithValue("@galant", subjState.Galant);
                command.Parameters.AddWithValue("@tlre", subjState.TlrE);
                command.Parameters.AddWithValue("tlrh", subjState.TlrH);
                command.Parameters.AddWithValue("@mar", subjState.Mar);
                command.Parameters.AddWithValue("@szo", subjState.Szo);
                command.Parameters.AddWithValue("@mor", subjState.Mor);
                command.Parameters.AddWithValue("@left", subjState.Left);
                command.Parameters.AddWithValue("@right", subjState.Right);
                command.Parameters.AddWithValue("@niszt", subjState.Niszt);
                command.Parameters.AddWithValue("@notes", subjState.Notes);
                command.Parameters.AddWithValue("@subjId", subjState.SubjectId);
                command.Parameters.AddWithValue("@ejto", subjState.Ejto);
                command.Parameters.AddWithValue("@bab", subjState.Babinski);
                command.Parameters.AddWithValue("@schi", subjState.Schilder);
                command.ExecuteNonQuery();
                CloseConnection();
            }
            catch (Exception ex)
            {
                throw new DbException("Inserting new subject was unsuccessful!", ex);
            }
        }
예제 #8
0
        private void ListBoxSubjects_DoubleClick(object sender, EventArgs e)
        {
            Subject selected = (Subject)listBoxSubjects.SelectedItem;

            if (selected == null)
            {
                return;
            }

            if (selected.SubjectStates.Count < 2)
            {
                return;
            }
            else
            {
                SubjectState state     = Evaluate.Difference(selected);
                double       ratioDiff = Evaluate.PercentageDiff(selected);

                MessageBox.Show(
                    $" Stnr: {state.Stnr}\n " +
                    $"Atnr: {state.Atnr}\n " +
                    $"Galant: {state.Galant}\n " +
                    $"TLRH: {state.TlrH}\n " +
                    $"ejtőernyős: {state.Ejto}\n " +
                    $"TLRE: {state.TlrE}\n " +
                    $"Schilder: {state.Schilder}\n " +
                    $"Babinski: {state.Babinski}\n " +
                    $"markoló: {state.Mar}\n " +
                    $"szopó: {state.Szo}\n " +
                    $"Moro: {state.Mor}\n " +
                    $"Nyst: {state.Niszt}\n\n " +
                    $"százalékos változás a reflexekben: {ratioDiff}% \n\n " +
                    $"bal agyfélteke: {state.Left}\n " +
                    $"jobb agyfélteke: {state.Right}\n "
                    , "Utolsó két mérés különbsége", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #9
0
        private void DeleteResult_Click(object sender, EventArgs e)
        {
            if (listBoxVisits.Items.Count < 2)
            {
                MessageBox.Show("Minden alanyhoz legalább egy bejegyzés kell, hogy tartozzon! Az eredmény törlése nem lehetséges. (Fontolja meg az alany törlését és újrafelvételét, vagy új eredmény felvételét a jelenlegi törlése előtt)", "Hiba - törlés", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                DialogResult result = MessageBox.Show("Biztosan törli a kijelölt eredményt?", "Törlés?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    SubjectState stateToDelete = (SubjectState)listBoxVisits.SelectedItem;
                    manager.DeleteSubjectState(Subject, stateToDelete);

                    listBoxVisits.DataSource = manager.GetResultsForSubject(Subject);
                }
            }
        }