private void BindData() { VisiblePartnerGroups.Clear(); VisibleUnpartnerGroups.Clear(); VisiblePartnerGroups.Add(iCurGroupId); using (IDataReader reader = SecureGroup.GetListGroupsByPartner(iCurGroupId)) { while (reader.Read()) { int iGroupId = (int)reader["GroupId"]; if (SecureGroup.IsPartner(iGroupId)) VisiblePartnerGroups.Add(iGroupId); else VisibleUnpartnerGroups.Add(iGroupId); } } ClearUnpartnerGroups(); BinddgGroupsUsers(); }
private void BindData() { lblGroupTitle.Text = LocRM.GetString("GroupTitle"); if (edit == "1") { string gTitle = ""; PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; using (IDataReader rdr = SecureGroup.GetGroup(groupId)) { if (rdr.Read()) { gTitle = (string)rdr["GroupName"]; if (rdr["OrgUid"] != DBNull.Value) { orgUid = PrimaryKeyId.Parse(rdr["OrgUid"].ToString()); } if (rdr["ContactUid"] != DBNull.Value) { contactUid = PrimaryKeyId.Parse(rdr["ContactUid"].ToString()); } } } tbGroupTitle.Text = HttpUtility.HtmlDecode(gTitle); if (groupId == (int)InternalSecureGroups.Partner || SecureGroup.IsPartner(groupId)) { using (IDataReader reader = SecureGroup.GetListGroupsByPartner(groupId)) { while (reader.Read()) { lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString())); } } for (int i = 0; i < lbSelectedGroups.Items.Count; i++) { if (lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value) != null) { lbAvailableGroups.Items.Remove(lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value)); } iGroups.Value += lbSelectedGroups.Items[i].Value + ","; } if (orgUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = orgUid; } else if (contactUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = contactUid; } else { ClientControl.ObjectType = String.Empty; ClientControl.ObjectId = PrimaryKeyId.Empty; } } } }
public string GetJsonDataSource(string nodeId) { List <JsonTreeNode> nodes = new List <JsonTreeNode>(); int parentId; if (!int.TryParse(nodeId, out parentId) || parentId < 1) { parentId = 1; } if (Mediachase.IBN.Business.Security.IsUserInGroup(InternalSecureGroups.Partner) && (parentId == 1 || parentId == 6)) { int iCurGroupId = -1; ArrayList VisiblePartnerGroups = new ArrayList(); ArrayList VisibleUnpartnerGroups = new ArrayList(); using (IDataReader reader = Mediachase.IBN.Business.User.GetListSecureGroup(Mediachase.IBN.Business.Security.CurrentUser.UserID)) { if (reader.Read()) { iCurGroupId = (int)reader["GroupId"]; } } VisiblePartnerGroups.Clear(); VisibleUnpartnerGroups.Clear(); VisiblePartnerGroups.Add(iCurGroupId); using (IDataReader reader = SecureGroup.GetListGroupsByPartner(iCurGroupId)) { while (reader.Read()) { int iGroupId = (int)reader["GroupId"]; if (SecureGroup.IsPartner(iGroupId)) { VisiblePartnerGroups.Add(iGroupId); } else { VisibleUnpartnerGroups.Add(iGroupId); } } } ClearUnpartnerGroups(VisibleUnpartnerGroups); if (VisibleUnpartnerGroups.Contains(1)) { return(BindOrdinaryTree(parentId)); } ArrayList children = new ArrayList(); if (parentId == 1) { children.AddRange(VisibleUnpartnerGroups); children.Add(6); } else if (parentId == 6) { children.AddRange(VisiblePartnerGroups); } children.Sort(); foreach (int iGroupId in children) { JsonTreeNode node = new JsonTreeNode(); node.icon = "../../../Layouts/Images/icons/regular.gif"; if (iGroupId < 9 && iGroupId != 6) { node.icon = "../../../Layouts/Images/icons/Admins.gif"; } if (SecureGroup.IsPartner(iGroupId) || iGroupId == 6) { node.icon = "../../../Layouts/Images/icons/Partners.gif"; } node.iconCls = "iconStdCls"; using (IDataReader rdr = SecureGroup.GetGroup(iGroupId)) { if (rdr.Read()) { node.text = CHelper.GetResFileString(rdr["GroupName"].ToString()); } } node.cls = "nodeCls"; node.href = "../../../Directory/Directory.aspx?Tab=0&SGroupID=" + iGroupId.ToString(); node.hrefTarget = "right"; node.id = Guid.NewGuid().ToString("N"); node.itemid = iGroupId.ToString(); node.staticParentId = _rootId; node.leaf = true; if (iGroupId == 6) { node.leaf = false; } else { using (IDataReader rdr = SecureGroup.GetListChildGroups(iGroupId)) { if (rdr.Read()) { node.leaf = false; } } } nodes.Add(node); } } else { return(BindOrdinaryTree(parentId)); } if (nodes.Count > 0) { return(UtilHelper.JsonSerialize(nodes)); } else { return(String.Empty); } }