예제 #1
0
        private ActivityEditMode GetActivityDespEditMode(IWfActivityDescriptor actDesp, WfMainStreamActivityDescriptorCollection msActivities, Dictionary <string, Dictionary <string, string> > changeParams)
        {
            ActivityEditMode result = ActivityEditMode.None;

            if (actDesp != null)
            {
                if (actDesp.Properties.GetValue("AllowToBeAppended", true) &&
                    WfClientContext.Current.CurrentActivity.Descriptor.Properties.GetValue("AllowAppendActivityAfterUnstartActivities", true) &&
                    TargetActivityCanBeChangedByCurrentActivity(actDesp, "CanAppendActivityKeys", changeParams) &&
                    IsExceedMaximizeMainStreamActivityCount(msActivities.Count) == false ||
                    WfClientContext.Current.InAdminMode)
                {
                    result |= ActivityEditMode.Add;
                }

                if (ActivityGroupIsRunningOrPassed(actDesp) == false)
                {
                    if (actDesp.Properties.GetValue("AllowToBeModified", true) &&
                        WfClientContext.Current.CurrentActivity.Descriptor.Properties.GetValue("AllowModifyUnstartActivities", true) &&
                        TargetActivityCanBeChangedByCurrentActivity(actDesp, "CanModifyActivityKeys", changeParams) || WfClientContext.Current.InAdminMode)
                    {
                        result |= ActivityEditMode.Edit;
                    }

                    if (actDesp.Properties.GetValue("AllowToBeDeleted", true) &&
                        WfClientContext.Current.CurrentActivity.Descriptor.Properties.GetValue("AllowDeleteUnstartActivities", true) &&
                        TargetActivityCanBeChangedByCurrentActivity(actDesp, "CanDeleteActivityKeys", changeParams) || WfClientContext.Current.InAdminMode)
                    {
                        result |= ActivityEditMode.Delete;
                    }
                }

                RenderOneActivityEventArgs eventArgs = new RenderOneActivityEventArgs();
                eventArgs.CurrentActivity    = CurrentActivity;
                eventArgs.ActivityDescriptor = actDesp;
                eventArgs.EditMode           = result;

                OnRenderOneActivity(CurrentActivity, actDesp, eventArgs);

                result = eventArgs.EditMode;
            }

            return(result);
        }
예제 #2
0
		private void OnRenderOneActivity(IWfActivity currentActivity, IWfActivityDescriptor activityDesctiptor, RenderOneActivityEventArgs eventArgs)
		{
			if (RenderOneActivityEvent != null)
				RenderOneActivityEvent(this, eventArgs);
		}
		private ActivityEditMode GetActivityDespEditMode(IWfActivityDescriptor actDesp, WfMainStreamActivityDescriptorCollection msActivities, Dictionary<string, Dictionary<string, string>> changeParams)
		{
			ActivityEditMode result = ActivityEditMode.None;

			if (actDesp != null)
			{
				if (actDesp.Properties.GetValue("AllowToBeAppended", true) &&
					WfClientContext.Current.CurrentActivity.Descriptor.Properties.GetValue("AllowAppendActivityAfterUnstartActivities", true) &&
					TargetActivityCanBeChangedByCurrentActivity(actDesp, "CanAppendActivityKeys", changeParams) &&
					IsExceedMaximizeMainStreamActivityCount(msActivities.Count) == false
					|| WfClientContext.Current.InAdminMode)
					result |= ActivityEditMode.Add;

				if (ActivityGroupIsRunningOrPassed(actDesp) == false)
				{
					if (actDesp.Properties.GetValue("AllowToBeModified", true) &&
							WfClientContext.Current.CurrentActivity.Descriptor.Properties.GetValue("AllowModifyUnstartActivities", true) &&
							TargetActivityCanBeChangedByCurrentActivity(actDesp, "CanModifyActivityKeys", changeParams) || WfClientContext.Current.InAdminMode)
						result |= ActivityEditMode.Edit;

					if (actDesp.Properties.GetValue("AllowToBeDeleted", true) &&
							WfClientContext.Current.CurrentActivity.Descriptor.Properties.GetValue("AllowDeleteUnstartActivities", true) &&
							TargetActivityCanBeChangedByCurrentActivity(actDesp, "CanDeleteActivityKeys", changeParams) || WfClientContext.Current.InAdminMode)
						result |= ActivityEditMode.Delete;
				}

				RenderOneActivityEventArgs eventArgs = new RenderOneActivityEventArgs();
				eventArgs.CurrentActivity = CurrentActivity;
				eventArgs.ActivityDescriptor = actDesp;
				eventArgs.EditMode = result;

				OnRenderOneActivity(CurrentActivity, actDesp, eventArgs);

				result = eventArgs.EditMode;
			}

			return result;
		}