Exemple #1
0
        /// <summary>
        /// Returns all response sets of a specific type.
        /// </summary>
        /// <param name="fieldname"></param>
        /// <returns></returns>
        public static List <ResponseSet> GetResponseSets(string fieldname)
        {
            List <ResponseSet> setList = new List <ResponseSet>();
            ResponseSet        rs;
            string             query = "SELECT * FROM Wordings.FN_GetResponseSets(@field) ORDER BY RespName";

            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("@field", fieldname);

                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                rs = new ResponseSet
                                {
                                    RespSetName = (string)rdr["RespName"],
                                    FieldName   = fieldname,
                                    RespList    = (string)rdr["ResponseList"]
                                };

                                setList.Add(rs);
                            }
                        }
                    }
                    catch
                    {
                    }
                }

            return(setList);
        }
 public static int UpdateResponseSet(ResponseSet respSet)
 {
     return(1);
 }
 public static int InsertResponseSet(ResponseSet respSet)
 {
     return(1);
 }