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 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(); } } }
public IEnumerable<IUser> QueryCutomerServiceExecutive(params string[] categories) { var result = new List<IUser>(); if (categories.Any()) { var executives = CutomerServiceExecutiveSetting.GetConfig() .CutomerServiceExecutives.Cast<CutomerServiceExecutiveElement>() .Where(q => categories.Contains(q.Category)); if (executives.Any()) { var logOnNames = executives.Select(r => r.LogOnName).ToArray(); result = OguMechanismFactory.GetMechanism() .GetObjects<IUser>(SearchOUIDType.LogOnName, logOnNames) .Distinct((x, y) => string.Compare(x.ID, y.ID, true) == 0) .ToList(); } } return result; }