Пример #1
0
        public void WfActivitySerilizeConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            WfActivityDescriptor normalAct = new WfActivityDescriptor("NormalActivity", WfActivityType.NormalActivity);

            normalAct.Name     = "Normal";
            normalAct.CodeName = "Normal Activity";

            WfServiceOperationDefinition enterSvcDef = new WfServiceInvokerFactory().SvcOpDef;

            enterSvcDef.AddressDef.RequestMethod = WfServiceRequestMethod.Get;
            enterSvcDef.OperationName            = "StringTypeService";
            enterSvcDef.RtnXmlStoreParamName     = "EnterServiceRtnXml";

            enterSvcDef.Params.Add(new WfServiceOperationParameter()
            {
                Name  = "input",
                Type  = WfSvcOperationParameterType.String,
                Value = "this is a get action!"
            });

            normalAct.EnterEventExecuteServices.Add(enterSvcDef);

            string result = JSONSerializerExecute.Serialize(normalAct);

            Console.WriteLine(result);

            WfActivityDescriptor deserializedActDesp = JSONSerializerExecute.Deserialize <WfActivityDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedActDesp);

            Assert.AreEqual(result, reSerialized);
        }
Пример #2
0
        public void WfGroupResourceDescriptorConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            OguObjectCollection <IGroup> groupColl = user.MemberOf;

            foreach (var group in groupColl)
            {
                WfGroupResourceDescriptor groupDesp = new WfGroupResourceDescriptor(group);

                string result = JSONSerializerExecute.Serialize(groupDesp);

                Console.WriteLine(result);

                WfGroupResourceDescriptor deserializedGroupDesp = JSONSerializerExecute.Deserialize <WfGroupResourceDescriptor>(result);

                string reSerialized = JSONSerializerExecute.Serialize(deserializedGroupDesp);

                Assert.AreEqual(result, reSerialized);

                ResourceConverterTest(groupDesp);
            }
        }
Пример #3
0
        public void WfBranchProcessTransferParamsJsonTest()
        {
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects[OguObject.requestor.ToString()].Object;

            IWfBranchProcessTemplateDescriptor template = WfProcessTestCommon.CreateTemplate("Consign", user);

            WfBranchProcessTransferParams data = new WfBranchProcessTransferParams(template);

            data.BranchParams.Clear();

            WfBranchProcessStartupParams bpsp = new WfBranchProcessStartupParams(user);

            bpsp.Department           = user.Parent;
            bpsp.RelativeParams["RP"] = UuidHelper.NewUuidString();
            bpsp.ApplicationRuntimeParameters["context"] = UuidHelper.NewUuidString();
            bpsp.ResourceID       = UuidHelper.NewUuidString();
            bpsp.DefaultTaskTitle = UuidHelper.NewUuidString();
            bpsp.StartupContext   = UuidHelper.NewUuidString();

            data.BranchParams.Add(bpsp);

            string serilizedData = JSONSerializerExecute.Serialize(data);

            Console.WriteLine(serilizedData);

            WfBranchProcessTransferParams deserilizedData = JSONSerializerExecute.Deserialize <WfBranchProcessTransferParams>(serilizedData);

            Assert.AreEqual(data.Template.Key, deserilizedData.Template.Key);
            Assert.AreEqual(data.Template.BranchProcessKey, deserilizedData.Template.BranchProcessKey);

            AssertBranchProcessStartupParams(data.BranchParams[0], deserilizedData.BranchParams[0]);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WfConverterHelper.RegisterConverters();

            WfServiceOperationDefinition svcOpDef = new WfServiceOperationDefinition();

            hiddenSvcOperationTemplate.Value = JSONSerializerExecute.Serialize(svcOpDef);

            var dataTypeList = EnumItemDescriptionAttribute.GetDescriptionList(typeof(WfSvcOperationParameterType));

            dataTypeDropDownList.DataSource    = dataTypeList;
            dataTypeDropDownList.DataTextField = "Name";

            dataTypeDropDownList.DataValueField = "EnumValue";
            dataTypeDropDownList.DataBind();

            if (Request["hasRtn"] == "false")
            {
                this.trRtn.Style["display"] = "none";
            }

            if (!string.IsNullOrEmpty(Request["initPara"]))
            {
                var initData = new WfServiceOperationParameterCollection();
                initData.Add(new WfServiceOperationParameter()
                {
                    Name  = Request["initPara"],
                    Type  = WfSvcOperationParameterType.RuntimeParameter,
                    Value = ""
                });
                detailGrid.InitialData = initData;
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WfRelativeLinkDescriptor rlink = new WfRelativeLinkDescriptor("");

            WfConverterHelper.RegisterConverters();
            this.relativeLinkTemplate.Value = JSONSerializerExecute.Serialize(rlink);
        }
Пример #6
0
        public void WfVariabledOfPrecessDescriptorConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            WfProcessDescriptor processDesp = (WfProcessDescriptor)WfProcessTestCommon.CreateSimpleProcessDescriptor();

            //给流程中变量描述赋值
            string guid = Guid.NewGuid().ToString();
            WfVariableDescriptor variDesc = new WfVariableDescriptor(guid);

            variDesc.Name          = "yo";
            variDesc.Description   = "流程中变量的赋值";
            variDesc.Enabled       = true;
            variDesc.OriginalType  = DataType.String;
            variDesc.OriginalValue = "原来的变量值";
            processDesp.Variables.Add(variDesc);

            string result = JSONSerializerExecute.Serialize(processDesp);

            Console.WriteLine(result);

            WfProcessDescriptor reProcessDesp = JSONSerializerExecute.Deserialize <WfProcessDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(reProcessDesp);

            Assert.AreEqual(result, reSerialized);

            Assert.AreEqual(processDesp.Variables[0].Name, reProcessDesp.Variables[0].Name);
            Assert.AreEqual("流程中变量的赋值", reProcessDesp.Variables[0].Description);
            Assert.AreEqual(true, reProcessDesp.Variables[0].Enabled);
            Assert.AreEqual(processDesp.Variables[0].OriginalType, reProcessDesp.Variables[0].OriginalType);
        }
        protected InvokeProcessServiceTaskBase()
            : base()
        {
            WfConverterHelper.RegisterConverters();

            this.Category = "InvokeProcessService";
        }
        public void EditActivityConditionExecutorTest()
        {
            WfConverterHelper.RegisterConverters();

            IWfProcess process = WfProcessTestCommon.StartupSimpleProcessDescriptorWithActivityCondition();

            IWfActivity targetActivity = process.Activities.FindActivityByDescriptorKey("NormalActivity");

            const string targetCondition = "Amount > 5000000";

            targetActivity.Descriptor.Condition.Expression = targetCondition;

            targetActivity.Descriptor.Properties["Condition"].StringValue = JSONSerializerExecute.Serialize(targetActivity.Descriptor.Condition);

            WfEditActivityPropertiesExecutor executor = new WfEditActivityPropertiesExecutor(process.CurrentActivity, process, targetActivity.Descriptor, true);

            executor.Execute();

            process = WfRuntime.GetProcessByProcessID(process.ID);

            targetActivity = process.Activities.FindActivityByDescriptorKey("NormalActivity");

            Assert.AreEqual(targetCondition, targetActivity.Descriptor.Condition.Expression);

            IWfActivityDescriptor msActDesp = process.Activities.FindActivityByDescriptorKey("NormalActivity").GetMainStreamActivityDescriptor();

            Console.WriteLine(msActDesp.Condition.Expression);

            Assert.AreEqual(targetCondition, msActDesp.Condition.Expression);
        }
        public string GetActivityRelatedUsers(string activityID)
        {
            var activityInstance = WfClientContext.Current.CurrentActivity.Process.Activities[activityID];

            if (activityInstance == null)
            {
                return(string.Empty);
            }

            if (activityInstance.Assignees.Count > 0)
            {
                WfConverterHelper.RegisterConverters();

                var userList = activityInstance.Assignees.ToUsers();
                return(JSONSerializerExecute.Serialize(userList));
            }

            WfAssigneeCollection candidates = activityInstance.Candidates.GetSelectedAssignees();

            if (candidates.Count > 0)
            {
                WfConverterHelper.RegisterConverters();

                IEnumerable <IUser> userList = candidates.ToUsers();
                return(JSONSerializerExecute.Serialize(userList));
            }

            return(string.Empty);
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WfConverterHelper.RegisterConverters();

            var user = new WfUserResourceDescriptor();
            //user.
            var typeName = typeof(WfUserResourceDescriptor).Name;

            List <object> resTypes = new List <object>()
            {
                new  { shortType = typeof(WfUserResourceDescriptor).Name, displayName = "用户", imgUrl = ControlResources.UserLogoUrl },
                new  { shortType = typeof(WfDepartmentResourceDescriptor).Name, displayName = "组织", imgUrl = ControlResources.OULogoUrl },
                new  { shortType = typeof(WfGroupResourceDescriptor).Name, displayName = "用户组", imgUrl = ControlResources.GroupLogoUrl },
                new  { shortType = typeof(WfActivityOperatorResourceDescriptor).Name, displayName = "执行人", imgUrl = ControlResources.UserLogoUrl },
                new  { shortType = typeof(WfActivityAssigneesResourceDescriptor).Name, displayName = "指派人", imgUrl = ControlResources.UserLogoUrl },
                new  { shortType = typeof(WfRoleResourceDescriptor).Name, displayName = "角色", imgUrl = ControlResources.RoleLogoUrl },
                new  { shortType = typeof(WfDynamicResourceDescriptor).Name, displayName = "动态角色", imgUrl = ControlResources.RoleLogoUrl },
                new  { shortType = typeof(WfActivityMatrixResourceDescriptor).Name, displayName = "矩阵角色", imgUrl = ControlResources.RoleLogoUrl },
                new  { shortType = typeof(WfAURoleResourceDescriptor).Name, displayName = "(AU)架构角色", imgUrl = ControlResources.RoleLogoUrl }
            };

            hiddenResTypesData.Value = JSONSerializerExecute.Serialize(resTypes);
            WebUtility.RequiredScript(typeof(ClientGrid));
            this.CreateResourceTemplate();
        }
Пример #11
0
        private static void DoInsert(HttpContext context)
        {
            string id       = context.Request["id"];
            string category = context.Request["category"];
            string content  = context.Request["content"];

            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(content))
            {
                return;
            }

            WfConverterHelper.RegisterConverters();
            WfActivityDescriptor activityDesc = JSONSerializerExecute.Deserialize <WfActivityDescriptor>(content);

            activityDesc.Key = id;
            activityDesc.FromTransitions.Clear();
            activityDesc.ToTransitions.Clear();

            WfActivityTemplate template = new WfActivityTemplate()
            {
                ID          = id,
                Name        = activityDesc.Name,
                Category    = activityDesc.ActivityType.ToString(),
                CreateTime  = DateTime.Now,
                Content     = JSONSerializerExecute.Serialize(activityDesc),
                Available   = true,
                CreatorID   = DeluxeIdentity.CurrentUser.ID,
                CreatorName = DeluxeIdentity.CurrentUser.Name
            };

            WfActivityTemplateAdpter.Instance.Update(template);

            OutputResult(context, true, activityDesc.Key);
        }
Пример #12
0
        public void WfExternalUserTest()
        {
            WfConverterHelper.RegisterConverters();

            WfExternalUser externalUser = new WfExternalUser();

            externalUser.Key         = "user0";
            externalUser.Name        = "zLing";
            externalUser.Gender      = Gender.Female;
            externalUser.Email       = "*****@*****.**";
            externalUser.MobilePhone = "13552630000";
            externalUser.Phone       = "0409987";
            externalUser.Title       = "programer";

            string         result           = JSONSerializerExecute.Serialize(externalUser);
            WfExternalUser deserializedUser = JSONSerializerExecute.Deserialize <WfExternalUser>(result);
            string         reSerialized     = JSONSerializerExecute.Serialize(deserializedUser);

            Assert.AreEqual(result, reSerialized);


            //创建流程描述
            IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateSimpleProcessDescriptor();

            processDesp.ExternalUsers.Add(externalUser);                 //作用于流程
            processDesp.InitialActivity.ExternalUsers.Add(externalUser); //作用于节点

            string procDesp = JSONSerializerExecute.Serialize(processDesp);
            WfProcessDescriptor reProcessDesp = JSONSerializerExecute.Deserialize <WfProcessDescriptor>(procDesp);
            string reuslt = JSONSerializerExecute.Serialize(reProcessDesp);

            Assert.AreEqual(procDesp, reuslt);
            Assert.AreEqual(processDesp.ExternalUsers[0].Name, processDesp.InitialActivity.ExternalUsers[0].Name);
        }
Пример #13
0
        public void WfBranchProcessTemplateDescriptorConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            WfBranchProcessTemplateDescriptor branchProcessTempDesp = new WfBranchProcessTemplateDescriptor(Guid.NewGuid().ToString());

            branchProcessTempDesp.BlockingType    = WfBranchProcessBlockingType.WaitAnyoneBranchProcessComplete;
            branchProcessTempDesp.ExecuteSequence = WfBranchProcessExecuteSequence.Serial;


            string result = JSONSerializerExecute.Serialize(branchProcessTempDesp);

            Console.WriteLine(result);

            WfBranchProcessTemplateDescriptor deserializedBranchProcTempDesp = JSONSerializerExecute.Deserialize <WfBranchProcessTemplateDescriptor>(result);
            string reSerialized = JSONSerializerExecute.Serialize(deserializedBranchProcTempDesp);

            Assert.AreEqual(result, reSerialized);

            WfProcessDescriptor processDesp = (WfProcessDescriptor)WfProcessTestCommon.CreateSimpleProcessDescriptor();

            processDesp.InitialActivity.BranchProcessTemplates.Add(branchProcessTempDesp);

            string procResult = JSONSerializerExecute.Serialize(processDesp);

            Console.WriteLine(procResult);

            WfProcessDescriptor deserializedProcDesp = JSONSerializerExecute.Deserialize <WfProcessDescriptor>(procResult);
            string procReSerialized = JSONSerializerExecute.Serialize(deserializedProcDesp);

            Assert.AreEqual(procResult, procReSerialized);
        }
Пример #14
0
 public WfMoveToControl()
 {
     if (this.DesignMode == false)
     {
         WfConverterHelper.RegisterConverters();
         JSONSerializerExecute.RegisterConverter(typeof(WfMoveToSelectedResultConverter));
     }
 }
Пример #15
0
        public void WfRelativeLinkDespJSONTest()
        {
            WfConverterHelper.RegisterConverters();

            WfProcessDescriptor processDesp = (WfProcessDescriptor)WfProcessTestCommon.CreateSimpleProcessDescriptor();
            string result = JSONSerializerExecute.Serialize(processDesp);
            IWfProcessDescriptor procDesp = JSONSerializerExecute.Deserialize <WfProcessDescriptor>(result);

            Assert.AreEqual(processDesp.RelativeLinks[0].Name, procDesp.RelativeLinks[0].Name);
            Assert.AreEqual(processDesp.RelativeLinks[0].Url, procDesp.RelativeLinks[0].Url);
        }
Пример #16
0
        private JobBase CreateInvokingServiceJob()
        {
            WfConverterHelper.RegisterConverters();

            InvokeWebServiceJob newJob = new InvokeWebServiceJob();

            SetJobBaseInfo(newJob);
            newJob.SvcOperationDefs = JSONSerializerExecute.Deserialize <WfServiceOperationDefinitionCollection>(this.hdServiceDefinition.Value);

            return(newJob);
        }
Пример #17
0
        protected void ddlApps_SelectedIndexChanged(object sender, EventArgs e)
        {
            WfConverterHelper.RegisterConverters();

            ddlRoles.Enabled = false;
            string appCodeName = (sender as DropDownList).SelectedValue;

            RoleCollection roles = GetRoles(ddlApps.SelectedValue);

            ddlRoles.BindData(GetRoles(ddlApps.SelectedValue), "CodeName", "Name");

            ddlRoles.Enabled = true;
        }
Пример #18
0
        public void ProcessRequest(HttpContext context)
        {
            string json      = context.Request["info"];
            string processID = context.Request["processID"];

            context.Response.ContentType = "text/plain";
            WfConverterHelper.RegisterConverters();
            List <WfProcessDescriptor> deserializedProcessDesp;
            IWfProcess process = null;

            if (!string.IsNullOrEmpty(processID))
            {
                process = WorkflowSettings.GetConfig().GetPersistManager().LoadProcessByProcessID(processID);
            }

            try
            {
                deserializedProcessDesp = JSONSerializerExecute.Deserialize <List <WfProcessDescriptor> >(json);
            }
            catch (Exception ex)
            {
                context.Response.Write("反序列化错误:" + ex.Message + ex.StackTrace);
                return;
            }

            try
            {
                foreach (var descriptor in deserializedProcessDesp)
                {
                    if (process != null && descriptor.Key == process.Descriptor.Key)
                    {
                        process.Descriptor = descriptor;
                        WorkflowSettings.GetConfig().GetPersistManager().SaveProcess(process);
                    }
                    else
                    {
                        WfSaveTemplateExecutor executor = new WfSaveTemplateExecutor(descriptor);

                        executor.Execute();
                    }
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("保存错误:" + ex.Message + ex.StackTrace);
                return;
            }

            context.Response.Write("保存成功!");
        }
Пример #19
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            WfConverterHelper.RegisterConverters();

            if (this.SaveButtonID.IsNotEmpty())
            {
                IButtonControl button = this.Page.FindControlByID(this.SaveButtonID, true) as IButtonControl;

                if (button != null)
                {
                    button.Click += new EventHandler(button_Click);
                }
            }
        }
Пример #20
0
        public void WfMatrixDemensionDefinitionSerilizationTest()
        {
            WfConverterHelper.RegisterConverters();
            JSONSerializerExecute.RegisterConverter(typeof(WfMatrixDefinitionConverter));
            JSONSerializerExecute.RegisterConverter(typeof(WfMatrixDefinitionConverter));
            var    matrixDef             = WfMatrixDefinitionAdapterTest.BuildNewMatrixDef(_matrixColumnNum);
            string strSerializeMatrixDef = JSONSerializerExecute.Serialize(matrixDef);

            var matrixDef2 = JSONSerializerExecute.Deserialize <WfMatrixDefinition>(strSerializeMatrixDef);

            string strReserializeMatrixDef = JSONSerializerExecute.Serialize(matrixDef2);

            Console.WriteLine(strSerializeMatrixDef);
            Console.WriteLine(strReserializeMatrixDef);
            Assert.AreEqual(strSerializeMatrixDef, strReserializeMatrixDef);
        }
Пример #21
0
        public void ActiveMatrixResourceJsonSerializationTest()
        {
            WfActivityMatrixResourceDescriptor expected = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            WfConverterHelper.RegisterConverters();

            string serializedData = JSONSerializerExecute.Serialize(expected);

            Console.WriteLine(serializedData);

            WfActivityMatrixResourceDescriptor actual = JSONSerializerExecute.Deserialize <WfActivityMatrixResourceDescriptor>(serializedData);

            Assert.AreEqual(expected.PropertyDefinitions.Count, actual.PropertyDefinitions.Count);
            Assert.AreEqual(expected.Rows.Count, actual.Rows.Count);

            Assert.AreEqual(expected.PropertyDefinitions.GetAllKeys().Count(), actual.PropertyDefinitions.GetAllKeys().Count());
        }
Пример #22
0
        public void WfProcessDescriptorConverter()
        {
            WfConverterHelper.RegisterConverters();
            WfProcessDescriptor processDesp = (WfProcessDescriptor)WfProcessTestCommon.CreateSimpleProcessDescriptor();

            string result = JSONSerializerExecute.Serialize(processDesp);

            Console.WriteLine(result);

            WfProcessDescriptor deserializedProcessDesp = JSONSerializerExecute.Deserialize <WfProcessDescriptor>(result);

            //再次序列化时,字条串不相等,是因为创建流程时没有Key
            string reSerialized = JSONSerializerExecute.Serialize(deserializedProcessDesp);

            Console.WriteLine(reSerialized);
            Assert.AreEqual(result, reSerialized);
        }
Пример #23
0
        public void WfVariableDescriptorConveterTest()
        {
            WfConverterHelper.RegisterConverters();

            WfVariableDescriptor variableDesc = new WfVariableDescriptor("variable");

            variableDesc.Description = "变量";

            string result = JSONSerializerExecute.Serialize(variableDesc);

            Console.WriteLine(result);

            WfVariableDescriptor deserializedActDesp = JSONSerializerExecute.Deserialize <WfVariableDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedActDesp);

            Assert.AreEqual(result, reSerialized);
        }
Пример #24
0
        public void WfUserResourceDescriptorConveterTest()
        {
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            WfUserResourceDescriptor userDesp = new WfUserResourceDescriptor(user);

            string result = JSONSerializerExecute.Serialize(userDesp);

            Console.WriteLine(result);

            WfUserResourceDescriptor deserializedUserDesp = JSONSerializerExecute.Deserialize <WfUserResourceDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedUserDesp);

            Assert.AreEqual(result, reSerialized);
            ResourceConverterTest(userDesp);
        }
Пример #25
0
        public void WfActivityAssigneesResourceDescriptorConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            WfActivityAssigneesResourceDescriptor actAssigneesResDesp = new WfActivityAssigneesResourceDescriptor();

            actAssigneesResDesp.ActivityKey = "asfasf";
            string result = JSONSerializerExecute.Serialize(actAssigneesResDesp);

            Console.WriteLine(result);

            WfActivityAssigneesResourceDescriptor deserializedDesp = JSONSerializerExecute.Deserialize <WfActivityAssigneesResourceDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedDesp);

            Assert.AreEqual(result, reSerialized);

            ResourceConverterTest(actAssigneesResDesp);
        }
Пример #26
0
        public void UserSettingsJSONConverter()
        {
            //No parameterless constructor defined for this object.
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            UserSettings settings = UserSettings.GetDefaultSettings(user.ID);

            settings.Update();

            string result = JSONSerializerExecute.Serialize(settings);

            Console.WriteLine(result);

            UserSettings deserializedSettings = JSONSerializerExecute.Deserialize <UserSettings>(result);
            string       reSerialized         = JSONSerializerExecute.Serialize(deserializedSettings);

            Assert.AreEqual(result, reSerialized);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WfConverterHelper.RegisterConverters();

            WfActivityMatrixResourceDescriptor activityMatrix = null;
            string fileName = "ActivityMatrix";

            if (Request.Form["matrixData"] != null)
            {
                activityMatrix = JSONSerializerExecute.Deserialize <WfActivityMatrixResourceDescriptor>(Request.Form["matrixData"]);

                fileName = "SampleMatrix";
            }
            else
            {
                activityMatrix = PrepareSampleActivityMatrixResourceDescriptor();
            }

            ResponseExcelWorkBook(activityMatrix, fileName);
        }
Пример #28
0
        public void WfRoleResourceDescriptorConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            RoleCollection roleColl = user.Roles["OGU_ADMIN"];

            WfRoleResourceDescriptor roleResourceDesp = new WfRoleResourceDescriptor(roleColl[0]);
            string result = JSONSerializerExecute.Serialize(roleResourceDesp);

            Console.WriteLine(result);
            WfRoleResourceDescriptor deserializedRoleDesp = JSONSerializerExecute.Deserialize <WfRoleResourceDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedRoleDesp);

            Assert.AreEqual(result, reSerialized);

            ResourceConverterTest(roleResourceDesp);
        }
Пример #29
0
        public void WfControlNextStepJsonSerilizationTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            process.InitialActivity.Descriptor.ToTransitions[0].ToActivity.Resources.Add(new WfUserResourceDescriptor((IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object));

            WfConverterHelper.RegisterConverters();

            WfControlNextStep nextStep = new WfControlNextStep(process.InitialActivity.Descriptor.ToTransitions[0], process.CurrentActivity);

            string serializedData = JSONSerializerExecute.Serialize(nextStep);

            Console.WriteLine(serializedData);

            WfControlNextStep deserializedNextStep = JSONSerializerExecute.Deserialize <WfControlNextStep>(serializedData);

            string reserializedData = JSONSerializerExecute.Serialize(deserializedNextStep);

            Assert.AreEqual(serializedData, reserializedData);
        }
Пример #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                PropertyEditorRegister();

                WfConverterHelper.RegisterConverters();
                WfBranchProcessTemplateDescriptor branchProcessTempDesc = new WfBranchProcessTemplateDescriptor(string.Empty);
                //branchProcessTempDesc.BlockingType = WfBranchProcessBlockingType.WaitAllBranchProcessesComplete;
                //branchProcessTempDesc.ExecuteSequence = WfBranchProcessExecuteSequence.Parallel;
                this.hiddenBranchProcessTemplate.Value = JSONSerializerExecute.Serialize(branchProcessTempDesc);
                this.hiddenKey.Value = branchProcessTempDesc.Key;

                #region "用hidden properties 初始化没有属性值"
                //PropertyDefineCollection propetydefines = PropertyDefineCollection.CreatePropertiesFromConfiguration(WfActivitySettings.GetConfig().PropertyGroups["BasicBranchProcessTemplateProperties"]);
                //PropertyValueCollection properties = new PropertyValueCollection();
                //properties.InitFromPropertyDefineCollection(propetydefines);
                //this.hiddenBrnachConfigProperties.Value = JSONSerializerExecute.Serialize(properties);
                #endregion
            }
        }