protected override void OnPreRender(EventArgs e)
        {
            if (!DesignMode)
            {
                var users =
                    CutomerServiceExecutiveSetting.GetConfig().CutomerServiceExecutiveQuery.QueryCutomerServiceExecutive(Category.Split(','));

                if (users.Any())
                {
                    var title = new HtmlGenericControl("Span");
                    title.Attributes.Add("class", "csel_more");
                    title.InnerText = CutomerServiceExecutiveSetting.GetConfig().Title;
                    this.Controls.Add(title);



                    foreach (var u in users)
                    {
                        var userName = new HtmlGenericControl("Span");
                        userName.Attributes.Add("class", "csel_list");

                        UserPresence presence = new UserPresence();

                        presence.UserID          = u.ID;
                        presence.UserDisplayName = u.DisplayName;

                        userName.Controls.Add(presence);
                        this.Controls.Add(userName);

                        presence.EnsureInUserList();
                    }
                }
            }
            base.OnPreRender(e);
        }
        private static void OccupyUserPresenceAddress(IEnumerable objs)
        {
            List <string> userIDs = new List <string>();

            foreach (IOguObject obj in objs)
            {
                if (obj is IUser)
                {
                    userIDs.Add(obj.ID);
                }
            }

            UserIMAddressCollection usersExtendedInfo = UserOUControlSettings.GetConfig().UserOUControlQuery.QueryUsersIMAddress(userIDs.ToArray());

            foreach (OguBase obj in objs)
            {
                if (obj is IUser)
                {
                    UserIMAddress userIMAddresses = usersExtendedInfo.Find(e => string.Compare(e.UserID, obj.ID, true) == 0);

                    if (userIMAddresses != null && userIMAddresses.IMAddress.IsNotEmpty())
                    {
                        obj.ClientContext["IMAddress"] = UserPresence.NormalizeIMAddress(userIMAddresses.IMAddress);
                    }
                }
            }
        }
Exemple #3
0
        private Control GetUserNameControl(IUser user)
        {
            HtmlGenericControl userName = new HtmlGenericControl("span");

            if (user != null)
            {
                if (EnableUserPresence)
                {
                    UserPresence presence = new UserPresence();

                    presence.UserID          = user.ID;
                    presence.UserDisplayName = user.DisplayName;

                    userName.Controls.Add(presence);

                    presence.EnsureInUserList();
                }
                else
                {
                    userName.InnerText = user.DisplayName;
                }
            }

            return(userName);
        }
Exemple #4
0
        private void RenderOneOpinionWithPrecense(GenericOpinion opinion, string opText, Control container)
        {
            HtmlGenericControl opTextContainer = new HtmlGenericControl("div");

            opTextContainer.Attributes["class"] = "text";
            opTextContainer.InnerHtml           = HttpUtility.HtmlEncode(opText).Replace("\r\n", "<br/>");
            container.Controls.Add(opTextContainer);

            HtmlGenericControl signName = new HtmlGenericControl("div");

            signName.Attributes["class"] = "signName";
            container.Controls.Add(signName);

            UserPresence presence = new UserPresence();

            if (OpinionListControlHelper.UserSignatures.ContainsKey(opinion.IssuePerson.ID))
            {
                HtmlImage sigImage = new HtmlImage();

                sigImage.Src = OpinionListControlHelper.UserSignatures[opinion.IssuePerson.ID];
                sigImage.Alt = opinion.IssuePerson.DisplayName;

                signName.Controls.Add(sigImage);

                presence.ShowUserDisplayName = false;
            }

            signName.Controls.Add(presence);

            presence.UserID          = opinion.IssuePerson.ID;
            presence.UserDisplayName = opinion.IssuePerson.DisplayName;                 //防止人员离职
            presence.EnsureInUserList();

            if (opinion.IssuePerson.ID != opinion.AppendPerson.ID)
            {
                HtmlGenericControl sp1 = new HtmlGenericControl("span");
                sp1.InnerText = "(";
                signName.Controls.Add(sp1);

                UserPresence presence2 = new UserPresence();
                signName.Controls.Add(presence2);
                presence2.UserID          = opinion.AppendPerson.ID;
                presence2.UserDisplayName = opinion.AppendPerson.DisplayName;                   //防止人员离职
                presence2.EnsureInUserList();

                HtmlGenericControl sp2 = new HtmlGenericControl("span");
                sp2.InnerText = string.Format(" {0})", Translator.Translate(Define.DefaultCulture, "代写"));
                signName.Controls.Add(sp2);
            }

            HtmlGenericControl dateContainer = new HtmlGenericControl("div");

            dateContainer.Attributes["class"] = "signDate";
            dateContainer.InnerText           = opinion.AppendDatetime.ToString("yyyy-MM-dd HH:mm:ss");
            container.Controls.Add(dateContainer);
        }
        private void RenderCustomerService()
        {
            var users = CutomerServiceExecutiveSetting.GetConfig().CutomerServiceExecutiveQuery.QueryCutomerServiceExecutive(CustomerServiceCategory.Split(','));

            if (users.Any())
            {
                var divCustomerServiceControl = new HtmlGenericControl("div")
                {
                    ID = "divCustomerService"
                };
                divCustomerServiceControl.Attributes["class"] = "muiFirst mui-msg";
                divCustomerServiceControl.Controls.Add(new HtmlGenericControl("div")
                {
                    InnerText = "在线客服"
                });
                this.Controls.Add(divCustomerServiceControl);

                var divPanel = new HtmlGenericControl("div")
                {
                    ID = divCustomerServiceControl.ID + "_panel"
                };
                divPanel.Attributes["class"] = "mui";
                divPanel.Style[HtmlTextWriterStyle.Display] = "none";
                divCustomerServiceControl.Controls.Add(divPanel);

                var divTitle = new HtmlGenericControl("div")
                {
                    InnerText = "◆ 在线客服"
                };
                divTitle.Attributes["class"] = "mui-title";
                divPanel.Controls.Add(divTitle);

                var ul = new HtmlGenericControl("ul");
                ul.Attributes["class"] = "mui-content text-left ";
                divPanel.Controls.Add(ul);

                foreach (var u in users)
                {
                    var          li       = new HtmlGenericControl("li");
                    UserPresence presence = new UserPresence();

                    presence.UserID          = u.ID;
                    presence.UserDisplayName = u.DisplayName;

                    li.Controls.Add(presence);
                    ul.Controls.Add(li);

                    presence.EnsureInUserList();
                }
            }
        }
Exemple #6
0
        protected override List <HtmlTableRow> GetRelativeRows()
        {
            List <HtmlTableRow> rows = new List <HtmlTableRow>();

            foreach (WfUserResourceDescriptor item in InternalRelativeUsers)
            {
                HtmlTableRow  row  = new HtmlTableRow();
                HtmlTableCell cell = new HtmlTableCell();
                cell.Attributes["class"] = "userCell";

                UserPresence userPresence = new UserPresence();
                userPresence.UserID          = item.User.ID;
                userPresence.UserDisplayName = item.User.DisplayName;

                cell.Controls.Add(userPresence);
                HtmlTableCell userTitleCell = new HtmlTableCell();
                userTitleCell.InnerText           = item.User.Occupation;
                userTitleCell.Attributes["class"] = "userTitleCell";
                row.Controls.Add(userTitleCell);
                row.Controls.Add(cell);
                rows.Add(row);
            }

            if (rows.Count >= 5)
            {
                return(rows);
            }

            foreach (WfExternalUser item in ExtrenalUsers.Take(5 - InternalRelativeUsers.Count))
            {
                HtmlTableRow  row  = new HtmlTableRow();
                HtmlTableCell cell = new HtmlTableCell();
                cell.Attributes["class"] = "userCell";

                HtmlTableCell userTitleCell = new HtmlTableCell();
                userTitleCell.InnerText           = item.Title;
                userTitleCell.Attributes["class"] = "userTitleCell";
                row.Controls.Add(userTitleCell);

                string interRelativeUserHTML = string.Empty;
                interRelativeUserHTML += item.Name;
                cell.InnerHtml         = interRelativeUserHTML;
                row.Controls.Add(cell);
                rows.Add(row);
            }

            return(rows);
        }
	    protected void showPresenceBtn_Click(object sender, EventArgs e)
		{
			usersPresenceContainer.Controls.Clear();
            HtmlGenericControl div = new HtmlGenericControl("div");
			foreach (IOguObject obj in userInput.SelectedOuUserData)
			{
				
				UserPresence presence = new UserPresence();   //初始化用户状态控件

				presence.UserID = obj.ID;   //所需要显示的用户ID
				presence.UserDisplayName = obj.DisplayName; //用户名称
                presence.StatusImage = StatusImageType.ShortBar;

				div.Controls.Add(presence);  //放入到显示区域
				
			}
            usersPresenceContainer.Controls.Add(div);
		}
        private string GetImageUrlByObjectType(IOguObject obj)
        {
            string result = ControlResources.OULogoUrl;

            SchemaType objType = obj.ObjectType;

            switch (objType)
            {
            case SchemaType.Organizations:
                result = ControlResources.OULogoUrl;

                if ((int)obj.Properties.GetValue("STATUS", 1) == 3)
                {
                    result = ControlResources.DisabledOULogoUrl;
                }
                break;

            case SchemaType.Users:
                result = this.EnableUserPresence ? UserPresence.GetDefaultStatusImageUrl() : ControlResources.UserLogoUrl;

                if ((int)obj.Properties.GetValue("STATUS", 1) == 3)
                {
                    result = ControlResources.DisabledUserLogoUrl;
                }

                break;

            case SchemaType.Groups:
                result = ControlResources.GroupLogoUrl;

                if ((int)obj.Properties.GetValue("STATUS", 1) == 3)
                {
                    result = ControlResources.DisabledGroupLogoUrl;
                }
                break;
            }

            return(result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HtmlGenericControl div = new HtmlGenericControl("div");

                UserPresence presence0 = new UserPresence(); //初始化用户状态控件

                presence0.UserID = OguMechanismFactory.GetMechanism().GetObjects<IUser>(SearchOUIDType.LogOnName, "changdm")[0].ID;// "22c3b351-a713-49f2-8f06-6b888a280fff";

                presence0.UserDisplayName = "常冬梅";

				//presence0.AccountDisabled=true;

                UserPresence presence = new UserPresence(); //初始化用户状态控件

                presence.UserID = "22c3b351-a713-49f2-8f06-6b888a280fff";
                presence.StatusImage = StatusImageType.ShortBar;
                presence.ShowUserIcon = true;
                presence.UserIconUrl = "cdm.png";
                presence.ShowUserDisplayName = true;
                presence.UserDisplayName = "常冬梅";
				presence.AccountDisabled = true;

                UserPresence presence1 = new UserPresence(); //初始化用户状态控件

                presence1.UserID = "22c3b351-a713-49f2-8f06-6b888a280fff";
                presence1.StatusImage = StatusImageType.LongBar;
                presence1.ShowUserIcon = true;
                presence1.UserIconUrl = "cdm.png";
                presence1.UserDisplayName = "cdm";
				presence1.AccountDisabled = true;

                div.Controls.Add(presence0);
                div.Controls.Add(presence);            
                div.Controls.Add(presence1);
                usersPresenceContainer.Controls.Add(div);
            }
        }
        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));
        }
		private void RenderOneOpinionWithPrecense(GenericOpinion opinion, string opText, Control container)
		{
			HtmlGenericControl opTextContainer = new HtmlGenericControl("div");

			opTextContainer.Attributes["class"] = "text";
			opTextContainer.InnerHtml = HttpUtility.HtmlEncode(opText).Replace("\r\n", "<br/>");
			container.Controls.Add(opTextContainer);

			HtmlGenericControl signName = new HtmlGenericControl("div");
			signName.Attributes["class"] = "signName";
			container.Controls.Add(signName);

			UserPresence presence = new UserPresence();

			if (OpinionListControlHelper.UserSignatures.ContainsKey(opinion.IssuePerson.ID))
			{
				HtmlImage sigImage = new HtmlImage();

				sigImage.Src = OpinionListControlHelper.UserSignatures[opinion.IssuePerson.ID];
				sigImage.Alt = opinion.IssuePerson.DisplayName;

				signName.Controls.Add(sigImage);

				presence.ShowUserDisplayName = false;
			}

			signName.Controls.Add(presence);

			presence.UserID = opinion.IssuePerson.ID;
			presence.UserDisplayName = opinion.IssuePerson.DisplayName;	//防止人员离职
			presence.EnsureInUserList();

			if (opinion.IssuePerson.ID != opinion.AppendPerson.ID)
			{
				HtmlGenericControl sp1 = new HtmlGenericControl("span");
				sp1.InnerText = "(";
				signName.Controls.Add(sp1);

				UserPresence presence2 = new UserPresence();
				signName.Controls.Add(presence2);
				presence2.UserID = opinion.AppendPerson.ID;
				presence2.UserDisplayName = opinion.AppendPerson.DisplayName;	//防止人员离职
				presence2.EnsureInUserList();

				HtmlGenericControl sp2 = new HtmlGenericControl("span");
				sp2.InnerText = string.Format(" {0})", Translator.Translate(Define.DefaultCulture, "代写"));
				signName.Controls.Add(sp2);
			}

			HtmlGenericControl dateContainer = new HtmlGenericControl("div");

			dateContainer.Attributes["class"] = "signDate";
			dateContainer.InnerText = opinion.AppendDatetime.ToString("yyyy-MM-dd HH:mm:ss");
			container.Controls.Add(dateContainer);
		}
Exemple #12
0
        private void RenderActivityUsers(IEnumerable <IUser> users, IWfMainStreamActivityDescriptor msActivity, Control container)
        {
            foreach (IUser user in users)
            {
                bool showUserInfo = false;

                if (TitleShowMode == UserTitleShowMode.ShowActivityNameAndTitle)
                {
                    showUserInfo = true;
                }
                else
                {
                    if (TitleShowMode == UserTitleShowMode.ShowUserTitleWhenActivityNameEmpty)
                    {
                        showUserInfo = string.IsNullOrEmpty(msActivity.Activity.Name);
                    }
                }

                if (showUserInfo)
                {
                    HtmlGenericControl userTitle = new HtmlGenericControl("div");

                    try
                    {
                        string titleText = string.Empty;

                        string deptName = string.Empty;

                        if ((TitleShowMode & UserTitleShowMode.ShowDepartmentName) != UserTitleShowMode.None)
                        {
                            deptName = GetUserDepartmentName(user);
                        }

                        if (string.IsNullOrEmpty(user.Occupation))
                        {
                            titleText = deptName;
                        }
                        else
                        {
                            titleText = deptName.IsNotEmpty() ? deptName + "/" + user.Occupation : user.Occupation;
                        }

                        userTitle.InnerText = titleText;

                        if ((int)user.Properties.GetValue("STATUS", 1) != 1)
                        {
                            userTitle.Attributes["title"] = string.Format("{0} {1}",
                                                                          titleText,
                                                                          Translator.Translate(Define.DefaultCulture, "帐号已注销") + ". " +
                                                                          Translator.Translate(Define.DefaultCulture, "请联系管理员调整流程"));
                        }
                        else
                        {
                            userTitle.Attributes["class"] = "opDept";
                        }
                    }
                    catch (System.Exception)
                    {
                        userTitle.Attributes["title"] = Translator.Translate(Define.DefaultCulture, "人员信息有误") + "." +
                                                        Translator.Translate(Define.DefaultCulture, "请联系管理员调整流程");
                    }

                    container.Controls.Add(userTitle);
                }

                HtmlGenericControl userName = new HtmlGenericControl("div");
                userName.Attributes["class"] = "opName";

                if (this.EnableUserPresence)
                {
                    UserPresence presence = new UserPresence();

                    presence.UserID          = user.ID;
                    presence.UserDisplayName = user.DisplayName;

                    userName.Controls.Add(presence);
                }
                else
                {
                    userName.InnerText = user.DisplayName;
                }

                container.Controls.Add(userName);
            }
        }
		private Control GetUserNameControl(IUser user)
		{
			HtmlGenericControl userName = new HtmlGenericControl("span");

			if (user != null)
			{
				if (EnableUserPresence)
				{
					UserPresence presence = new UserPresence();

					presence.UserID = user.ID;
					presence.UserDisplayName = user.DisplayName;

					userName.Controls.Add(presence);

					presence.EnsureInUserList();
				}
				else
					userName.InnerText = user.DisplayName;
			}

			return userName;
		}
		private void RenderActivityUsers(IEnumerable<IUser> users, IWfMainStreamActivityDescriptor msActivity, Control container)
		{
			foreach (IUser user in users)
			{
				bool showUserInfo = false;

				if (TitleShowMode == UserTitleShowMode.ShowActivityNameAndTitle)
					showUserInfo = true;
				else
				{
					if (TitleShowMode == UserTitleShowMode.ShowUserTitleWhenActivityNameEmpty)
						showUserInfo = string.IsNullOrEmpty(msActivity.Activity.Name);
				}

				if (showUserInfo)
				{
					HtmlGenericControl userTitle = new HtmlGenericControl("div");

					try
					{
						string titleText = string.Empty;

						string deptName = string.Empty;

						if ((TitleShowMode & UserTitleShowMode.ShowDepartmentName) != UserTitleShowMode.None)
							deptName = GetUserDepartmentName(user);

						if (string.IsNullOrEmpty(user.Occupation))
							titleText = deptName;
						else
							titleText = deptName.IsNotEmpty() ? deptName + "/" + user.Occupation : user.Occupation;

						userTitle.InnerText = titleText;

						if ((int)user.Properties.GetValue("STATUS", 1) != 1)
						{
							userTitle.Attributes["title"] = string.Format("{0} {1}",
								titleText,
								Translator.Translate(Define.DefaultCulture, "帐号已注销") + ". " +
								Translator.Translate(Define.DefaultCulture, "请联系管理员调整流程"));
						}
						else
						{
							userTitle.Attributes["class"] = "opDept";
						}
					}
					catch (System.Exception)
					{
						userTitle.Attributes["title"] = Translator.Translate(Define.DefaultCulture, "人员信息有误") + "." +
							Translator.Translate(Define.DefaultCulture, "请联系管理员调整流程");
					}

					container.Controls.Add(userTitle);
				}

				HtmlGenericControl userName = new HtmlGenericControl("div");
				userName.Attributes["class"] = "opName";

				if (this.EnableUserPresence)
				{
					UserPresence presence = new UserPresence();

					presence.UserID = user.ID;
					presence.UserDisplayName = user.DisplayName;

					userName.Controls.Add(presence);
				}
				else
					userName.InnerText = user.DisplayName;

				container.Controls.Add(userName);
			}
		}
        protected override List<HtmlTableRow> GetRelativeRows()
        {
            List<HtmlTableRow> rows = new List<HtmlTableRow>();
            foreach (WfUserResourceDescriptor item in InternalRelativeUsers)
            {
                HtmlTableRow row = new HtmlTableRow();
                HtmlTableCell cell = new HtmlTableCell();
                cell.Attributes["class"] = "userCell";

                UserPresence userPresence = new UserPresence();
                userPresence.UserID = item.User.ID;
                userPresence.UserDisplayName = item.User.DisplayName;

                cell.Controls.Add(userPresence);
                HtmlTableCell userTitleCell = new HtmlTableCell();
                userTitleCell.InnerText = item.User.Occupation;
                userTitleCell.Attributes["class"] = "userTitleCell";
                row.Controls.Add(userTitleCell);
                row.Controls.Add(cell);
                rows.Add(row);
            }

            if (rows.Count >= 5)
                return rows;

            foreach (WfExternalUser item in ExtrenalUsers.Take(5 - InternalRelativeUsers.Count))
            {
                HtmlTableRow row = new HtmlTableRow();
                HtmlTableCell cell = new HtmlTableCell();
                cell.Attributes["class"] = "userCell";

                HtmlTableCell userTitleCell = new HtmlTableCell();
                userTitleCell.InnerText = item.Title;
                userTitleCell.Attributes["class"] = "userTitleCell";
                row.Controls.Add(userTitleCell);

                string interRelativeUserHTML = string.Empty;
                interRelativeUserHTML += item.Name;
                cell.InnerHtml = interRelativeUserHTML;
                row.Controls.Add(cell);
                rows.Add(row);
            }

            return rows;
        }
		private void RenderCustomerService()
		{
			var users = CutomerServiceExecutiveSetting.GetConfig().CutomerServiceExecutiveQuery.QueryCutomerServiceExecutive(CustomerServiceCategory.Split(','));

			if (users.Any())
			{
				var divCustomerServiceControl = new HtmlGenericControl("div") { ID = "divCustomerService" };
				divCustomerServiceControl.Attributes["class"] = "muiFirst mui-msg";
				divCustomerServiceControl.Controls.Add(new HtmlGenericControl("div") { InnerText = "在线客服" });
				this.Controls.Add(divCustomerServiceControl);

				var divPanel = new HtmlGenericControl("div") { ID = divCustomerServiceControl.ID + "_panel" };
				divPanel.Attributes["class"] = "mui";
				divPanel.Style[HtmlTextWriterStyle.Display] = "none";
				divCustomerServiceControl.Controls.Add(divPanel);

				var divTitle = new HtmlGenericControl("div") { InnerText = "◆ 在线客服" };
				divTitle.Attributes["class"] = "mui-title";
				divPanel.Controls.Add(divTitle);

				var ul = new HtmlGenericControl("ul");
				ul.Attributes["class"] = "mui-content text-left ";
				divPanel.Controls.Add(ul);

				foreach (var u in users)
				{
					var li = new HtmlGenericControl("li");
					UserPresence presence = new UserPresence();

					presence.UserID = u.ID;
					presence.UserDisplayName = u.DisplayName;

					li.Controls.Add(presence);
					ul.Controls.Add(li);

					presence.EnsureInUserList();
				}
			}
		}