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


C# BusinessContext.GetMethod方法代码示例

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


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

示例1: Execute

 public void Execute(BusinessContext context)
 {
     _log.Debug("Execute (IPlugin) for {0}. Metaclass: {1}. PrimaryKey: {2}. Plugin Stage: {3}",
         context.GetMethod(),
         context.GetTargetMetaClassName(),
         context.GetTargetPrimaryKeyId().HasValue ? context.GetTargetPrimaryKeyId().Value.ToString() : "null",
         context.PluginStage);
 }
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:8,代码来源:BusinessFoundationGenericHandler.cs

示例2: Execute

        /// <summary>
        /// Executes the specified contex.
        /// </summary>
        /// <param name="context">The context.</param>
        protected virtual void Execute(BusinessContext context)
        {
            if ((context.GetMethod() == RequestMethod.Update ||
                context.GetMethod() == RequestMethod.Create) &&
                context.GetTargetPrimaryKeyId().HasValue)
            {
                if (context.Request.Target.Properties.GetValue<bool>(AssignmentEntity.FieldAutoComplete, false))
                {
                    decimal planWork = context.Request.Target.Properties.GetValue<decimal>(AssignmentEntity.FieldPlanWork, decimal.MaxValue);
                    decimal actualWork = context.Request.Target.Properties.GetValue<decimal>(AssignmentEntity.FieldActualWork, decimal.MinValue);

                    if (planWork == actualWork)
                    {
                        // Invoke Auto Complete
                        BusinessManager.Execute(new CloseAssignmentRequest(context.GetTargetPrimaryKeyId().Value, (int)AssignmentExecutionResult.Accepted));
                    }
                }
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:23,代码来源:AssignmentAutoCompletePlugin.cs

示例3: CustomMethod

        /// <summary>
        /// Customs the method.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void CustomMethod(BusinessContext context)
        {
            base.CustomMethod(context);

            switch (context.GetMethod())
            {
                case AddressRequestMethod.SetDefaultAddress:
                    SetDefaultAddress(context);
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:AddressRequestHandler.cs

示例4: CustomMethod

        /// <summary>
        /// Customs the method.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void CustomMethod(BusinessContext context)
        {
            base.CustomMethod(context);

            switch (context.GetMethod())
            {
                case OutgoingMessageQueueMethod.ResetDeliveryAttempts:
                    ResetDeliveryAttempts(context);
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:OutgoingMessageQueueRequestHandler.cs

示例5: CustomMethod

 /// <summary>
 /// Customs the method.
 /// </summary>
 /// <param name="context">The context.</param>
 protected override void CustomMethod(BusinessContext context)
 {
     switch (context.GetMethod())
     {
         case DirectoryOrganizationalUnitMethod.Move:
             Move(context);
             break;
         default:
             base.CustomMethod(context);
             break;
     }
 }
开发者ID:0anion0,项目名称:IBN,代码行数:16,代码来源:DirectoryOrganizationalUnitRequestHandler.cs

示例6: Execute

 /// <summary>
 /// Executes the specified context.
 /// </summary>
 /// <param name="context">The context.</param>
 public void Execute(BusinessContext context)
 {
     if (context.PluginStage == EventPipeLineStage.PreMainOperationInsideTranasaction)
     {
         switch (context.GetMethod())
         {
             case RequestMethod.Delete:
                 // TODO: Pre Method
                 OnAssignmentDeleting(context.GetTargetPrimaryKeyId().Value);
                 break;
             case AssignmentRequestMethod.AssignUser:
             case RequestMethod.Update:
             case AssignmentRequestMethod.Activate:
             case AssignmentRequestMethod.Close:
             case AssignmentRequestMethod.Resume:
             case AssignmentRequestMethod.Suspend:
                 // Save Old AssignmentEntity
                 SaveOldAssignmentEntity(context, (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, context.GetTargetPrimaryKeyId().Value));
                 break;
         }
     }
     else if (context.PluginStage == EventPipeLineStage.PostMainOperationInsideTranasaction)
     {
         switch (context.GetMethod())
         {
             case RequestMethod.Create:
                 OnAssignmentCreated(((CreateResponse)context.Response).PrimaryKeyId);
                 break;
             case AssignmentRequestMethod.AssignUser:
             case RequestMethod.Update:
             case AssignmentRequestMethod.Activate:
             case AssignmentRequestMethod.Close:
             case AssignmentRequestMethod.Resume:
             case AssignmentRequestMethod.Suspend:
                 // TODO: Pre Method
                 OnAssignmentUpdated(LoadOldAssignmentEntity(context), (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, context.GetTargetPrimaryKeyId().Value));
                 break;
         }
     }
 }
开发者ID:0anion0,项目名称:IBN,代码行数:44,代码来源:RaiseAssignmentEventPlugin.cs

示例7: Execute

        /// <summary>
        /// Deletes sticked items if the method is "delete" or assignment state is not active
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(BusinessContext context)
        {
            if (context.GetMethod() == RequestMethod.Load ||
                context.GetMethod() == RequestMethod.List)
                return;

            PrimaryKeyId? pkId = context.GetTargetPrimaryKeyId();
            if (pkId.HasValue)
            {
                AssignmentEntity entity = (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, pkId.Value);

                if (entity.OwnerDocumentId.HasValue)
                {
                    if (context.GetMethod() == RequestMethod.Delete ||
                        entity.State != (int)AssignmentState.Active)
                    {
                        if (entity.UserId.HasValue)
                        {
                            Calendar.DeleteStickedObject(entity.UserId.Value, entity.OwnerDocumentId.Value, (int)ObjectTypes.Document, (Guid)pkId.Value);
                        }
                    }
                }
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:28,代码来源:StickedObjectCleanUpPlugin.cs

示例8: ReadRightCheck

        /// <summary>
        /// Reads the right check.
        /// </summary>
        /// <param name="context">The context.</param>
        private void ReadRightCheck(BusinessContext context)
        {
            //Если есть флаг отключить проверку авторизации то ничего не фильтруем
            if (!SkipSecurityCheckScope.IsActive)
            {
                string securityViewQuery = @"SELECT ObjectId FROM [dbo].[CalendarEvent_Security_Read]";
                //Добавляем в sql context текущего пользователя
                SetContextInfo(Security.CurrentUserId);
                //Для метода List необходимо отфильтровать список согласно security view
                if (context.GetMethod() == RequestMethod.List)
                {
                    ListRequest listRequest = context.Request as ListRequest;
                    FilterElementCollection filterColl = new FilterElementCollection();
                    foreach (FilterElement origFilterEl in listRequest.Filters)
                    {
                        filterColl.Add(origFilterEl);
                    }

                    FilterElement filterEl = new FilterElement("PrimaryKeyId", FilterElementType.In, securityViewQuery);
                    filterColl.Add(filterEl);
                    //перезаписываем старую коллекцию фильтров, новой
                    listRequest.Filters = filterColl.ToArray();

                }//Для метода Load необходмио предотвратить загрузку объета не имеющего соотв прав
                else if (context.GetMethod() == RequestMethod.Load)
                {

                    LoadRequest loadRequest = context.Request as LoadRequest;
                    PrimaryKeyId eventId = loadRequest.Target.PrimaryKeyId.Value;
                    VirtualEventId vEventId = (VirtualEventId)eventId;
                    if (vEventId.IsRecurrence)
                    {
                        eventId = vEventId.RealEventId;
                    }

                    if (BusinessObject.GetTotalCount(DataContext.Current.GetMetaClass(CalendarEventEntity.ClassName),
                                                      new FilterElement[] {
                                                                            new FilterElement("PrimaryKeyId", FilterElementType.Equal, eventId),
                                                                            new FilterElement("PrimaryKeyId", FilterElementType.In, securityViewQuery)
                                                                           }) == 0)
                    {
                        throw new Exception("Read access denied");
                    }
                }

            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:51,代码来源:SecurityPlugin.cs

示例9: Execute

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(BusinessContext context)
        {
            switch (context.GetMethod())
            {
                case RequestMethod.Load:
                    if (context.GetTargetPrimaryKeyId().HasValue)
                    {
                        EntityObject item = LoadEntityObject(context.GetTargetMetaClassName(), context.GetTargetPrimaryKeyId().Value);

                        if (item != null)
                        {
                            LoadResponse response = new LoadResponse(item);

                            context.SetResponse(response);
                        }
                    }
                    break;
                case RequestMethod.List:
                    {
                        // Filters Not Implemented
                        ListResponse response = context.Response as ListResponse;

                        if (response != null)
                        {
                            EntityObject[] items = LoadEntityObjects(context.GetTargetMetaClassName(), ((ListRequest)context.Request).Filters);

                            if (items.Length > 0)
                            {
                                List<EntityObject> newArray = new List<EntityObject>(response.EntityObjects.Length + items.Length);

                                newArray.AddRange(response.EntityObjects);
                                newArray.AddRange(items);

                                // TODO: Sorting Not Implemented

                                response.EntityObjects = newArray.ToArray();
                            }
                        }
                    }
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:46,代码来源:LocalDiskEntityObjectPlugin.cs

示例10: foreach

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        void IPlugin.Execute(BusinessContext context)
        {
            if (context.GetMethod() == RequestMethod.Delete &&
                context.GetTargetPrimaryKeyId().HasValue)
            {
                MetaClass currentMetaClass = DataContext.Current.GetMetaClass(context.GetTargetMetaClassName());

                foreach (MetaField mf in currentMetaClass.FindReferencesTo())
                {
                    if (mf.Owner.IsBridge)
                    {
                        foreach(EntityObject entity in BusinessManager.List(mf.Owner.Name,
                            new FilterElement[] { FilterElement.EqualElement(mf.Name, context.GetTargetPrimaryKeyId().Value) }))
                        {
                            BusinessManager.Delete(entity);
                        }
                    }
                }
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:24,代码来源:CleanupBridgeElementPlugin.cs

示例11: Execute

 /// <summary>
 /// Executes the specified context.
 /// </summary>
 /// <param name="context">The context.</param>
 public void Execute(BusinessContext context)
 {
     if (context != null)
     {
         bool forceBase = context.Request.Parameters.GetValue<bool>(EventHelper.FORCE_BASE_PARAM, false);
         if (!forceBase)
         {
             try
             {
                 switch (context.GetMethod())
                 {
                     case RequestMethod.List:
                     case RequestMethod.Load:
                         ReadRightCheck(context);
                         break;
                 }
             }
             catch (Exception)
             {
                 throw;
             }
         }
     }
 }
开发者ID:0anion0,项目名称:IBN,代码行数:28,代码来源:SecurityPlugin.cs

示例12: Execute

        /// <summary>
        /// Регестрирует все изменения над событиями в хранилище метаданных
        /// Данный plugin должен быть подписан на все post события производимые над всеми метаклассами событий
        /// В хранилище метаданных отслеживаться будет только события (в случаи наличия рекрсии только базовое зобытие рекрсии). 
        /// Например: 1. Если мы изменяем ресурсы события то в хранилище метаданных изменится версия связанного с данным ресурсом события.
        ///	2. Если мы создаем exception то обновиться метаданные только базовго события, а новые метаданные для exception созданы не будут.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(BusinessContext context)
        {
            bool needTracking = false;

            //Отмлеживаем только во время отсутствия прцесса синхронизации
            if (!CalendarEventSyncProvider.SyncSessionInProcess(Provider.ReplicaId))
            {
                //Регистрируем только вызовы BusinessObjectRequestHandler, все вызовы  перехватываемые  обработчиком
                //отслеживать не нужно.
                bool origRequestInvoked = context.Request.Parameters.GetValue<bool>(Mediachase.Ibn.Events.CustomMethods.EventHelper.FORCE_BASE_PARAM, false);
                if (origRequestInvoked)
                {
                    //перечисление методов
                    switch (context.GetMethod())
                    {
                        case RequestMethod.Create:
                        case RequestMethod.Delete:
                        case RequestMethod.Update:
                        case CalendarResourcesUpdateMethod.METHOD_NAME:
                        case ChangeTrackingMethod.METHOD_NAME:
                            needTracking = true;
                            break;

                    }
                }
            }

            if (needTracking)
            {
                PrimaryKeyId? eventId = null;
                //Пытаемся получить event pk из запроса или ответа
                if (context.GetTargetMetaClassName() == CalendarEventEntity.ClassName)
                {
                    eventId = context.Request.Target.PrimaryKeyId;
                    if (eventId == null)
                    {
                        eventId = ((CreateResponse)context.Response).PrimaryKeyId;
                    }
                }
                else if (context.GetTargetMetaClassName() == CalendarEventRecurrenceEntity.ClassName)
                {
                    eventId = (PrimaryKeyId?)context.Request.Target[CalendarEventRecurrenceEntity.FieldEventId];
                }
                else if (context.GetTargetMetaClassName() == CalendarEventResourceEntity.ClassName)
                {
                    eventId = (PrimaryKeyId?)context.Request.Target[CalendarEventResourceEntity.FieldEventId];
                }

                VirtualEventId vEventId = (VirtualEventId)eventId.Value;
                eventId = vEventId.RealEventId;
                //для события (виртуального или exception) необходимо произвести обновление только метаданных
                //родительского события
                if (vEventId.IsRecurrence)
                {
                    ChangeVersionMetadataItem(eventId);
                }
                else
                {
                    //только для методов касающихся события выполняются операции создания и удаления метаданных
                    if (context.GetTargetMetaClassName() == CalendarEventEntity.ClassName &&
                        context.Request.Method == RequestMethod.Create)
                    {
                        CreateMetadataItem(eventId.Value);
                    }
                    else if (context.GetTargetMetaClassName() == CalendarEventEntity.ClassName &&
                             context.Request.Method == RequestMethod.Delete)
                    {
                        MarkAsTombstoneMetadataItem(eventId);
                    }
                    else
                    {
                        ChangeVersionMetadataItem(eventId);
                    }
                }

            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:85,代码来源:CalendarEventChangeTracker.cs

示例13: Execute

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public virtual void Execute(BusinessContext context)
        {
            // Load ACL
            FileStorage fs;
            AccessControlList acl;

            switch (context.GetMethod())
            {
                case RequestMethod.Create:
                    WorkflowInstanceEntity newEntity = this.Context.Request.Target as WorkflowInstanceEntity;
                    Guid newWorkflowInstanceId = (Guid)((CreateResponse)context.Response).PrimaryKeyId;

                    if (LoadFileLibraryAcl(newEntity, out fs, out acl))
                    {
                        // Read Users From Activity And Create ACE
                        foreach (int userId in GetUserList(newEntity))
                        {
                            // Modify ACL
                            acl.Add(new AccessControlEntry(userId, "Read", true, newWorkflowInstanceId));

                            // Create WorkflowParticipant
                            CreateWorkflowParticipiant(newWorkflowInstanceId, userId, newEntity);
                        }

                        // Save ACL
                        AccessControlList.SetACL(fs, acl, false);
                    }
                    break;
                case RequestMethod.Update:
                    WorkflowInstanceEntity entity = this.Context.Request.Target as WorkflowInstanceEntity;
                    Guid workflowInstanceId = (Guid)context.GetTargetPrimaryKeyId().Value;

                    if (LoadFileLibraryAcl(entity, out fs, out acl))
                    {
                        // Remove All Workflow ACE
                        for (int index = acl.Count - 1; index>=0; index--)
                        {
                            if (acl[index].OwnerKey == workflowInstanceId)
                                acl.RemoveAt(index);
                        }

                        // Remove WorkflowParticipantRow
                        RemoveAllWorkflowParticipants(workflowInstanceId);

                        // Read Users From Activity And Create ACE
                        foreach (int userId in GetUserList(entity))
                        {
                            acl.Add(new AccessControlEntry(userId, "Read", true, workflowInstanceId));

                            // Create WorkflowParticipant
                            CreateWorkflowParticipiant(workflowInstanceId, userId, entity);
                        }

                        // Save ACL
                        AccessControlList.SetACL(fs, acl, false);
                    }
                    break;
                case RequestMethod.Delete:
                    WorkflowInstanceEntity delEntity = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, context.GetTargetPrimaryKeyId().Value);
                    Guid delWorkflowInstanceId = (Guid)context.GetTargetPrimaryKeyId().Value;

                    if (LoadFileLibraryAcl(delEntity, out fs, out acl))
                    {
                        // Remove All Workflow ACE
                        for (int index = acl.Count - 1; index >= 0; index--)
                        {
                            if (acl[index].OwnerKey == delWorkflowInstanceId)
                                acl.RemoveAt(index);
                        }

                        // Remove WorkflowParticipantRow
                        RemoveAllWorkflowParticipants(delWorkflowInstanceId);

                        // Save ACL
                        AccessControlList.SetACL(fs, acl, false);
                    }
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:83,代码来源:SyncAclWithBusinessProcessPlugin.cs

示例14: CustomMethod

        /// <summary>
        /// Customs the method.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void CustomMethod(BusinessContext context)
        {
            base.CustomMethod(context);

            switch (context.GetMethod())
            {
                case DocumentContentVersionRequestMethod.UpdateState:
                    UpdateState(context);
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:DocumentContentVersionRequestHandler.cs

示例15: PreCustomMethodInsideTransaction

        /// <summary>
        /// Pres the custom method inside transaction.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void PreCustomMethodInsideTransaction(BusinessContext context)
        {
            base.PreCustomMethodInsideTransaction(context);

            switch (context.GetMethod())
            {
                case DocumentContentVersionRequestMethod.UpdateState:
                    PreUpdateStateInsideTransaction(context);
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:DocumentContentVersionRequestHandler.cs


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