/// <summary>
        /// Returns the list of languages used by a survey.
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static List <string> GetLanguages(StudyWave s)
        {
            List <string> langs = new List <string>();
            string        query = "SELECT Lang FROM Translations.FN_GetWaveLanguages(@wid)";

            using (SqlDataAdapter sql = new SqlDataAdapter())
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISISConnectionString"].ConnectionString))
                {
                    conn.Open();
                    sql.SelectCommand = new SqlCommand(query, conn);
                    sql.SelectCommand.Parameters.AddWithValue("@wid", s.WaveID);

                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                if (!rdr.IsDBNull(rdr.GetOrdinal("Lang")))
                                {
                                    langs.Add((string)rdr["Lang"]);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        int i = 0;
                    }
                }
            return(langs);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the list of waves for a study.
        /// </summary>
        /// <param name="studyID"></param>
        /// <param name="getSurveys"></param>
        /// <returns></returns>
        public static List <StudyWave> GetWaves(int studyID)
        {
            List <StudyWave> waves = new List <StudyWave>();
            StudyWave        w;
            string           query = "SELECT * FROM FN_GetWavesByStudy(@studyID)";

            using (SqlDataAdapter sql = new SqlDataAdapter())
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISISConnectionString"].ConnectionString))
                {
                    conn.Open();

                    sql.SelectCommand = new SqlCommand(query, conn);
                    sql.SelectCommand.Parameters.AddWithValue("@studyID", studyID);

                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                w = new StudyWave
                                {
                                    WaveID   = (int)rdr["WaveID"],
                                    ISO_Code = (string)rdr["ISO_Code"],
                                    Wave     = (double)rdr["Wave"]
                                };

                                waves.Add(w);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }

            return(waves);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns a list of survey waves.
        /// </summary>
        /// <returns></returns>
        public static List <StudyWave> GetWaveInfo()
        {
            List <StudyWave> waves = new List <StudyWave>();
            StudyWave        w;
            string           query = "SELECT * FROM FN_GetAllWaves() ORDER BY ISO_Code, Wave";

            using (SqlDataAdapter sql = new SqlDataAdapter())
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISISConnectionString"].ConnectionString))
                {
                    conn.Open();

                    sql.SelectCommand = new SqlCommand(query, conn);

                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                w = new StudyWave()
                                {
                                    WaveID   = (int)rdr["WaveID"],
                                    ISO_Code = (string)rdr["ISO_Code"],
                                    Wave     = (double)rdr["Wave"]
                                };

                                waves.Add(w);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        int i = 0;
                    }
                }

            return(waves);
        }