/// <summary>
        /// 添加管理操作
        /// </summary>
        /// <param name="applicationManagementOperation">ApplicationManagementOperation</param>
        public void Create(ApplicationManagementOperation applicationManagementOperation)
        {
            if (applicationManagementOperation == null)
                throw new ArgumentNullException("applicationManagementOperation不能为null");

            if (repository.Exists(applicationManagementOperation.OperationId))
                throw new ArgumentException("OperationId不允许重复");
            EventBus<ApplicationManagementOperation>.Instance().OnBefore(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Create(), applicationManagementOperation.ApplicationId));
            repository.Insert(applicationManagementOperation);
            EventBus<ApplicationManagementOperation>.Instance().OnAfter(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Create(), applicationManagementOperation.ApplicationId));
        }
예제 #2
0
        /// <summary>
        /// 更新管理操作
        /// </summary>
        /// <param name="applicationManagementOperation">ApplicationManagementOperation</param>
        public void Update(ApplicationManagementOperation applicationManagementOperation)
        {
            if (applicationManagementOperation == null)
            {
                throw new ArgumentNullException("applicationManagementOperation不能为null");
            }
            EventBus <ApplicationManagementOperation> .Instance().OnBefore(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Update(), applicationManagementOperation.ApplicationId));

            repository.Update(applicationManagementOperation);
            EventBus <ApplicationManagementOperation> .Instance().OnAfter(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Update(), applicationManagementOperation.ApplicationId));
        }
예제 #3
0
        /// <summary>
        /// 添加管理操作
        /// </summary>
        /// <param name="applicationManagementOperation">ApplicationManagementOperation</param>
        public void Create(ApplicationManagementOperation applicationManagementOperation)
        {
            if (applicationManagementOperation == null)
            {
                throw new ArgumentNullException("applicationManagementOperation不能为null");
            }

            if (repository.Exists(applicationManagementOperation.OperationId))
            {
                throw new ArgumentException("OperationId不允许重复");
            }
            EventBus <ApplicationManagementOperation> .Instance().OnBefore(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Create(), applicationManagementOperation.ApplicationId));

            repository.Insert(applicationManagementOperation);
            EventBus <ApplicationManagementOperation> .Instance().OnAfter(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Create(), applicationManagementOperation.ApplicationId));
        }
예제 #4
0
        /// <summary>
        /// 删除管理操作
        /// </summary>
        /// <param name="operationId">管理操作实体Id</param>
        public void Delete(int operationId)
        {
            ApplicationManagementOperation applicationManagementOperation = repository.Get(operationId);

            if (applicationManagementOperation == null)
            {
                throw new ArgumentNullException(string.Format("OperationId为{0}的ApplicationManagementOperation不存在", operationId));
            }

            if (applicationManagementOperation.IsLocked)
            {
                throw new ApplicationException("锁定状态的ApplicationManagementOperation不允许删除");
            }

            EventBus <ApplicationManagementOperation> .Instance().OnBefore(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Delete(), applicationManagementOperation.ApplicationId));

            repository.DeleteByEntityId(operationId);
            EventBus <ApplicationManagementOperation> .Instance().OnAfter(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Delete(), applicationManagementOperation.ApplicationId));
        }
 /// <summary>
 /// 更新管理操作
 /// </summary>
 /// <param name="applicationManagementOperation">ApplicationManagementOperation</param>
 public void Update(ApplicationManagementOperation applicationManagementOperation)
 {
     if (applicationManagementOperation == null)
         throw new ArgumentNullException("applicationManagementOperation不能为null");
     EventBus<ApplicationManagementOperation>.Instance().OnBefore(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Update(), applicationManagementOperation.ApplicationId));
     repository.Update(applicationManagementOperation);
     EventBus<ApplicationManagementOperation>.Instance().OnAfter(applicationManagementOperation, new CommonEventArgs(EventOperationType.Instance().Update(), applicationManagementOperation.ApplicationId));
 }
예제 #6
0
        /// <summary>
        /// 转换为ApplicationManagementOperation用于数据库存储
        /// </summary>
        /// <returns></returns>
        public ApplicationManagementOperation AsApplicationManagementOperation()
        {
            ApplicationManagementOperation operation = null;
            ManagementOperationService managementOperationService = new ManagementOperationService();
            if (managementOperationService.Get(this.OperationId) == null)
            {
                operation = new ApplicationManagementOperation();
                operation.OperationId = this.OperationId;

                operation.DisplayOrder = this.OperationId;
            }
            else
            {
                operation = managementOperationService.Get(this.OperationId);
            }
            if (this.AssociatedNavigationId.HasValue)
            operation.AssociatedNavigationId = this.AssociatedNavigationId.Value;
            operation.ApplicationId = this.ApplicationId;
            operation.PresentAreaKey = this.PresentAreaKey;

            operation.OperationType = this.OperationType;

            //使用资源项
            if (this.IsUseResourceItem)
            {
                operation.ResourceName = this.ResourceName;
                operation.OperationText = string.Empty;
            }
            else
            {
                operation.OperationText = this.OperationText;
                operation.ResourceName = string.Empty;
            }

            //使用路由
            if (this.IsUseRoute)
            {
                operation.UrlRouteName = this.UrlRouteName ?? string.Empty;
                operation.NavigationUrl = string.Empty;
            }
            else
            {
                operation.NavigationUrl = this.NavigationUrl ?? string.Empty;
                operation.UrlRouteName = string.Empty;
            }

            if (IconNameOption)
            {
                operation.IconName = this.IconName;
                operation.ImageUrl = null;
            }
            else
            {
                operation.IconName = null;
                if (this.IsWholeLink)
                {
                    operation.ImageUrl = this.ImageUrl;
                }
                else
                {
                    if (this.ImageName != null)
                    {
                        operation.ImageUrl = "~/Uploads/NavigationImage/" + this.ImageName;
                    }
                    else
                    {
                        operation.ImageUrl = null;
                    }
                }
            }

            operation.NavigationTarget = this.NavigationTarget;

            operation.OnlyOwnerVisible = this.OnlyOwnerVisible;
            operation.IsEnabled = this.IsEnabled;

            operation.IsLocked = this.IsLocked;
            return operation;
        }