Exemplo n.º 1
0
        public static ObservableCollection <Modality> GetModalities()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var modalities = new ObservableCollection <Modality>();
                using (var cmd = new SqlCommand("SELECT * FROM CluSys.F_GetModalities ()", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            modalities.Add(new Modality
                            {
                                Name            = reader["Name"].ToString(),
                                RecognitionYear = int.Parse(reader["RecognitionYear"].ToString()),
                            });
                        }
                    }
                }

                return(modalities);
            }
        }
Exemplo n.º 2
0
        public MedicalEvaluation GetMedicalEvaluation()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                MedicalEvaluation evaluation;
                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetEvaluation ({EvalId});", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        if (!reader.Read())
                        {
                            return(null);
                        }

                        evaluation = new MedicalEvaluation
                        {
                            Id                = int.Parse(reader["Id"].ToString()),
                            Weight            = double.TryParse(reader["Weight"].ToString(), out double weight) ? (double?)weight : null,
                            Height            = double.TryParse(reader["Height"].ToString(), out double height) ? (double?)height : null,
                            Story             = reader["Story"].ToString(),
                            OpeningDate       = DateTime.Parse(reader["OpeningDate"].ToString()),
                            ClosingDate       = DateTime.TryParse(reader["ClosingDate"].ToString(), out DateTime closingDate) ? (DateTime?)closingDate : null,
                            ExpectedRecovery  = DateTime.TryParse(reader["ExpectedRecovery"].ToString(), out DateTime expectedRecovery) ? (DateTime?)expectedRecovery : null,
                            AthleteCC         = reader["AthleteCC"].ToString(),
                            PhysiotherapistCC = reader["PhysiotherapistCC"].ToString()
                        };
                    }
                }

                return(evaluation);
            }
        }
Exemplo n.º 3
0
        /* This function is used! It is called using reflection. */
        public ObservableCollection <Athlete> GetAthletes()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var athletes = new ObservableCollection <Athlete>();
                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetAthletes ('{Name}');", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            athletes.Add(new Athlete
                            {
                                CC           = reader["CC"].ToString(),
                                FirstName    = reader["FirstName"].ToString(),
                                MiddleName   = reader["MiddleName"].ToString(),
                                LastName     = reader["LastName"].ToString(),
                                Birthdate    = DateTime.Parse(reader["Birthdate"].ToString()),
                                Photo        = reader["Photo"].ToString(),
                                Phone        = reader["Phone"].ToString(),
                                Email        = reader["Email"].ToString(),
                                Password     = reader["Password"] as byte[],
                                Job          = reader["Job"].ToString(),
                                DominantSide = reader["DominantSide"].ToString(),
                                ModalityId   = reader["ModalityId"].ToString(),
                            });
                        }
                    }
                }

                return(athletes);
            }
        }
Exemplo n.º 4
0
        public ObservableCollection <MajorProblem> GetProblems()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var problems = new ObservableCollection <MajorProblem>();
                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetProblems ({EvalId}, {Id});", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            problems.Add(new MajorProblem
                            {
                                Id          = int.Parse(reader["Id"].ToString()),
                                Description = reader["Description"].ToString(),
                                EvalId      = int.Parse(reader["EvalId"].ToString()),
                                SessionId   = int.Parse(reader["SessionId"].ToString()),
                            });
                        }
                    }
                }

                return(problems);
            }
        }
Exemplo n.º 5
0
        public ObservableCollection <BodyChartMark> GetMarks()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var bodyMarks = new ObservableCollection <BodyChartMark>();
                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetBodyChartMarks ({EvalId}, {Id})", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            bodyMarks.Add(new BodyChartMark(int.Parse(reader["Id"].ToString()))
                            {
                                X           = double.Parse(reader["X"].ToString()),
                                Y           = double.Parse(reader["Y"].ToString()),
                                PainLevel   = int.Parse(reader["PainLevel"].ToString()),
                                Description = reader["Description"].ToString(),
                                EvalId      = int.Parse(reader["EvalId"].ToString()),
                                SessionId   = int.Parse(reader["SessionId"].ToString()),
                                ViewId      = int.Parse(reader["ViewId"].ToString()),
                            });
                        }
                    }
                }

                return(bodyMarks);
            }
        }
Exemplo n.º 6
0
        public static ObservableCollection <BodyChartView> GetViews()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var bodyViews = new ObservableCollection <BodyChartView>();
                using (var cmd = new SqlCommand("SELECT * FROM CluSys.F_GetBodyViews();", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            bodyViews.Add(new BodyChartView
                            {
                                Id    = int.Parse(reader["Id"].ToString()),
                                Image = reader["Image"].ToString(),
                                Order = int.Parse(reader["Order"].ToString()),
                            });
                        }
                    }
                }

                return(bodyViews);
            }
        }
Exemplo n.º 7
0
        public static ObservableCollection <Annotation> GetAnnotations()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var annotations = new ObservableCollection <Annotation>();
                using (var cmd = new SqlCommand("SELECT * FROM CluSys.F_GetAnnotations();", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            annotations.Add(new Annotation
                            {
                                Symbol  = reader["Symbol"].ToString(),
                                Meaning = reader["Meaning"].ToString(),
                            });
                        }
                    }
                }

                return(annotations);
            }
        }
Exemplo n.º 8
0
        public ObservableCollection <SessionObservation> GetObservations()
        {
            var obs = new ObservableCollection <SessionObservation>();

            using (var conn = ClusysUtils.GetConnection())
            {
                conn.Open();

                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetOpenObservations ({Id});", conn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            obs.Add(new SessionObservation
                            {
                                Id         = int.Parse(reader["Id"].ToString()),
                                Obs        = reader["Obs"].ToString(),
                                DateClosed = string.IsNullOrEmpty(reader["DateClosed"].ToString()) ? null : (DateTime?)DateTime.Parse(reader["DateClosed"].ToString()),
                                EvalId     = int.Parse(reader["EvalId"].ToString()),
                                SessionId  = int.Parse(reader["SessionId"].ToString())
                            });
                        }
                    }
                }
            }

            return(obs);
        }
Exemplo n.º 9
0
        public ObservableCollection <MedicalEvaluation> GetEvaluations()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var evaluations = new ObservableCollection <MedicalEvaluation>();
                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetEvaluations ('{CC}');", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            evaluations.Add(new MedicalEvaluation(evaluations)
                            {
                                Id                = int.Parse(reader["Id"].ToString()),
                                Weight            = double.TryParse(reader["Weight"].ToString(), out double weight) ? (double?)weight : null,
                                Height            = double.TryParse(reader["Height"].ToString(), out double height) ? (double?)height : null,
                                Story             = reader["Story"].ToString(),
                                OpeningDate       = DateTime.Parse(reader["OpeningDate"].ToString()),
                                ClosingDate       = DateTime.TryParse(reader["ClosingDate"].ToString(), out DateTime closingDate) ? (DateTime?)closingDate : null,
                                ExpectedRecovery  = DateTime.TryParse(reader["ExpectedRecovery"].ToString(), out DateTime expectedRecovery) ? (DateTime?)expectedRecovery : null,
                                AthleteCC         = reader["AthleteCC"].ToString(),
                                PhysiotherapistCC = reader["PhysiotherapistCC"].ToString(),
                            });
Exemplo n.º 10
0
        public ObservableCollection <TreatmentPlan> GetTreatments()
        {
            using (var cn = ClusysUtils.GetConnection())
            {
                cn.Open();

                var treatments = new ObservableCollection <TreatmentPlan>();
                using (var cmd = new SqlCommand($"SELECT * FROM CluSys.F_GetTreatments ({EvalId}, {Id});", cn))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            treatments.Add(new TreatmentPlan
                            {
                                Id          = int.Parse(reader["Id"].ToString()),
                                Description = reader["Description"].ToString(),
                                Objective   = reader["Objective"].ToString(),
                                EvalId      = int.Parse(reader["EvalId"].ToString()),
                                SessionId   = int.Parse(reader["SessionId"].ToString()),
                                ProbId      = int.TryParse(reader["ProbId"].ToString(), out int probId) ? (int?)probId : null,
                            });