Beispiel #1
0
 protected override void DoValidate(object objectToValidate, object currentObject, string key, ValidationResults validateResults)
 {
     if (objectToValidate == null || OguBase.IsNullOrEmpty((IOguObject)objectToValidate))
     {
         RecordValidationResult(validateResults, this.MessageTemplate, currentObject, key);
     }
 }
Beispiel #2
0
        protected override InsertSqlClauseBuilder PrepareInsertSqlBuilder(VersionedSchemaObjectBase obj, ORMappingItemCollection mapping)
        {
            VersionedSchemaObjectBase schemaObj = (VersionedSchemaObjectBase)obj;

            if (OguBase.IsNullOrEmpty(schemaObj.Creator))
            {
                if (DeluxePrincipal.IsAuthenticated)
                {
                    schemaObj.Creator = DeluxeIdentity.CurrentUser;
                }
            }

            InsertSqlClauseBuilder builder = base.PrepareInsertSqlBuilder(obj, mapping);

            builder.AppendItem("Data", obj.ToString());

            return(builder);
        }
		private bool CanWithdraw()
		{
			bool result = false;

			if (CurrentProcess != null)
			{
				IWfActivity currentActivity = CurrentProcess.CurrentActivity;

				if (currentActivity != null)
				{
					//流程状态允许撤回
					result = CurrentProcess.CanWithdraw;

					if (result)
					{
						IWfActivity targetActivity = FindTargetActivity(currentActivity);

						//管理员可以撤回
						if (WfClientContext.Current.InAdminMode)
						{
							result = true;
						}
						else
						{
							//活动的属性设置可以撤回
							result = currentActivity.Descriptor.Properties.GetValue("AllowToBeWithdrawn", true) &&
								targetActivity.Descriptor.Properties.GetValue("AllowWithdraw", true);

							if (result)
							{
								//不是管理员,进行更严格的权限判断(前一个点的操作人是我)
								result = OguBase.IsNullOrEmpty(targetActivity.Operator) == false &&
												string.Compare(targetActivity.Operator.ID, WfClientContext.Current.User.ID, true) == 0;
							}
						}
					}
				}
			}

			return result;
		}