Beispiel #1
0
        /// <summary>
        /// Returns all wordings of a specific type.
        /// </summary>
        /// <param name="fieldname"></param>
        /// <returns></returns>
        public static List <Wording> GetWordings(string fieldname)
        {
            List <Wording> wordings = new List <Wording>();
            Wording        w;
            string         query = "SELECT * FROM Wordings.FN_GetWordings(@field) ORDER BY WordID";

            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())
                            {
                                w = new Wording
                                {
                                    WordID      = (int)rdr["WordID"],
                                    FieldName   = fieldname,
                                    WordingText = (string)rdr["WordingText"]
                                };

                                wordings.Add(w);
                            }
                        }
                    }
                    catch
                    {
                    }
                }

            return(wordings);
        }
 public static int UpdateWording(Wording wording)
 {
     return(1);
 }
 public static int InsertWording(Wording wording)
 {
     return(1);
 }