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


C# GroupTypeService.Max方法代码示例

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


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

示例1: MapActivityMinistry

        /// <summary>
        /// Maps the activity ministry.
        /// </summary>
        /// <param name="tableData">The table data.</param>
        /// <returns></returns>
        private void MapActivityMinistry( IQueryable<Row> tableData )
        {
            var lookupContext = new RockContext();
            var rockContext = new RockContext();

            // Add an Attribute for the unique F1 Ministry Id
            //int groupEntityTypeId = EntityTypeCache.Read("Rock.Model.Group").Id;
            //var ministryAttributeId = new AttributeService(lookupContext).Queryable().Where(a => a.EntityTypeId == groupEntityTypeId
            //    && a.Key == "F1MinistryId").Select(a => a.Id).FirstOrDefault();
            //var activityAttributeId = new AttributeService(lookupContext).Queryable().Where(a => a.EntityTypeId == groupEntityTypeId
            //    && a.Key == "F1ActivityId").Select(a => a.Id).FirstOrDefault();

            //if (ministryAttributeId == 0)
            //{
            //    var newMinistryAttribute = new Rock.Model.Attribute();
            //    newMinistryAttribute.Key = "F1MinistryId";
            //    newMinistryAttribute.Name = "F1 Ministry Id";
            //    newMinistryAttribute.FieldTypeId = IntegerFieldTypeId;
            //    newMinistryAttribute.EntityTypeId = groupEntityTypeId;
            //    newMinistryAttribute.EntityTypeQualifierValue = string.Empty;
            //    newMinistryAttribute.EntityTypeQualifierColumn = string.Empty;
            //    newMinistryAttribute.Description = "The FellowshipOne identifier for the ministry that was imported";
            //    newMinistryAttribute.DefaultValue = string.Empty;
            //    newMinistryAttribute.IsMultiValue = false;
            //    newMinistryAttribute.IsRequired = false;
            //    newMinistryAttribute.Order = 0;

            //    lookupContext.Attributes.Add(newMinistryAttribute);
            //    lookupContext.SaveChanges(DisableAudit);
            //    ministryAttributeId = newMinistryAttribute.Id;
            //}
            //if (activityAttributeId == 0)
            //{
            //    var newActivityAttribute = new Rock.Model.Attribute();
            //    newActivityAttribute.Key = "F1ActivityId";
            //    newActivityAttribute.Name = "F1 Activity Id";
            //    newActivityAttribute.FieldTypeId = IntegerFieldTypeId;
            //    newActivityAttribute.EntityTypeId = groupEntityTypeId;
            //    newActivityAttribute.EntityTypeQualifierValue = string.Empty;
            //    newActivityAttribute.EntityTypeQualifierColumn = string.Empty;
            //    newActivityAttribute.Description = "The FellowshipOne identifier for the activity that was imported";
            //    newActivityAttribute.DefaultValue = string.Empty;
            //    newActivityAttribute.IsMultiValue = false;
            //    newActivityAttribute.IsRequired = false;
            //    newActivityAttribute.Order = 0;

            //    lookupContext.Attributes.Add(newActivityAttribute);
            //    lookupContext.SaveChanges(DisableAudit);
            //    activityAttributeId = newActivityAttribute.Id;
            //}

            //// Get previously imported Ministries
            //List<AttributeValue> importedMinistriesAVList = new AttributeValueService(lookupContext).GetByAttributeId(ministryAttributeId).ToList();

            //// Get previously imported Activities
            //List<AttributeValue> importedActivitiesAVList = new AttributeValueService( lookupContext ).GetByAttributeId( activityAttributeId ).ToList();

            //int importedMinistriesCount = 0;
            //int importedActivitiesCount = 0;

            //if ( importedMinistriesAVList.Any() ) { importedMinistriesCount = importedMinistriesAVList.Count(); }
            //if ( importedActivitiesAVList.Any() ) { importedActivitiesCount = importedActivitiesAVList.Count(); }
            var orderMax = new GroupTypeService(lookupContext).Queryable().Where(gt => gt.Order != 0).ToList();
            int order = orderMax.Max(o => o.Order) + 1;

            int completed = 0;
            int totalRows = tableData.Count();
            int percentage = ( totalRows - 1 ) / 100 + 1;

            ReportProgress( 0, string.Format( "Verifying ministry import ({0:N0} found).", totalRows ) );
            //ReportProgress(0, string.Format("Previously Imported Ministries ({0:N0} found).", importedMinistriesCount));
            //ReportProgress(0, string.Format("Previously Imported Activities ({0:N0} found).", importedActivitiesCount));

            var newAreas = new List<GroupType>();
            var newCategories = new List<GroupType>();

            foreach ( var row in tableData )
            {
                int? ministryId = row["Ministry_ID"] as int?;
                string ministryName = row["Ministry_Name"] as string;
                string ministryIdString = Convert.ToString( ministryId );

                //GroupType importedMinistriesGTList = new GroupTypeService( lookupContext ).Queryable().Where( g => g.Name == ministryName && g.ForeignId == ( Convert.ToString( ministryId ) + 'm' ) ).FirstOrDefault();
                int? importedMinistry = new GroupTypeService( lookupContext ).Queryable().Where( a => a.ForeignId == ministryIdString ).Select( a => a.Id ).FirstOrDefault();
                //AttributeValue importedMinistry = new AttributeValueService(lookupContext).Queryable().Where(a => a.Value == Convert.ToString(ministryId) && a.ForeignId == ministryName).FirstOrDefault();
                //AttributeValue importedMinistry = importedMinistriesAVList.Where(av => av.Value == Convert.ToString(ministryId)).FirstOrDefault();
                // if (ministryId != null && !importedMinistries.ContainsKey(ministryId)) //Checks AttributeValue table to see if it has already been imported.
                //if ( ministryId != null && importedMinistriesAVList.Find( x => x.Value == Convert.ToString( ministryId ) ) == null ) //Checks AttributeValue table to see if it has already been imported.
                if ( ministryId != null && importedMinistry == 0 ) //Checks AttributeValue table to see if it has already been imported.
                {

                    bool? ministryIsActive = row["Ministry_Active"] as bool?;

                    if ( ministryName != null )
                    {
//.........这里部分代码省略.........
开发者ID:BEGamache,项目名称:Excavator,代码行数:101,代码来源:ActivityMinistry.cs


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