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


C# BusinessContext类代码示例

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


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

示例1: PostCreateInsideTransaction

        protected override void PostCreateInsideTransaction(BusinessContext context)
        {
            // Call Base method
            base.PostCreateInsideTransaction(context);

            #region Create a new Document Card
            PrimaryKeyId pkDocumentType = ((CreateResponse)context.Response).PrimaryKeyId;

            // Create a new Document Card
            using (MetaClassManagerEditScope scope = DataContext.Current.MetaModel.BeginEdit())
            {
                // TODO: Check Card Name
                string cardName = context.Request.Target["Name"].ToString();
                string cardFriendlyName = context.Request.Target["FriendlyName"].ToString();
                string cardPluralName = cardFriendlyName;
                string tableName = "cls_Document_" + context.Request.Target["Name"].ToString();

                MetaClass newCard = DataContext.Current.MetaModel.CreateCardMetaClass(DataContext.Current.GetMetaClass(DocumentEntity.GetAssignedMetaClassName()),
                    cardName, cardFriendlyName,
                    cardPluralName, tableName);

                scope.SaveChanges();
            }
            #endregion
        }
开发者ID:0anion0,项目名称:IBN,代码行数:25,代码来源:DocumentTypeRequestHandler.cs

示例2: InitializeMappingDocument

        /// <summary>
        /// Initializes the mapping document.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void InitializeMappingDocument(BusinessContext context)
        {
            InitializeMappingDocumentRequest request = ((InitializeMappingDocumentRequest)context.Request);

            MetaClass metaClass = DataContext.Current.GetMetaClass(context.GetTargetMetaClassName());
            List<PrimaryKeyId> primaryKeyIds = new List<PrimaryKeyId>();

            // Create Default Mapping
            MappingDocument retVal = new MappingDocument();

            DataTable dataTable = request.Data.Tables[request.TableIndex];

            MappingElement mapping = new MappingElement(dataTable.TableName, metaClass.Name);
            retVal.Add(mapping);

            MappingElementBuilder builder = new MappingElementBuilder(retVal);

            //Call creation mapping document by saved patterns
            DefaultMappingHelper.CreateMapingByPatternComparision(dataTable, metaClass, builder);

            // Write Response
            InitializeMappingDocumentResponse response = new InitializeMappingDocumentResponse();
            response.MappingDocument = retVal;

            context.SetResponse(response);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:30,代码来源:OrganizationRequestHandler.cs

示例3: List

        protected override void List(BusinessContext context)
        {
            base.List(context);

            ListRequest request = (ListRequest)context.Request;
            ListResponse response = (ListResponse)context.Response;

            // Check if sorting contains OutlineNumber
            bool bSortByName = request.Sorting.Length == 1 &&
                request.Sorting[0].Source == DirectoryOrganizationalUnitEntity.FieldOutlineNumber;

            List<EntityObject> items = new List<EntityObject>(response.EntityObjects);

            // Load Name From GlobalResource
            foreach (DirectoryOrganizationalUnitEntity entity in items)
            {
                entity.Name = GlobalResource.GetString(entity.Name);
            }

            if (bSortByName)
            {
                SortEntityObjectTreeByName(items);
            }

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

示例4: CloseAssignment

        /// <summary>
        /// Closes the assignment.
        /// </summary>
        /// <param name="context">The context.</param>
        protected virtual void CloseAssignment(BusinessContext context)
        {
            CloseAssignmentRequest request = (CloseAssignmentRequest)context.Request;

            // Load Assignment
            MetaObject metaObject = MetaObjectActivator.CreateInstance(AssignmentEntity.ClassName, context.GetTargetPrimaryKeyId().Value);

            if (((int)metaObject[AssignmentEntity.FieldState]) != (int)AssignmentState.Active)
                throw new InvalidOperationException();

            DateTime dateTimeNow = DataContext.Current.CurrentUserTimeZone.ToLocalTime(DateTime.UtcNow);

            // Update Meta Object Fields
            metaObject[AssignmentEntity.FieldClosedBy] = (int)DataContext.Current.CurrentUserId;
            metaObject[AssignmentEntity.FieldState] = (int)AssignmentState.Closed;
            metaObject[AssignmentEntity.FieldExecutionResult] = request.ExecutionResult;
            metaObject[AssignmentEntity.FieldComment] = request.Comment;
            metaObject[AssignmentEntity.FieldActualFinishDate] = dateTimeNow;

            // Save Meta Object
            metaObject.Save();

            if (metaObject[AssignmentEntity.FieldWorkflowInstanceId]!=null)
            {
                // Run Workflow
                AssignmentEntity entity = (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, context.GetTargetPrimaryKeyId().Value);
                RunWorkflow(entity);
            }

            context.SetResponse(new Response());
        }
开发者ID:0anion0,项目名称:IBN,代码行数:35,代码来源:AssignmentRequestHandler.cs

示例5: DeleteKeywordIsPersisted

        public void DeleteKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                //businessContext.DeleteKeyword(keyword);

                bool notDeleted = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id);

                //Assert.IsFalse(notDeleted);
            }
        }
开发者ID:Woodje,项目名称:DaCoder,代码行数:26,代码来源:KeywordScenarioTests.cs

示例6: UpdateKeywordIsPersisted

        public void UpdateKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                keyword.Name = "New KeywordName";

                businessContext.UpdateKeyword(keyword);

                bool updated = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id && k.Name == keyword.Name);

                Assert.IsTrue(updated);
            }
        }
开发者ID:Woodje,项目名称:DaCoder,代码行数:28,代码来源:KeywordScenarioTests.cs

示例7: PreDeleteInsideTransaction

        protected override void PreDeleteInsideTransaction(BusinessContext context)
        {
            base.PreDeleteInsideTransaction(context);

            // Remove SecureRole From Principal
            DirectoryManager.DeletePrincipal(context.GetTargetPrimaryKeyId().Value);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:7,代码来源:DirectoryWorkGroupRequestHandler.cs

示例8: Load

 protected override void Load(BusinessContext context)
 {
     // solve problem if item was load in LocalDiskEntityObjectPlugin
     if (context.Response == null)
     {
         base.Load(context);
     }
 }
开发者ID:0anion0,项目名称:IBN,代码行数:8,代码来源:GoogleGadgetRequestHandler.cs

示例9: ResetDeliveryAttempts

        /// <summary>
        /// Resets the delivery attempts.
        /// </summary>
        /// <param name="context">The context.</param>
        protected virtual void ResetDeliveryAttempts(BusinessContext context)
        {
            MetaObject metaObject = MetaObjectActivator.CreateInstance(context.GetTargetMetaClassName(), context.GetTargetPrimaryKeyId().Value);

            metaObject[OutgoingMessageQueueEntity.FieldDeliveryAttempts] = 0;

            metaObject.Save();
        }
开发者ID:0anion0,项目名称:IBN,代码行数:12,代码来源:OutgoingMessageQueueRequestHandler.cs

示例10: 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

示例11: Delete

        /// <summary>
        /// Deletes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void Delete(BusinessContext context)
        {
            // OZ: Comment base logic and call custom business logic ListManager.DeleteList
            //base.Delete(context);

            ListManager.DeleteList((int)context.GetTargetPrimaryKeyId().Value);

            context.SetResponse(new Response());
        }
开发者ID:0anion0,项目名称:IBN,代码行数:13,代码来源:ListRequestHandler.cs

示例12: PostCreateInsideTransaction

        protected override void PostCreateInsideTransaction(BusinessContext context)
        {
            base.PostCreateInsideTransaction(context);

            // Add SecureRole To Principal
            DirectoryManager.CreatePrincipal(DirectoryPrincipalType.WorkGroup,
                ((CreateResponse)context.Response).PrimaryKeyId,
                ((DirectoryWorkGroupEntity)context.Request.Target).Name);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:9,代码来源:DirectoryWorkGroupRequestHandler.cs

示例13: PostCreateInsideTransaction

        protected override void PostCreateInsideTransaction(BusinessContext context)
        {
            base.PostCreateInsideTransaction(context);

            // Add User To Principal
            DirectoryManager.CreatePrincipal(DirectoryPrincipalType.User,
                ((CreateResponse)context.Response).PrimaryKeyId,
                ((DirectoryUserEntity)context.Request.Target).FullName);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:9,代码来源:DirectoryUserRequestHandler.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 OutgoingMessageQueueMethod.ResetDeliveryAttempts:
                    ResetDeliveryAttempts(context);
                    break;
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:OutgoingMessageQueueRequestHandler.cs

示例15: PostUpdateInsideTransaction

        protected override void PostUpdateInsideTransaction(BusinessContext context)
        {
            base.PostUpdateInsideTransaction(context);

            // Update Principal
            if(context.Request.Target.Properties.Contains(DirectoryWorkGroupEntity.FieldName))
            {
                DirectoryManager.UpdatePrincipal(context.GetTargetPrimaryKeyId().Value,
                    (string)context.Request.Target[DirectoryWorkGroupEntity.FieldName]);
            }
        }
开发者ID:0anion0,项目名称:IBN,代码行数:11,代码来源:DirectoryWorkGroupRequestHandler.cs


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