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 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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        private string GetStatusText(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo)
        {
            string result = DefaultStatusText;

            switch (DisplayMode)
            {
            case WfStatusDisplayMode.ProcessStatus:
                result = HttpUtility.HtmlEncode(EnumItemDescriptionAttribute.GetDescription(atp.Status));
                break;

            case WfStatusDisplayMode.CurrentUsers:
                if (EnableUserPresence == false)
                {
                    result = GetAllAssigneesStatusHtmlWithoutPresence(atp);
                }
                else
                {
                    result = GetAllAssigneesStatusHtmlWithPresence(atp, IsHtmlRender, extendInfo, this.ClientID);
                }

                break;
            }

            return(result);
        }
Ejemplo n.º 5
0
        private Control CreateStatusDisplayControl(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo)
        {
            HtmlGenericControl Container = new HtmlGenericControl("span");

            HtmlGenericControl firstLine = new HtmlGenericControl("span");

            Container.Controls.Add(firstLine);

            HtmlAnchor statusAnchor = new HtmlAnchor();

            firstLine.Controls.Add(statusAnchor);

            statusAnchor.InnerHtml = GetStatusText(atp, extendInfo);
            statusAnchor.HRef      = "#";

            string deptName = atp.Department.DisplayName;

            statusAnchor.Title = GetAllAssigneesStatusText(atp);
            statusAnchor.Attributes["onclick"] = "onWfStatusLinkClick()";

            HtmlGenericControl seperator = new HtmlGenericControl("span");

            firstLine.Controls.Add(seperator);

            seperator.InnerHtml = " ";

            PageRenderMode mode = WebUtility.GetRequestPageRenderMode();

            if (mode.IsHtmlRender)
            {
                HtmlAnchor traceAnchor = new HtmlAnchor();
                firstLine.Controls.Add(traceAnchor);

                HtmlImage logo = new HtmlImage();
                traceAnchor.Controls.Add(logo);

                logo.Style["border"] = "none";

                logo.Alt = Translator.Translate(Define.DefaultCulture, "流程跟踪...");

                logo.Style["vertical-align"] = "middle";
                logo.Src = GetImageByStatus(atp.Status);

                InitTraceControlEntry(traceAnchor, atp.ResourceID, atp.InstanceID);
            }

            HtmlGenericControl secondLine = new HtmlGenericControl("div");

            Container.Controls.Add(secondLine);

            secondLine.Controls.Add(CreateDetailControl(atp, extendInfo));

            secondLine.Style["display"] = "none";

            return(Container);
        }
        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);
        }
Ejemplo n.º 7
0
        private static string GetAllAssigneesStatusText(WfProcessCurrentInfo atp)
        {
            StringBuilder strB = new StringBuilder();

            foreach (var assignee in atp.Assignees)
            {
                strB.AppendFormat("{0}({1})",
                                  assignee.User.DisplayName,
                                  GetUserTopOUName(assignee.User));
            }

            return(strB.ToString());
        }
Ejemplo n.º 8
0
        private static string GetAllAssigneesStatusHtmlWithoutPresence(WfProcessCurrentInfo atp)
        {
            HtmlGenericControl span = new HtmlGenericControl("span");

            foreach (var assignee in atp.Assignees)
            {
                span.InnerHtml = string.Format("{0}({1})",
                                               HttpUtility.HtmlEncode(assignee.User.DisplayName),
                                               HttpUtility.HtmlEncode(assignee.User.TopOU.DisplayName));
            }

            return(WebControlUtility.GetControlHtml(span));
        }
Ejemplo n.º 9
0
        private Control CreateDetailControl(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo)
        {
            HtmlGenericControl subContainer = new HtmlGenericControl("div");

            HtmlGenericControl divActivtity = new HtmlGenericControl("div");

            subContainer.Controls.Add(divActivtity);

            HtmlGenericControl divUserInfo = new HtmlGenericControl("div");

            subContainer.Controls.Add(divUserInfo);

            divUserInfo.InnerHtml = GetAllAssigneesStatusHtmlWithPresence(atp, IsHtmlRender, extendInfo, this.ClientID + "_DETAIL");

            return(subContainer);
        }
        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);
        }
Ejemplo n.º 11
0
        private void RenderStatus(WfProcessCurrentInfoCollection atpc, UserIMAddressCollection extendInfo, HtmlTextWriter writer)
        {
            WfProcessCurrentInfo atp = null;

            if (this.ProcessID.IsNotEmpty())
            {
                atp = atpc.Find(a => string.Compare(a.InstanceID, this.ProcessID, true) == 0);
            }
            else
            {
                if (this.ResourceID.IsNotEmpty())
                {
                    atp = atpc.Find(a => string.Compare(a.ResourceID, this.ResourceID, true) == 0);
                }
            }

            if (atp != null)
            {
                writer.Write(WebControlUtility.GetControlHtml(CreateStatusDisplayControl(atp, extendInfo)));
            }
        }
Ejemplo n.º 12
0
        private static string GetAllAssigneesStatusHtmlWithPresence(WfProcessCurrentInfo atp, bool showStatusImage, UserIMAddressCollection extendInfo, string idPrefix)
        {
            HtmlGenericControl span = new HtmlGenericControl("span");

            int i = 0;

            foreach (var assignee in atp.Assignees)
            {
                //span.InnerHtml +=
                //    UserPresence.GetUsersPresenceHtml(assignee.User.ID, assignee.User.DisplayName.IsNullOrEmpty() ? assignee.User.Name : assignee.User.DisplayName,
                //                                      idPrefix + "_img_" + i, showStatusImage, false, true, StatusImageType.Ball, "", extendInfo);

                //string topOUName = GetUserTopOUName(assignee.User);

                //if (topOUName.IsNotEmpty())
                //    span.InnerHtml += string.Format("({0})", HttpUtility.HtmlEncode(topOUName));

                i++;
            }

            return(GetControlHtml(span));
        }
Ejemplo n.º 13
0
        private string GetStatusText(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo)
        {
            string result = DefaultStatusText;

            switch (DisplayMode)
            {
                case WfStatusDisplayMode.ProcessStatus:
                    result = HttpUtility.HtmlEncode(EnumItemDescriptionAttribute.GetDescription(atp.Status));
                    break;
                case WfStatusDisplayMode.CurrentUsers:
                    if (EnableUserPresence == false)
                        result = GetAllAssigneesStatusHtmlWithoutPresence(atp);
                    else
                        result = GetAllAssigneesStatusHtmlWithPresence(atp, IsHtmlRender, extendInfo, this.ClientID);

                    break;
            }

            return result;
        }
        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);
        }
Ejemplo n.º 15
0
        private static string GetAllAssigneesStatusText(WfProcessCurrentInfo atp)
        {
            StringBuilder strB = new StringBuilder();

            foreach (var assignee in atp.Assignees)
            {
                strB.AppendFormat("{0}({1})",
                    assignee.User.DisplayName,
                    GetUserTopOUName(assignee.User));
            }

            return strB.ToString();
        }
Ejemplo n.º 16
0
        private static string GetAllAssigneesStatusHtmlWithoutPresence(WfProcessCurrentInfo atp)
        {
            HtmlGenericControl span = new HtmlGenericControl("span");

            foreach (var assignee in atp.Assignees)
            {
                span.InnerHtml = string.Format("{0}({1})",
                    HttpUtility.HtmlEncode(assignee.User.DisplayName),
                    HttpUtility.HtmlEncode(assignee.User.TopOU.DisplayName));
            }

            return WebControlUtility.GetControlHtml(span);
        }
Ejemplo n.º 17
0
        private static string GetAllAssigneesStatusHtmlWithPresence(WfProcessCurrentInfo atp, bool showStatusImage, UserIMAddressCollection extendInfo, string idPrefix)
        {
            HtmlGenericControl span = new HtmlGenericControl("span");

            int i = 0;
            foreach (var assignee in atp.Assignees)
            {
                span.InnerHtml +=
                    UserPresence.GetUsersPresenceHtml(assignee.User.ID, assignee.User.DisplayName.IsNullOrEmpty() ? assignee.User.Name : assignee.User.DisplayName,
                                                      idPrefix + "_img_" + i, showStatusImage, false, true, StatusImageType.Ball, "", extendInfo);

                string topOUName = GetUserTopOUName(assignee.User);

                if (topOUName.IsNotEmpty())
                    span.InnerHtml += string.Format("({0})", HttpUtility.HtmlEncode(topOUName));

                i++;
            }

            return WebControlUtility.GetControlHtml(span);
        }
Ejemplo n.º 18
0
        private Control CreateStatusDisplayControl(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo)
        {
            HtmlGenericControl Container = new HtmlGenericControl("span");

            HtmlGenericControl firstLine = new HtmlGenericControl("span");
            Container.Controls.Add(firstLine);

            HtmlAnchor statusAnchor = new HtmlAnchor();
            firstLine.Controls.Add(statusAnchor);

            statusAnchor.InnerHtml = GetStatusText(atp, extendInfo);
            statusAnchor.HRef = "#";

            string deptName = atp.Department.DisplayName;

            statusAnchor.Title = GetAllAssigneesStatusText(atp);
            statusAnchor.Attributes["onclick"] = "onWfStatusLinkClick()";

            HtmlGenericControl seperator = new HtmlGenericControl("span");
            firstLine.Controls.Add(seperator);

            seperator.InnerHtml = "&nbsp;";

            PageRenderMode mode = WebUtility.GetRequestPageRenderMode();

            if (mode.IsHtmlRender)
            {
                HtmlAnchor traceAnchor = new HtmlAnchor();
                firstLine.Controls.Add(traceAnchor);

                HtmlImage logo = new HtmlImage();
                traceAnchor.Controls.Add(logo);

                logo.Style["border"] = "none";

                logo.Alt = Translator.Translate(Define.DefaultCulture, "流程跟踪...");

                logo.Style["vertical-align"] = "middle";
                logo.Src = GetImageByStatus(atp.Status);

                InitTraceControlEntry(traceAnchor, atp.ResourceID, atp.InstanceID);
            }

            HtmlGenericControl secondLine = new HtmlGenericControl("div");
            Container.Controls.Add(secondLine);

            secondLine.Controls.Add(CreateDetailControl(atp, extendInfo));

            secondLine.Style["display"] = "none";

            return Container;
        }
Ejemplo n.º 19
0
        private Control CreateDetailControl(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo)
        {
            HtmlGenericControl subContainer = new HtmlGenericControl("div");

            HtmlGenericControl divActivtity = new HtmlGenericControl("div");
            subContainer.Controls.Add(divActivtity);

            HtmlGenericControl divUserInfo = new HtmlGenericControl("div");
            subContainer.Controls.Add(divUserInfo);

            divUserInfo.InnerHtml = GetAllAssigneesStatusHtmlWithPresence(atp, IsHtmlRender, extendInfo, this.ClientID + "_DETAIL");

            return subContainer;
        }