Beispiel #1
0
        public List <Chain> GetChains(IConversationsExp exp)
        {
            var query = Query()
                        .Where(exp.GetExpression());

            return(Db.ExecuteList(query)
                   .ConvertAll(ToChain));
        }
Beispiel #2
0
        public int SetFieldValue <T>(IConversationsExp exp, string field, T value)
        {
            var query =
                new SqlUpdate(ChainTable.TABLE_NAME)
                .Set(field, value)
                .Where(exp.GetExpression());

            return(Db.ExecuteNonQuery(query));
        }
Beispiel #3
0
        public int Delete(IConversationsExp exp)
        {
            var query = new SqlDelete(ChainTable.TABLE_NAME)
                        .Where(exp.GetExpression());

            var result = Db.ExecuteNonQuery(query);

            return(result);
        }
Beispiel #4
0
        public Dictionary <int, int> GetChainCount(IConversationsExp exp)
        {
            var query = new SqlQuery(ChainTable.TABLE_NAME)
                        .Select(ChainTable.Columns.Folder)
                        .SelectCount()
                        .Where(exp.GetExpression())
                        .GroupBy(ChainTable.Columns.Folder);

            return(Db.ExecuteList(query)
                   .ConvertAll(r => new
            {
                folder = Convert.ToInt32(r[0]),
                count = Convert.ToInt32(r[1])
            })
                   .ToDictionary(o => o.folder, o => o.count));
        }