示例#1
0
        private static WfActivityDescriptor PrepareServerActivity(string key)
        {
            WfActivityDescriptor actDesp = new WfActivityDescriptor(key, WfActivityType.InitialActivity);

            actDesp.Key  = key;
            actDesp.Name = key;

            actDesp.Condition.Expression = "Amount > 1000";
            actDesp.Variables.SetValue("ActKey", key);
            actDesp.Variables.SetValue("ActName", key);

            actDesp.Resources.Add(new WfUserResourceDescriptor((IUser)OguUser.CreateWrapperObject(ActivityConverterTest.UserID, SchemaType.Users)));
            actDesp.Resources.Add(new WfDepartmentResourceDescriptor((IOrganization)OguOrganization.CreateWrapperObject(ActivityConverterTest.OrganizationID, SchemaType.Organizations)));
            actDesp.Resources.Add(new WfGroupResourceDescriptor((IGroup)OguGroup.CreateWrapperObject(ActivityConverterTest.GroupID, SchemaType.Groups)));
            actDesp.Resources.Add(new WfRoleResourceDescriptor(new SOARole(ActivityConverterTest.RoleFullCodeName)));
            actDesp.Resources.Add(new WfActivityOperatorResourceDescriptor()
            {
                ActivityKey = ActivityConverterTest.ResActivityKey
            });
            actDesp.Resources.Add(new WfActivityAssigneesResourceDescriptor()
            {
                ActivityKey = ActivityConverterTest.ResActivityKey
            });
            actDesp.Resources.Add(new WfDynamicResourceDescriptor("ConditionResource", "Amount > 1000"));
            actDesp.BranchProcessTemplates.Add(BranchProcessTemplateConverterTest.PrepareServerBranchProcessTemplate());

            return(actDesp);
        }
示例#2
0
        /// <summary>
        ///反序列化OguOrganization
        /// </summary>
        /// <param name="dictionary">对象类型</param>
        /// <param name="type">对象类型</param>
        /// <param name="serializer">JS序列化器</param>
        /// <returns>反序列化出的对象</returns>
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            OguOrganization oguOrganization = null;
            object          id;

            if (dictionary.TryGetValue("id", out id))
            {
                oguOrganization              = new OguOrganization((string)dictionary["id"]);
                oguOrganization.Name         = (string)dictionary["name"];
                oguOrganization.GlobalSortID = (string)dictionary["globalSortID"];
            }

            return(oguOrganization);
        }
示例#3
0
        /// <summary>
        /// 序列化OguOrganization
        /// </summary>
        /// <param name="obj">material对象</param>
        /// <param name="serializer">序列化器</param>
        /// <returns>属性集合</returns>
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            OguOrganization oguOrganization = (OguOrganization)obj;

            if (string.IsNullOrEmpty(oguOrganization.ID) == false)
            {
                dictionary.Add("id", oguOrganization.ID);
                dictionary.Add("name", oguOrganization.Name);
                dictionary.Add("globalSortID", oguOrganization.GlobalSortID);
            }

            return(dictionary);
        }
		/// <summary>
		///反序列化OguOrganization
		/// </summary>
		/// <param name="dictionary">对象类型</param>
		/// <param name="type">对象类型</param>
		/// <param name="serializer">JS序列化器</param>
		/// <returns>反序列化出的对象</returns>
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			OguOrganization oguOrganization = null;
			object id;

			if (dictionary.TryGetValue("id", out id))
			{
				oguOrganization = new OguOrganization((string)dictionary["id"]);
				oguOrganization.Name = (string)dictionary["name"];
				oguOrganization.GlobalSortID = (string)dictionary["globalSortID"];
			}

			return oguOrganization;
		}
示例#5
0
 public WfDepartmentResourceDescriptor(IOrganization org)
 {
     this._Department = (IOrganization)OguOrganization.CreateWrapperObject(org);
 }
示例#6
0
		public static IOguObject CreateWrapperObject(string id, SchemaType type)
		{
			IOguObject result = null;

			switch (type)
			{
				case SchemaType.Organizations:
					result = new OguOrganization(id);
					break;
				case SchemaType.Users:
					result = new OguUser(id);
					break;
				case SchemaType.Groups:
					result = new OguGroup(id);
					break;

				default:
					ExceptionHelper.TrueThrow(true, string.Format("SchemaType错误{0}", type));
					break;
			}

			return result;
		}
示例#7
0
		public static IOguObject CreateWrapperObject(IOguObject obj)
		{
			IOguObject result = null;

			if (obj is OguBase || obj == null)
				result = obj;
			else
			{
				if (obj is IUser)
					result = new OguUser((IUser)obj);
				else
					if (obj is IOrganization)
						result = new OguOrganization((IOrganization)obj);
					else
						if (obj is IGroup)
							result = new OguGroup((IGroup)obj);
						else
							ExceptionHelper.TrueThrow(true, "不能生成类型为{0}的对象人员包装类", obj.GetType().Name);
			}

			return result;
		}