예제 #1
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfAURoleResourceDescriptor auRoleResourceDesp = (WfAURoleResourceDescriptor)base.Deserialize(dictionary, type, serializer);
            WrappedAUSchemaRole        role = JSONSerializerExecute.Deserialize <WrappedAUSchemaRole>(dictionary["AUSchemaRole"]);

            auRoleResourceDesp.AUSchemaRole = role;

            return(auRoleResourceDesp);
        }
예제 #2
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            string schemaRoleID = DictionaryHelper.GetValue(dictionary, "SchemaRoleID", string.Empty);

            WrappedAUSchemaRole role = new WrappedAUSchemaRole(schemaRoleID);

            role.Name        = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);
            role.Description = DictionaryHelper.GetValue(dictionary, "Description", string.Empty);

            return(role);
        }
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			string schemaRoleID = DictionaryHelper.GetValue(dictionary, "SchemaRoleID", string.Empty);

			WrappedAUSchemaRole role = new WrappedAUSchemaRole(schemaRoleID);

			role.Name = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);
			role.Description = DictionaryHelper.GetValue(dictionary, "Description", string.Empty);

			return role;
		}
예제 #4
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            WrappedAUSchemaRole role = (WrappedAUSchemaRole)obj;

            IDictionary <string, object> dictionary = new Dictionary <string, object>();

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "SchemaRoleID", role.SchemaRoleID);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Name", role.Name);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Description", role.Description);

            return(dictionary);
        }
예제 #5
0
        public ClientAURole GetCurrentAUObject()
        {
            ClientAURole result = null;

            if (this._AUSchemaRole != null)
            {
                string auCodeName = WrappedAUSchemaRole.GetCurrentAdministrativeUnitCodeName(this.ProcessInstance);

                result = this._AUSchemaRole.GetAURoleObject(auCodeName);
            }

            return(result);
        }
예제 #6
0
        /// <summary>
        /// 根据代码名称,获取角色
        /// </summary>
        /// <param name="roleFullCodeName"></param>
        /// <param name="throwIfFail">表示在查询不到数据时,是否应抛出异常</param>
        /// <returns></returns>
        public static WrappedAUSchemaRole FromCodeName(string roleFullCodeName, bool throwIfFail)
        {
            roleFullCodeName.CheckStringIsNullOrEmpty("roleFullCodeName");
            WrappedAUSchemaRole role = null;

            string[] fullCodeNames = roleFullCodeName.Split(':');

            if (fullCodeNames.Length > 1)
            {
                string auSchemaCode = fullCodeNames[0];
                string auRoleCode   = fullCodeNames[1];

                role = FromCodeName(auSchemaCode, auRoleCode, throwIfFail);
            }
            else if (throwIfFail)
            {
                throw new FormatException("Full code name is not correct.");
            }

            return(role);
        }
예제 #7
0
        public static WrappedAUSchemaRole FromCodeName(string auSchemaCodeName, string auRoleCodeName, bool throwIfFail)
        {
            WrappedAUSchemaRole role = null;

            var schema = AUCenterQueryService.Instance.GetObjectsByCodeNames(new string[] { auSchemaCodeName }, AUSchemaSchemaType, true).FirstOrDefault();

            if (schema == null)
            {
                if (throwIfFail)
                {
                    throw new ObjectNotFoundException("Could not find schema via code \"" + auSchemaCodeName + "\"");
                }
            }
            else
            {
                var schemaRole = AUCenterQueryService.Instance.GetAUSchemaRoles(schema.ID, new string[] { auRoleCodeName }, true).FirstOrDefault();
                if (schemaRole == null)
                {
                    if (throwIfFail)
                    {
                        throw new ObjectNotFoundException("Could not find schema role via code \"" + auRoleCodeName + "\"");
                    }
                }
                else
                {
                    role = new WrappedAUSchemaRole();

                    role._SchemaRoleID           = schemaRole.ID;
                    role._ClientAUSchemaObject   = schema;
                    role._ClientSchemaRoleObject = schemaRole;
                    role.Name        = schemaRole.Name;
                    role.Description = schemaRole.DisplayName;
                }
            }

            return(role);
        }
        public WfAURoleResourceDescriptor(WrappedAUSchemaRole schemaRole)
        {
            schemaRole.NullCheck("schemaRole");

            this._AUSchemaRole = schemaRole;
        }
예제 #9
0
        public WfAURoleResourceDescriptor(WrappedAUSchemaRole schemaRole)
        {
            schemaRole.NullCheck("schemaRole");

            this._AUSchemaRole = schemaRole;
        }
		/// <summary>
		/// 准备管理单元相关的模板
		/// </summary>
		/// <returns></returns>
		private IWfActivityDescriptor PrepareAURelativeActivityDescriptor(string key)
		{
			WfActivityDescriptor templateActDesp = new WfActivityDescriptor(key, WfActivityType.NormalActivity);
			templateActDesp.Name = "审批";
			templateActDesp.CodeName = key;
			templateActDesp.Properties.SetValue("IsDynamic", true);

			WrappedAUSchemaRole role = new WrappedAUSchemaRole(AUHelper.AUSchemaActivityMatrixRoleID) { Name = "实物管理员", Description = "实物管理员" };

			WfAURoleResourceDescriptor roleDesp = new WfAURoleResourceDescriptor(role);

			templateActDesp.Resources.Add(roleDesp);

			return templateActDesp;
		}
예제 #11
0
        public static WrappedAUSchemaRole FromCodeName(string auSchemaCodeName, string auRoleCodeName, bool throwIfFail)
        {
            WrappedAUSchemaRole role = null;

            var schema = AUCenterQueryService.Instance.GetObjectsByCodeNames(new string[] { auSchemaCodeName }, AUSchemaSchemaType, true).FirstOrDefault();
            if (schema == null)
            {
                if (throwIfFail)
                    throw new ObjectNotFoundException("Could not find schema via code \"" + auSchemaCodeName + "\"");
            }
            else
            {
                var schemaRole = AUCenterQueryService.Instance.GetAUSchemaRoles(schema.ID, new string[] { auRoleCodeName }, true).FirstOrDefault();
                if (schemaRole == null)
                {
                    if (throwIfFail)
                        throw new ObjectNotFoundException("Could not find schema role via code \"" + auRoleCodeName + "\"");
                }
                else
                {
                    role = new WrappedAUSchemaRole();

                    role._SchemaRoleID = schemaRole.ID;
                    role._ClientAUSchemaObject = schema;
                    role._ClientSchemaRoleObject = schemaRole;
                    role.Name = schemaRole.Name;
                    role.Description = schemaRole.DisplayName;
                }
            }

            return role;
        }