Beispiel #1
0
 public GetWordsResponse GetWords(GetWordsRequest request)
 {
     try
     {
         return(DB.GetWords(request.SongId));
     }
     catch (Exception ex)
     {
         var x = new GetWordsResponse()
         {
             Words = new List <Tuple <Guid, string> >()
         };
         x.Words.Add(new Tuple <Guid, string>(Guid.Empty, ex.ToString()));
         return(x);
     }
 }
Beispiel #2
0
        internal static GetWordsResponse GetWords(Guid?songId)
        {
            using (SqlConnection conn = GetConnection())
            {
                GetWordsResponse ret = new GetWordsResponse()
                {
                    Words = new List <Tuple <Guid, string> >(),
                };
                if (!songId.HasValue)
                {
                    using (SqlCommand comm = new SqlCommand("SELECT word_id, word FROM word", conn))
                        using (SqlDataReader dr = comm.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                ret.Words.Add(new Tuple <Guid, string>(Guid.Parse(dr["word_id"].ToString()), dr["word"].ToString()));
                            }
                        }
                }
                else
                {
                    using (SqlCommand comm = new SqlCommand("SELECT DISTINCT w.word_id, word " +
                                                            "FROM word w " +
                                                            "JOIN location l ON w.word_id = l.word_id " +
                                                            "WHERE song_id = @song_id", conn))
                    {
                        comm.Parameters.AddWithValue("@song_id", songId.Value);

                        using (SqlDataReader dr = comm.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                ret.Words.Add(new Tuple <Guid, string>(Guid.Parse(dr["word_id"].ToString()), dr["word"].ToString()));
                            }
                        }
                    }
                }

                return(ret);
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     relations = ServiceAccessor.MakeRequest <RelationAllRequest, RelationAllResponse>(new RelationAllRequest(), "RelationAll");
     relTypes  = ServiceAccessor.MakeRequest <RelationTypesRequest, RelationTypesResponse>(new RelationTypesRequest(), "RelationTypes");
     words     = ServiceAccessor.MakeRequest <GetWordsRequest, GetWordsResponse>(new GetWordsRequest(), "GetWords");
 }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     groups = ServiceAccessor.MakeRequest <GroupAllRequest, GroupAllResponse>(new GroupAllRequest(), "GroupAll");
     words  = ServiceAccessor.MakeRequest <GetWordsRequest, GetWordsResponse>(new GetWordsRequest(), "GetWords");
 }