• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# BusinessContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


示例17: PreDeleteInsideTransaction

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

            #region Remove references from IBN 4.7 objects
            SqlHelper.ExecuteNonQuery(SqlContext.Current, System.Data.CommandType.StoredProcedure,
                "bus_cls_ListObject_Delete",
                SqlHelper.SqlParameter("@ClassName", SqlDbType.NVarChar, 250, context.GetTargetMetaClassName()),
                SqlHelper.SqlParameter("@ObjectId", SqlDbType.VarChar, 36, context.GetTargetPrimaryKeyId().Value.ToString()));
            #endregion
        }
开发者ID:0anion0,项目名称:IBN,代码行数:15,代码来源:ListObjectRequestHandler.cs


示例18: AddNewLanguage_ThrowsException_WhenNameIsEmpty

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

                businessContext.AddNewLanguage(language);
            }
        }
开发者ID:Woodje,项目名称:DaCoder,代码行数:12,代码来源:BusinessContextTests.cs


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


示例20: Create

 /// <summary>
 /// Creates the specified context.
 /// </summary>
 /// <param name="context">The context.</param>
 protected override void Create(BusinessContext context)
 {
     CustomizationProfileUserEntity newEntity = (CustomizationProfileUserEntity)context.Request.Target;
     if (newEntity.ProfileId > 0)
     {
         base.Create(context);
     }
     else  // for default profile we don't need to create a new record
     {
         context.SetResponse(new CreateResponse(PrimaryKeyId.Empty));
     }
 }
开发者ID:0anion0,项目名称:IBN,代码行数:16,代码来源:CustomizationProfileUserRequestHandler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BusinessDayConvention类代码示例发布时间:2022-05-24
下一篇:
C# Business.OrderIdParser类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap