Esempio n. 1
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);
        }
Esempio n. 2
0
        public void WfExternalUserTest()
        {
            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";

            IWfProcessDescriptor processDesc = WfProcessTestCommon.CreateSimpleProcessDescriptor();

            processDesc.ExternalUsers.Add(externalUser);

            WfProcessStartupParams startupParams = new WfProcessStartupParams();

            startupParams.ProcessDescriptor = processDesc;
            IWfProcess process = WfRuntime.StartWorkflow(startupParams);

            XElementFormatter formatter = new XElementFormatter();

            XElement   rootProc      = formatter.Serialize(process);
            IWfProcess clonedProcess = (IWfProcess)formatter.Deserialize(rootProc);

            XElement resultProc = formatter.Serialize(clonedProcess);

            Assert.AreEqual(processDesc.ExternalUsers[0].Name, clonedProcess.Descriptor.ExternalUsers[0].Name);
            Assert.AreEqual(processDesc.ExternalUsers[0].Gender, clonedProcess.Descriptor.ExternalUsers[0].Gender);

            Assert.AreEqual(rootProc.ToString(), resultProc.ToString());
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WfExternalUser extUser = new WfExternalUser();

            hiddenExtUserTemplate.Value = JSONSerializerExecute.Serialize(extUser);
            BindList(ddlGender, EnumItemDescriptionAttribute.GetDescriptionList(typeof(MCS.Library.SOA.DataObjects.Gender)));
        }
Esempio n. 4
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfExternalUser externalUser = new WfExternalUser();

            externalUser.Key         = DictionaryHelper.GetValue(dictionary, "Key", string.Empty);
            externalUser.Name        = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);
            externalUser.Gender      = DictionaryHelper.GetValue(dictionary, "Gender", Gender.Female);
            externalUser.Phone       = DictionaryHelper.GetValue(dictionary, "Phone", string.Empty);
            externalUser.MobilePhone = DictionaryHelper.GetValue(dictionary, "MobilePhone", string.Empty);
            externalUser.Title       = DictionaryHelper.GetValue(dictionary, "Title", string.Empty);
            externalUser.Email       = DictionaryHelper.GetValue(dictionary, "Email", string.Empty);

            return(externalUser);
        }
Esempio n. 5
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            IDictionary <string, object> dictionary = new Dictionary <string, object>();

            WfExternalUser externalUser = (WfExternalUser)obj;

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Key", externalUser.Key);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Name", externalUser.Name);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Gender", externalUser.Gender);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Phone", externalUser.Phone);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "MobilePhone", externalUser.MobilePhone);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Title", externalUser.Title);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Email", externalUser.Email);

            return(dictionary);
        }
		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);

		}
 protected void Page_Load(object sender, EventArgs e)
 {
     WfExternalUser extUser = new WfExternalUser();
     hiddenExtUserTemplate.Value = JSONSerializerExecute.Serialize(extUser);
     BindList(ddlGender, EnumItemDescriptionAttribute.GetDescriptionList(typeof(MCS.Library.SOA.DataObjects.Gender)));
 }
		public void WfExternalUserTest()
		{
			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";

			IWfProcessDescriptor processDesc = WfProcessTestCommon.CreateSimpleProcessDescriptor();

			processDesc.ExternalUsers.Add(externalUser);

			WfProcessStartupParams startupParams = new WfProcessStartupParams();
			startupParams.ProcessDescriptor = processDesc;
			IWfProcess process = WfRuntime.StartWorkflow(startupParams);

			XElementFormatter formatter = new XElementFormatter();

			XElement rootProc = formatter.Serialize(process);
			IWfProcess clonedProcess = (IWfProcess)formatter.Deserialize(rootProc);

			XElement resultProc = formatter.Serialize(clonedProcess);

			Assert.AreEqual(processDesc.ExternalUsers[0].Name, clonedProcess.Descriptor.ExternalUsers[0].Name);
			Assert.AreEqual(processDesc.ExternalUsers[0].Gender, clonedProcess.Descriptor.ExternalUsers[0].Gender);

			Assert.AreEqual(rootProc.ToString(), resultProc.ToString());
		}