コード例 #1
0
        public List <DailyTaskDAO> GetActiveTasks(UserDAO patient)
        {
            List <DailyTaskDAO> results = new List <DailyTaskDAO>();

            patient.Find();

            if (!patient.UserClass.Equals("Patient"))
            {
                return(null);
            }

            string myQueryStr = "select DailyTaskClass, idDailyTask from DailyTask where active=true and idPatient=" + patient.idNumber;

            OdbcConnection myConnection = GetConnection();
            OdbcCommand    myCommand    = new OdbcCommand(myQueryStr, myConnection);

            myConnection.Open();

            OdbcDataReader myReader;

            myReader = myCommand.ExecuteReader();
            try
            {
                while (myReader.Read())
                {
                    DailyTaskDAO temp = null;

                    if (myReader.GetString(0).Equals("WalkingTask"))
                    {
                        temp = new WalkingTaskDAO();
                        temp.m_idDailyTask = myReader.GetInt32(1);
                    }

                    if (temp == null)
                    {
                        return(null);
                    }

                    temp.Find();

                    results.Add(temp);
                }
            }
            finally
            {
                myReader.Close();
                myConnection.Close();
            }

            return(results);
        }
コード例 #2
0
        /// <summary>
        /// If this is a Patient class record, find and return all the Active daily tasks associated with this record.
        /// </summary>
        /// <returns>A list of DailyTaskDAOs which represent the patient's active daily tasks. If the patient was not found, then an empty list is returned. If there was an error, null is returned. Note, the objects in the list will be derived classes of DailyTaskDAO and not DailyTaskDAO objects.</returns>
        public List <DailyTaskDAO> GetActiveTasks()
        {
            List <DailyTaskDAO> results = new List <DailyTaskDAO>();

            string myQueryStr = "select DailyTaskClass, idDailyTask from DailyTask where active=true and idPatient=" + m_idNumber;

            OdbcConnection myConnection = GetConnection();
            OdbcCommand    myCommand    = new OdbcCommand(myQueryStr, myConnection);

            myConnection.Open();

            OdbcDataReader myReader;

            myReader = myCommand.ExecuteReader();
            try
            {
                while (myReader.Read())
                {
                    DailyTaskDAO temp = null;

                    WalkingTaskDAO wtd        = new WalkingTaskDAO();
                    Type           typeofTask = Type.GetType("Server." + myReader.GetString(0) + "DAO", true);
                    temp = (DailyTaskDAO)(Activator.CreateInstance(typeofTask));

                    temp.idDailyTask = myReader.GetInt32(1);

                    if (temp == null)
                    {
                        return(null);
                    }

                    temp.Find();

                    results.Add(temp);
                }
            }
            finally
            {
                myReader.Close();
                myConnection.Close();
            }

            return(results);
        }
コード例 #3
0
        /// <summary>
        /// If this is a Patient class record, find and return all the Active daily tasks associated with this record.
        /// </summary>
        /// <returns>A list of DailyTaskDAOs which represent the patient's active daily tasks. If the patient was not found, then an empty list is returned. If there was an error, null is returned. Note, the objects in the list will be derived classes of DailyTaskDAO and not DailyTaskDAO objects.</returns>
        public List<DailyTaskDAO> GetActiveTasks()
        {
            List<DailyTaskDAO> results = new List<DailyTaskDAO>();

            string myQueryStr = "select DailyTaskClass, idDailyTask from DailyTask where active=true and idPatient=" + m_idNumber;

            OdbcConnection myConnection = GetConnection();
            OdbcCommand myCommand = new OdbcCommand(myQueryStr, myConnection);

            myConnection.Open();

            OdbcDataReader myReader;
            myReader = myCommand.ExecuteReader();
            try
            {
                while (myReader.Read())
                {
                    DailyTaskDAO temp = null;

                    WalkingTaskDAO wtd = new WalkingTaskDAO();
                    Type typeofTask = Type.GetType("Server."+myReader.GetString(0)+"DAO", true);
                    temp = (DailyTaskDAO)(Activator.CreateInstance(typeofTask));

                    temp.idDailyTask = myReader.GetInt32(1);

                    if (temp == null)
                        return null;

                    temp.Find();

                    results.Add(temp);
                }
            }
            finally
            {
                myReader.Close();
                myConnection.Close();
            }

            return results;
        }
コード例 #4
0
        public List<DailyTaskDAO> GetActiveTasks(UserDAO patient)
        {
            List<DailyTaskDAO> results = new List<DailyTaskDAO>();

            patient.Find();

            if (!patient.UserClass.Equals("Patient"))
                return null;

            string myQueryStr = "select DailyTaskClass, idDailyTask from DailyTask where active=true and idPatient=" + patient.idNumber;

            OdbcConnection myConnection = GetConnection();
            OdbcCommand myCommand = new OdbcCommand(myQueryStr, myConnection);

            myConnection.Open();

            OdbcDataReader myReader;
            myReader = myCommand.ExecuteReader();
            try
            {
                while (myReader.Read())
                {
                    DailyTaskDAO temp = null;

                    if (myReader.GetString(0).Equals("WalkingTask"))
                    {
                        temp = new WalkingTaskDAO();
                        temp.m_idDailyTask = myReader.GetInt32(1);

                    }

                    if (temp == null)
                        return null;

                    temp.Find();

                    results.Add(temp);
                }
            }
            finally
            {
                myReader.Close();
                myConnection.Close();
            }

            return results;
        }