当前位置: 首页>>代码示例>>C#>>正文


C# DbManager.ExecuteList方法代码示例

本文整理汇总了C#中DbManager.ExecuteList方法的典型用法代码示例。如果您正苦于以下问题:C# DbManager.ExecuteList方法的具体用法?C# DbManager.ExecuteList怎么用?C# DbManager.ExecuteList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbManager的用法示例。


在下文中一共展示了DbManager.ExecuteList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTenants

        public List<Tenant> GetTenants()
        {
            var result = new List<Tenant>();
            var tenants = CoreContext.TenantManager.GetTenants();

            if (useUserActivity && last != DateTime.MinValue)
            {
                using (var db = new DbManager(dbid))
                {
                    var ids = db
                        .ExecuteList(new SqlQuery("webstudio_useractivity").Select("tenantid").Where(Exp.Ge("ActivityDate", last.AddMinutes(-1))).GroupBy(1))
                        .ConvertAll(r => (int)r[0]);
                    result.AddRange(tenants.FindAll(t => ids.Contains(t.TenantId)));

                    ids = db
                        .ExecuteList(new SqlQuery("files_file").Select("tenant_id").Where(Exp.Ge("modified_on", last.AddMinutes(-1))).GroupBy(1))
                        .ConvertAll(r => (int)r[0]);
                    result.AddRange(tenants.FindAll(t => ids.Contains(t.TenantId)));
                }
            }
            else
            {
                result.AddRange(tenants);
            }
            last = DateTime.UtcNow;

            result.RemoveAll(t => t.Status != TenantStatus.Active);
            return result;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:29,代码来源:TenantsProvider.cs

示例2: GetStatData

        public override List<UsageSpaceStatItem> GetStatData()
        {
            if (!DbRegistry.IsDatabaseRegistered(FileConstant.DatabaseId))
            {
                DbRegistry.RegisterDatabase(FileConstant.DatabaseId, ConfigurationManager.ConnectionStrings[FileConstant.DatabaseId]);
            }

            using (var filedb = new DbManager(FileConstant.DatabaseId))            
            {
                var q = new SqlQuery("files_file f")
                    .Select("b.right_node")
                    .SelectSum("f.content_length")
                    .InnerJoin("files_folder_tree t", Exp.EqColumns("f.folder_id", "t.folder_id"))
                    .InnerJoin("files_bunch_objects b", Exp.EqColumns("t.parent_id", "b.left_node"))
                    .Where("b.tenant_id", TenantProvider.CurrentTenantID)
                    .Where(Exp.Like("b.right_node", "crm/crm_common/", SqlLike.StartWith))
                    .GroupBy(1);

                return filedb.ExecuteList(q)
                    .Select(r => new UsageSpaceStatItem
                        {

                            Name = Resources.CRMCommonResource.ProductName,
                            SpaceUsage = Convert.ToInt64(r[1]),
                            Url = VirtualPathUtility.ToAbsolute(PathProvider.StartURL())
                        })
                    .ToList();
            }        
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:29,代码来源:CRMsSpaceUsageStatManager.cs

示例3: GetIPGeolocation

 public IPGeolocationInfo GetIPGeolocation(string ip)
 {
     try
     {
         var ipformatted = FormatIP(ip);
         using (var db = new DbManager(dbid))
         {
             var q = new SqlQuery("dbip_location")
                 .Select("ip_start", "ip_end", "country", "city", "timezone_offset", "timezone_name")
                 .Where(Exp.Le("ip_start", ipformatted))
                 .OrderBy("ip_start", false)
                 .SetMaxResults(1);
             return db
                 .ExecuteList(q)
                 .Select(r => new IPGeolocationInfo()
                 {
                     IPStart = Convert.ToString(r[0]),
                     IPEnd = Convert.ToString(r[1]),
                     Key = Convert.ToString(r[2]),
                     City = Convert.ToString(r[3]),
                     TimezoneOffset = Convert.ToDouble(r[4]),
                     TimezoneName = Convert.ToString(r[5])
                 })
                 .SingleOrDefault(i => ipformatted.CompareTo(i.IPEnd) <= 0) ??
                 IPGeolocationInfo.Default;
         }
     }
     catch (Exception error)
     {
         log.Error(error);
     }
     return IPGeolocationInfo.Default;
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:33,代码来源:GeolocationHelper.cs

示例4: Search

 public static IEnumerable<int> Search(ModuleInfo module)
 {
     using (var db = new DbManager(TextIndexCfg.ConnectionStringName))
     {
         return db.ExecuteList(module.SqlQuery).ConvertAll(r => GetId(r[0]));
     }
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:7,代码来源:DbProvider.cs

示例5: GetTemplate

 public ReportTemplate GetTemplate(int id)
 {
     using (var db = new DbManager(DatabaseId))
     {
         return db.ExecuteList(Query(ReportTable).Select(columns).Where("id", id)).ConvertAll(ToTemplate).SingleOrDefault();
     }
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:ReportDao.cs

示例6: GetSubtasks

 public List<Subtask> GetSubtasks(int taskid)
 {
     using (var db = new DbManager(DatabaseId))
     {
         return db.ExecuteList(CreateQuery().Where("task_id", taskid)).ConvertAll(ToSubTask);
     }
 }
开发者ID:vlslavik,项目名称:teamlab.v7.5,代码行数:7,代码来源:SubtaskDao.cs

示例7: DBResourceReader

        public DBResourceReader(string fileName, CultureInfo culture)
        {
            language = culture.Name;
            Data = new Hashtable();

            if (language == "")
                language = "Neutral";

            using (var dbManager = new DbManager("tmresource"))
            {
                var sql = new SqlQuery("res_data")
                    .Select("res_data.title", "textValue")
                    .InnerJoin("res_files", Exp.EqColumns("res_files.id", "res_data.fileID"))
                    .LeftOuterJoin("res_cultures", Exp.EqColumns("res_cultures.title", "res_data.cultureTitle"))
                    .Where("ResName", fileName)
                    .Where("res_cultures.Title", language);

                var list = dbManager.ExecuteList(sql);

                foreach (var t in list)
                {
                    Data.Add(t[0], t[1]);
                }
            }
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:25,代码来源:DBResourceReader.cs

示例8: GetStatData

        public override List<UsageSpaceStatItem> GetStatData()
        {
            using (var filedb = new DbManager(FileConstant.DatabaseId))
            using (var projdb = new DbManager(PROJECTS_DBID))
            {
                var q = new SqlQuery("files_file f")
                    .Select("b.right_node")
                    .SelectSum("f.content_length")
                    .InnerJoin("files_folder_tree t", Exp.EqColumns("f.folder_id", "t.folder_id"))
                    .InnerJoin("files_bunch_objects b", Exp.EqColumns("t.parent_id", "b.left_node"))
                    .Where("b.tenant_id", TenantProvider.CurrentTenantID)
                    .Where(Exp.Like("b.right_node", "projects/project/", SqlLike.StartWith))
                    .GroupBy(1);

                var sizes = filedb.ExecuteList(q)
                    .Select(r => new {ProjectId = Convert.ToInt32(((string) r[0]).Substring(17)), Size = Convert.ToInt64(r[1])})
                    .GroupBy(r => r.ProjectId)
                    .ToDictionary(g => g.Key, g => g.Sum(a => a.Size));

                q = new SqlQuery("projects_projects")
                    .Select("id", "title")
                    .Where("tenant_id", TenantProvider.CurrentTenantID)
                    .Where(Exp.In("id", sizes.Keys));

                return projdb.ExecuteList(q)
                    .Select(r => new UsageSpaceStatItem
                        {
                            Name = Convert.ToString(r[1]),
                            SpaceUsage = sizes[Convert.ToInt32(r[0])],
                            Url = String.Concat(PathProvider.BaseAbsolutePath, "projects.aspx?prjID=" + Convert.ToInt32(r[0]))
                        })
                    .OrderByDescending(i => i.SpaceUsage)
                    .ToList();
            }
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:35,代码来源:ProjectsSpaceUsageStatManager.cs

示例9: GetByFilter

        public List<TimeSpend> GetByFilter(TaskFilter filter, bool isAdmin, bool checkAccess)
        {
            var query = CreateQuery();

            if (filter.Max != 0 && !filter.Max.Equals(int.MaxValue))
            {
                query.SetFirstResult((int)filter.Offset);
                query.SetMaxResults((int)filter.Max * 2);
            }

            if (!string.IsNullOrEmpty(filter.SortBy))
            {
                var sortColumns = filter.SortColumns["TimeSpend"];
                sortColumns.Remove(filter.SortBy);

                query.OrderBy("t." + filter.SortBy, filter.SortOrder);

                foreach (var sort in sortColumns.Keys)
                {
                    query.OrderBy("t." + sort, sortColumns[sort]);
                }
            }

            query = CreateQueryFilter(query, filter, isAdmin, checkAccess);

            using (var db = new DbManager(DatabaseId))
            {
                return db.ExecuteList(query).ConvertAll(ToTimeSpend);
            }
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:30,代码来源:TimeSpendDao.cs

示例10: GetStatData

        public override List<UsageSpaceStatItem> GetStatData()
        {
            if (!DbRegistry.IsDatabaseRegistered(MailDatabaseId))
            {
                DbRegistry.RegisterDatabase(MailDatabaseId, ConfigurationManager.ConnectionStrings[MailDatabaseId]);
            }

            using (var mail_db = new DbManager(MailDatabaseId))
            {
                var query = new SqlQuery("mail_attachment a")
                    .InnerJoin("mail_mail m", Exp.EqColumns("a.id_mail", "m.id"))
                    .Select("m.id_user")
                    .Select("sum(a.size) as size")
                    .Where("m.tenant", TenantProvider.CurrentTenantID)
                    .Where("a.need_remove", 0)
                    .GroupBy(1)
                    .OrderBy(2, false);

                return mail_db.ExecuteList(query)
                    .Select(r =>
                        {
                            var user_id = new Guid(Convert.ToString(r[0]));
                            var user = CoreContext.UserManager.GetUsers(user_id);
                            var item = new UsageSpaceStatItem
                                {
                                    Name = DisplayUserSettings.GetFullUserName(user, false),
                                    ImgUrl = UserPhotoManager.GetSmallPhotoURL(user.ID),
                                    Url = CommonLinkUtility.GetUserProfile(user.ID),
                                    SpaceUsage = Convert.ToInt64(r[1])
                                };
                            return item;
                        })
                    .ToList();
            }
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:35,代码来源:MailSpaceUsageStatManager.cs

示例11: GetAll

 public List<Message> GetAll()
 {
     using (var db = new DbManager(DatabaseId))
     {
         return db.ExecuteList(CreateQuery()).ConvertAll(ToMessage);
     }
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:MessageDao.cs

示例12: GetStatData

        public override List<SpaceUsageStatManager.UsageSpaceStatItem> GetStatData()
        {
            var data = new List<SpaceUsageStatManager.UsageSpaceStatItem>();
            
            if (!DbRegistry.IsDatabaseRegistered(FILES_DBID)) DbRegistry.RegisterDatabase(FILES_DBID, ConfigurationManager.ConnectionStrings[FILES_DBID]);
            using (var filedb = new DbManager(FILES_DBID))            
            {
                var q = new SqlQuery("files_file f")
                    .Select("b.right_node")
                    .SelectSum("f.content_length")
                    .InnerJoin("files_folder_tree t", Exp.EqColumns("f.folder_id", "t.folder_id"))
                    .InnerJoin("files_bunch_objects b", Exp.EqColumns("t.parent_id", "b.left_node"))
                    .Where("b.tenant_id", CoreContext.TenantManager.GetCurrentTenant().TenantId)
                    .Where(Exp.Like("b.right_node", "crm/crm_common/", SqlLike.StartWith))
                    .GroupBy(1);

                var size = filedb.ExecuteList(q).Select(r =>  Convert.ToInt64(r[1])).FirstOrDefault();
                
                
                    data.Add(new UsageSpaceStatItem()
                    {
                         
                        Name = Resources.CRMCommonResource.ProductName,
                        SpaceUsage = size,
                        Url = VirtualPathUtility.ToAbsolute(PathProvider.StartURL())
                    });
            }        

            return data;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:30,代码来源:CRMsSpaceUsageStatManager.cs

示例13: GetTags

 public Dictionary<int, string> GetTags()
 {
     using (var db = new DbManager(DatabaseId))
     {
         return db.ExecuteList(GetTagQuery()).ToDictionary(r => Convert.ToInt32(r[0]), n => n[1].ToString().HtmlEncode());
     }
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:TagDao.cs

示例14: MailQueueItemSettings

        static MailQueueItemSettings()
        {
            using (var db = new DbManager(MailBoxManager.ConnectionStringName))
            {
                var imap_flags = db.ExecuteList(new SqlQuery(Dal.DbSchema.ImapFlags.table)
                                                    .Select(Dal.DbSchema.ImapFlags.Columns.folder_id,
                                                            Dal.DbSchema.ImapFlags.Columns.name,
                                                            Dal.DbSchema.ImapFlags.Columns.skip))
                                   .ConvertAll(r => new
                                       {
                                           folder_id = Convert.ToInt32(r[0]),
                                           name = (string) r[1],
                                           skip = Convert.ToBoolean(r[2])
                                       });

                SkipImapFlags = imap_flags.FindAll(i => i.skip).ConvertAll(i => i.name).ToArray();

                ImapFlags = new Dictionary<string, int>();
                imap_flags.FindAll(i => !i.skip).ForEach(i => { ImapFlags[i.name] = i.folder_id; });

                SpecialDomainFolders = new Dictionary<string, Dictionary<string, MailboxInfo>>();
                db.ExecuteList(new SqlQuery(ImapSpecialMailbox.table)
                                   .Select(ImapSpecialMailbox.Columns.server,
                                           ImapSpecialMailbox.Columns.name,
                                           ImapSpecialMailbox.Columns.folder_id,
                                           ImapSpecialMailbox.Columns.skip))
                  .ForEach(r =>
                      {
                          var server = ((string) r[0]).ToLower();
                          var name = ((string)r[1]).ToLower();
                          var mb = new MailboxInfo
                              {
                                  folder_id = Convert.ToInt32(r[2]),
                                  skip = Convert.ToBoolean(r[3])
                              };
                          if (SpecialDomainFolders.Keys.Contains(server))
                              SpecialDomainFolders[server][name] = mb;
                          else
                              SpecialDomainFolders[server] = new Dictionary<string, MailboxInfo> { { name, mb } };
                      });

                PopUnorderedDomains = db.ExecuteList(new SqlQuery(PopUnorderedDomain.table)
                                                         .Select(PopUnorderedDomain.Columns.server))
                                        .ConvertAll(r => (string) r[0])
                                        .ToArray();
            }
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:47,代码来源:MailQueueItemSettings.cs

示例15: GetByID

 public Template GetByID(int id)
 {
     using (var db = new DbManager(DatabaseId))
     {
         var query = Query(TemplatesTable + " p").Select(templateColumns).Where("p.id", id);
         return db.ExecuteList(query).ConvertAll(ToTemplate).SingleOrDefault();
     }
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:8,代码来源:TemplateDao.cs


注:本文中的DbManager.ExecuteList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。