Esempio n. 1
0
        public static void AreSame(this WfClientProcessCurrentInfo expected, WfClientProcessCurrentInfo actual)
        {
            AssertStringEqual(expected.InstanceID, actual.InstanceID);
            AssertStringEqual(expected.ResourceID, actual.ResourceID);

            AssertStringEqual(expected.ApplicationName, actual.ApplicationName);
            AssertStringEqual(expected.ProgramName, actual.ProgramName);
            AssertStringEqual(expected.ProcessName, actual.ProcessName);
            AssertStringEqual(expected.DescriptorKey, actual.DescriptorKey);
            AssertStringEqual(expected.OwnerActivityID, actual.OwnerActivityID);
            AssertStringEqual(expected.OwnerTemplateKey, actual.OwnerTemplateKey);
            AssertStringEqual(expected.CurrentActivityID, actual.CurrentActivityID);

            Assert.AreEqual(expected.Sequence, actual.Sequence);
            Assert.AreEqual(expected.Committed, actual.Committed);

            Assert.AreEqual(expected.CreateTime, actual.CreateTime);
            Assert.AreEqual(expected.StartTime, actual.StartTime);
            Assert.AreEqual(expected.EndTime, actual.EndTime);

            expected.Creator.AreSame(actual.Creator);
            expected.Department.AreSame(actual.Department);

            Assert.AreEqual(expected.Status, actual.Status);
            Assert.AreEqual(expected.UpdateTag, actual.UpdateTag);
        }
Esempio n. 2
0
        public static void AreSame(this WfClientProcessCurrentInfo client, WfProcessCurrentInfo server)
        {
            AssertStringEqual(client.InstanceID, server.InstanceID);
            AssertStringEqual(client.ResourceID, server.ResourceID);

            AssertStringEqual(client.ApplicationName, server.ApplicationName);
            AssertStringEqual(client.ProgramName, server.ProgramName);
            AssertStringEqual(client.ProcessName, server.ProcessName);
            AssertStringEqual(client.DescriptorKey, server.DescriptorKey);
            AssertStringEqual(client.OwnerActivityID, server.OwnerActivityID);
            AssertStringEqual(client.OwnerTemplateKey, server.OwnerTemplateKey);
            AssertStringEqual(client.CurrentActivityID, server.CurrentActivityID);

            Assert.AreEqual(client.Sequence, server.Sequence);
            Assert.AreEqual(client.Committed, server.Committed);

            Assert.AreEqual(client.CreateTime, server.CreateTime);
            Assert.AreEqual(client.StartTime, server.StartTime);
            Assert.AreEqual(client.EndTime, server.EndTime);

            client.Creator.AreSame(server.Creator);
            client.Department.AreSame(server.Department);

            Assert.AreEqual(client.Status, server.Status.ToClientProcessStatus());
            Assert.AreEqual(client.UpdateTag, server.UpdateTag);
        }
        public WfClientProcessCurrentInfo ServerToClient(WfProcessCurrentInfo server, ref WfClientProcessCurrentInfo client)
        {
            server.NullCheck("server");

            if (client == null)
            {
                client = new WfClientProcessCurrentInfo();
            }

            client.InstanceID = server.InstanceID;
            client.ResourceID = server.ResourceID;

            client.ApplicationName   = server.ApplicationName;
            client.ProgramName       = server.ProgramName;
            client.ProcessName       = server.ProcessName;
            client.DescriptorKey     = server.DescriptorKey;
            client.OwnerActivityID   = server.OwnerActivityID;
            client.OwnerTemplateKey  = server.OwnerTemplateKey;
            client.CurrentActivityID = server.CurrentActivityID;

            client.Sequence  = server.Sequence;
            client.Committed = server.Committed;

            client.CreateTime = server.CreateTime;
            client.StartTime  = server.StartTime;
            client.EndTime    = server.EndTime;
            client.Creator    = (WfClientUser)server.Creator.ToClientOguObject();
            client.Department = (WfClientOrganization)server.Department.ToClientOguObject();
            client.Status     = server.Status.ToClientProcessStatus();
            client.UpdateTag  = server.UpdateTag;

            return(client);
        }
        public static void AreSame(this WfClientProcessCurrentInfo expected, WfClientProcessCurrentInfo actual)
        {
            AssertStringEqual(expected.InstanceID, actual.InstanceID);
            AssertStringEqual(expected.ResourceID, actual.ResourceID);

            AssertStringEqual(expected.ApplicationName, actual.ApplicationName);
            AssertStringEqual(expected.ProgramName, actual.ProgramName);
            AssertStringEqual(expected.ProcessName, actual.ProcessName);
            AssertStringEqual(expected.DescriptorKey, actual.DescriptorKey);
            AssertStringEqual(expected.OwnerActivityID, actual.OwnerActivityID);
            AssertStringEqual(expected.OwnerTemplateKey, actual.OwnerTemplateKey);
            AssertStringEqual(expected.CurrentActivityID, actual.CurrentActivityID);

            Assert.AreEqual(expected.Sequence, actual.Sequence);
            Assert.AreEqual(expected.Committed, actual.Committed);

            Assert.AreEqual(expected.CreateTime, actual.CreateTime);
            Assert.AreEqual(expected.StartTime, actual.StartTime);
            Assert.AreEqual(expected.EndTime, actual.EndTime);

            expected.Creator.AreSame(actual.Creator);
            expected.Department.AreSame(actual.Department);

            Assert.AreEqual(expected.Status, actual.Status);
            Assert.AreEqual(expected.UpdateTag, actual.UpdateTag);
        }
        public WfProcessCurrentInfo ClientToServer(WfClientProcessCurrentInfo client, ref WfProcessCurrentInfo server)
        {
            client.NullCheck("client");

            if (server == null)
            {
                server = new WfProcessCurrentInfo();
            }

            server.InstanceID = client.InstanceID;
            server.ResourceID = client.ResourceID;

            server.ApplicationName = client.ApplicationName;
            server.ProgramName     = client.ProgramName;

            server.DescriptorKey     = client.DescriptorKey;
            server.OwnerActivityID   = client.OwnerActivityID;
            server.OwnerTemplateKey  = client.OwnerTemplateKey;
            server.CurrentActivityID = client.CurrentActivityID;

            server.Sequence  = client.Sequence;
            server.Committed = client.Committed;

            server.CreateTime = client.CreateTime;
            server.StartTime  = client.StartTime;
            server.EndTime    = client.EndTime;
            server.Creator    = (IUser)client.Creator.ToOguObject();
            server.Department = (IOrganization)client.Department.ToOguObject();
            server.Status     = client.Status.ToProcessStatus();
            server.UpdateTag  = client.UpdateTag;

            return(server);
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessCurrentInfo processInfo = new WfClientProcessCurrentInfo();

            processInfo.InstanceID = dictionary.GetValue("instanceID", string.Empty);
            processInfo.ResourceID = dictionary.GetValue("resourceID", string.Empty);

            processInfo.ApplicationName = dictionary.GetValue("applicationName", string.Empty);
            processInfo.ProgramName = dictionary.GetValue("programName", string.Empty);
            processInfo.ProcessName = dictionary.GetValue("processName", string.Empty);
            processInfo.DescriptorKey = dictionary.GetValue("descriptorKey", string.Empty);
            processInfo.OwnerActivityID = dictionary.GetValue("ownerActivityID", string.Empty);
            processInfo.OwnerTemplateKey = dictionary.GetValue("ownerTemplateKey", string.Empty);
            processInfo.CurrentActivityID = dictionary.GetValue("currentActivityID", string.Empty);

            processInfo.Sequence = dictionary.GetValue("sequence", 0);
            processInfo.Committed = dictionary.GetValue("committed", true);
            processInfo.CreateTime = dictionary.GetValue("createTime", DateTime.MinValue);
            processInfo.StartTime = dictionary.GetValue("startTime", DateTime.MinValue);
            processInfo.EndTime = dictionary.GetValue("endTime", DateTime.MinValue);

            processInfo.Creator = JSONSerializerExecute.Deserialize<WfClientUser>(dictionary.GetValue("creator", (object)null));
            processInfo.Department = JSONSerializerExecute.Deserialize<WfClientOrganization>(dictionary.GetValue("department", (object)null));
            processInfo.Status = dictionary.GetValue("status", WfClientProcessStatus.NotRunning);
            processInfo.UpdateTag = dictionary.GetValue("updateTag", 0);

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

            dictionary.AddNonDefaultValue("instanceID", processInfo.InstanceID);
            dictionary.AddNonDefaultValue("resourceID", processInfo.ResourceID);

            dictionary.AddNonDefaultValue("applicationName", processInfo.ApplicationName);
            dictionary.AddNonDefaultValue("programName", processInfo.ProgramName);
            dictionary.AddNonDefaultValue("processName", processInfo.ProcessName);
            dictionary.AddNonDefaultValue("descriptorKey", processInfo.DescriptorKey);
            dictionary.AddNonDefaultValue("ownerActivityID", processInfo.OwnerActivityID);
            dictionary.AddNonDefaultValue("ownerTemplateKey", processInfo.OwnerTemplateKey);
            dictionary.AddNonDefaultValue("currentActivityID", processInfo.CurrentActivityID);

            dictionary.AddNonDefaultValue("sequence", processInfo.Sequence);
            dictionary.AddNonDefaultValue("committed", processInfo.Committed);
            dictionary.AddNonDefaultValue("createTime", processInfo.CreateTime);
            dictionary.AddNonDefaultValue("startTime", processInfo.StartTime);
            dictionary.AddNonDefaultValue("endTime", processInfo.EndTime);

            dictionary.AddNonDefaultValue("creator", processInfo.Creator);
            dictionary.AddNonDefaultValue("department", processInfo.Department);
            dictionary.AddNonDefaultValue("status", processInfo.Status);
            dictionary.AddNonDefaultValue("updateTag", processInfo.UpdateTag);

            return(dictionary);
        }
Esempio n. 8
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessCurrentInfo processInfo = new WfClientProcessCurrentInfo();

            processInfo.InstanceID = dictionary.GetValue("instanceID", string.Empty);
            processInfo.ResourceID = dictionary.GetValue("resourceID", string.Empty);

            processInfo.ApplicationName   = dictionary.GetValue("applicationName", string.Empty);
            processInfo.ProgramName       = dictionary.GetValue("programName", string.Empty);
            processInfo.ProcessName       = dictionary.GetValue("processName", string.Empty);
            processInfo.DescriptorKey     = dictionary.GetValue("descriptorKey", string.Empty);
            processInfo.OwnerActivityID   = dictionary.GetValue("ownerActivityID", string.Empty);
            processInfo.OwnerTemplateKey  = dictionary.GetValue("ownerTemplateKey", string.Empty);
            processInfo.CurrentActivityID = dictionary.GetValue("currentActivityID", string.Empty);

            processInfo.Sequence   = dictionary.GetValue("sequence", 0);
            processInfo.Committed  = dictionary.GetValue("committed", true);
            processInfo.CreateTime = dictionary.GetValue("createTime", DateTime.MinValue);
            processInfo.StartTime  = dictionary.GetValue("startTime", DateTime.MinValue);
            processInfo.EndTime    = dictionary.GetValue("endTime", DateTime.MinValue);

            processInfo.Creator    = JSONSerializerExecute.Deserialize <WfClientUser>(dictionary.GetValue("creator", (object)null));
            processInfo.Department = JSONSerializerExecute.Deserialize <WfClientOrganization>(dictionary.GetValue("department", (object)null));
            processInfo.Status     = dictionary.GetValue("status", WfClientProcessStatus.NotRunning);
            processInfo.UpdateTag  = dictionary.GetValue("updateTag", 0);

            return(processInfo);
        }
        public void ProcessCurrentInfoToClientTest()
        {
            IWfProcess process = PrepareProcess();

            WfProcessCurrentInfo server = WfProcessCurrentInfoAdapter.Instance.LoadByProcessID(process.ID).FirstOrDefault();

            WfClientProcessCurrentInfo client = null;

            WfClientProcessCurrentInfoConverter.Instance.ServerToClient(server, ref client);

            client.AreSame(server);
        }
        public void ServerToClient(WfProcessCurrentInfoCollection server, WfClientProcessCurrentInfoCollection client)
        {
            server.NullCheck("server");
            client.NullCheck("client");

            client.Clear();

            foreach (WfProcessCurrentInfo processInfo in server)
            {
                WfClientProcessCurrentInfo clientInfo = null;

                this.ServerToClient(processInfo, ref clientInfo);

                client.Add(clientInfo);
            }
        }
        public void ProcessCurrentInfoSerializationTest()
        {
            WfClientJsonConverterHelper.Instance.RegisterConverters();

            IWfProcess process = PrepareProcess();

            WfProcessCurrentInfo server = WfProcessCurrentInfoAdapter.Instance.LoadByProcessID(process.ID).FirstOrDefault();

            WfClientProcessCurrentInfo client = null;

            WfClientProcessCurrentInfoConverter.Instance.ServerToClient(server, ref client);

            string data = JSONSerializerExecute.Serialize(client);

            Console.WriteLine(data);

            WfClientProcessCurrentInfo deserialized = JSONSerializerExecute.Deserialize <WfClientProcessCurrentInfo>(data);

            client.AreSame(deserialized);
        }