コード例 #1
0
ファイル: WordRepository.cs プロジェクト: castmchen/LoonWord
        private List <WordDomain> ConvertDataSetToWordList(DataSet dataSet)
        {
            var result = new List <WordDomain>();

            foreach (DataTable dataTable in dataSet.Tables)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    var domain = new WordDomain();
                    domain.Id         = new Guid(dataRow[0].ToString());
                    domain.Word       = dataRow[1].ToString();
                    domain.Trascation = dataRow[2].ToString();
                    domain.Phonetic   = dataRow[3].ToString();
                    domain.Voice      = dataRow[4].ToString();
                    domain.Flag       = (int)dataRow[5];
                    domain.CreateTime = (long)dataRow[6];
                    result.Add(domain);
                    //for (int i = 0; i < dataTable.Columns.Count; i++)
                    //{
                    //    var bb = dataRow[i];
                    //}
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: WordRepository.cs プロジェクト: castmchen/LoonWord
 public bool InsertOneWithVoice(WordDomain word)
 {
     try
     {
         var query = "insert into ";
         query += query + this.TableName;
         query += query + " (Id, Word, Trascation, Phonetic, Flag, CreateTime, Voice) ";
         query += query + "values (@Id, @Word,@Trascation,@Phonetic,@Flag,@CreateTime,@Voice)";
         var paramArray = this.ConvertParamsToArrayWithVoice(word);
         var dataSet    = SqliteRepository.ExecuteDataSet(query, paramArray);
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
コード例 #3
0
ファイル: WordRepository.cs プロジェクト: castmchen/LoonWord
        private object[] ConvertParamsToArrayWithVoice(WordDomain word)
        {
            var array = new object[] { word.Id.ToString(), word.Word, word.Trascation, word.Phonetic, word.Flag, word.CreateTime, word.Voice };

            return(array);
        }