private void Common_ListView_LoadHeader(ref ListView listview, bool isMember) { IAzManStoreGroupMember[] members = isMember ? _StoreGroup.GetStoreGroupMembers() : _StoreGroup.GetStoreGroupNonMembers(); listview.Items.Clear(); var ln = 1; foreach (IAzManStoreGroupMember member in members) { String displayName = String.Empty; MemberType memberType = MemberType.AnonymousSID; memberType = member.GetMemberInfo(out displayName); if (member.IsMember == isMember) { ListViewItem oItem = listview.Items.Add(displayName); oItem.SubItems.Add(NetSqlAzManHelper.GetWhereDefinedName(member.WhereDefined)); oItem.SubItems.Add(member.SID.ToString()); } if (isMember) { _Members.Add(member); } else { _NonMembers.Add(member); } } listview.Sort(); }
private void LoadRecord() { string displayName; var item = _AuthItem.GetAuthorization(_AuthorizationID); MemberType memberType = item.GetMemberInfo(out displayName); var authType = NetSqlAzManHelper.GetAuthTypeName(item.AuthorizationType); txtMemberType.Text = NetSqlAzManHelper.GetMemberTypeName(memberType, item.SID, _AuthItem); txtName.Text = displayName; txtWhereDefined.Text = item.SidWhereDefined.ToString(); txtOwner.Text = item.Owner.ToString(); for (int i = 0; i < cboAuthType.Items.Count; i++) { var keypair = ((KeyValuePair <int, String>)cboAuthType.Items[i]); if (keypair.Value == authType.ToString()) { cboAuthType.SelectedItem = cboAuthType.Items[i]; } } if (item.ValidFrom != null) { datValidFrom.Checked = true; datValidFrom.Value = (DateTime)item.ValidFrom; } if (item.ValidTo != null) { datValidTo.Checked = true; datValidTo.Value = (DateTime)item.ValidTo; } }
private void AddAuthDataRow(IAzManAuthorization authorization) { DataRow dr = _AuthData.NewRow(); dr["AuthorizationID"] = authorization.AuthorizationId; dr["AttributesLink"] = ""; // this.getAttributesLink((int)dr["AuthorizationID"]); string displayName; MemberType memberType = authorization.GetMemberInfo(out displayName); string ownerName; MemberType ownerType = authorization.GetOwnerInfo(out ownerName); dr["MemberType"] = NetSqlAzManHelper.GetMemberTypeName(memberType, authorization.SID, _AuthItem); dr["MemberTypeEnum"] = memberType; dr["Owner"] = ownerName; dr["Name"] = displayName; dr["OwnerSID"] = authorization.Owner; if (authorization.SidWhereDefined == WhereDefined.Database) { dr["ObjectSID"] = authorization.SID.StringValue; } else { dr["ObjectSID"] = authorization.SID.StringValue; } switch (authorization.SidWhereDefined.ToString()) { case "LDAP": dr["WhereDefined"] = "Active Directory"; break; case "Local": dr["WhereDefined"] = "Local"; break; case "Database": dr["WhereDefined"] = "DB User"; break; case "Store": dr["WhereDefined"] = "Store"; break; case "Application": dr["WhereDefined"] = "Application"; break; } dr["WhereDefinedEnum"] = authorization.SidWhereDefined; dr["AuthorizationType"] = NetSqlAzManHelper.GetAuthTypeName(authorization.AuthorizationType); dr["AuthorizationTypeEnum"] = authorization.AuthorizationType; dr["ValidFrom"] = authorization.ValidFrom.HasValue ? (object)authorization.ValidFrom.Value : DBNull.Value; dr["ValidTo"] = authorization.ValidTo.HasValue ? (object)authorization.ValidTo.Value : DBNull.Value; _AuthData.Rows.Add(dr); }
private void LoadList() { lvwAuth.Items.Clear(); IAzManAuthorization[] authorizations = _AuthItem.GetAuthorizations(); foreach (IAzManAuthorization authorization in authorizations) { string displayName; MemberType memberType = authorization.GetMemberInfo(out displayName); string ownerName; MemberType ownerType = authorization.GetOwnerInfo(out ownerName); ListViewItem oItem = lvwAuth.Items.Add(NetSqlAzManHelper.GetMemberTypeName(memberType, authorization.SID, _AuthItem)); oItem.SubItems.Add(displayName); oItem.SubItems.Add(NetSqlAzManHelper.GetAuthTypeName(authorization.AuthorizationType)); oItem.SubItems.Add(authorization.SidWhereDefined.ToString()); oItem.SubItems.Add(ownerName); oItem.SubItems.Add(authorization.ValidFrom.HasValue ? authorization.ValidFrom.Value.ToString("yyyy-MM-dd") : ""); oItem.SubItems.Add(authorization.ValidTo.HasValue ? authorization.ValidTo.Value.ToString("yyyy-MM-dd") : ""); oItem.SubItems.Add(authorization.AuthorizationId.ToString()); } lvwAuth.Sort(); }
private void LoadListView(ref TreeNode node) { TreeNode p = node.Parent; TreeNode pp = p == null ? null : p.Parent; TreeNode ppp = pp == null ? null : pp.Parent; TreeNode pppp = ppp == null ? null : ppp.Parent; var tag = (AzManItemType)node.Tag; switch (tag) { case AzManItemType.Storage: #region Storage SelectedObject = Storage; var storageList = new ListViews.Storage(); storageList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(storageList); break; #endregion case AzManItemType.Store: #region Store SelectedObject = Storage[NetSqlAzManHelper.getName(node.Label.Trim(), 0)]; var storeList = new ListViews.Store(); storeList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(storeList); break; #endregion case AzManItemType.StoreGroups: #region Store Groups SelectedObject = Storage[NetSqlAzManHelper.getName(p.Label.Trim(), 0)]; var storeGroupsList = new ListViews.StoreGroups(); storeGroupsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(storeGroupsList); break; #endregion case AzManItemType.StoreGroup: #region Store Group, ignor LDAP SelectedObject = Storage[NetSqlAzManHelper.getName(pp.Label, 0)].GetStoreGroup(node.Label.Trim()); var storeGroupList = new ListViews.StoreGroup(); storeGroupList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(storeGroupList); break; #endregion case AzManItemType.Application: #region Application SelectedObject = Storage[NetSqlAzManHelper.getName(p.Label, 0)][NetSqlAzManHelper.getName(node.Label.Trim(), 0)]; var applicationist = new ListViews.Application(); applicationist.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(applicationist); break; #endregion case AzManItemType.ApplicationGroup: #region Application Group SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)].GetApplicationGroup(node.Label.Trim()); var appGroupList = new ListViews.ApplicationGroup(); appGroupList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(appGroupList); break; #endregion case AzManItemType.ApplicationGroups: #region Application Groups SelectedObject = Storage[NetSqlAzManHelper.getName(pp.Label.Trim(), 0)][NetSqlAzManHelper.getName(p.Label.Trim(), 0)]; var appGroupsList = new ListViews.ApplicationGroups(); appGroupsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(appGroupsList); break; #endregion case AzManItemType.ItemDefinitions: #region Item Definitions SelectedObject = Storage[NetSqlAzManHelper.getName(pp.Label.Trim(), 0)][NetSqlAzManHelper.getName(p.Label.Trim(), 0)]; var ItemDefinitionsList = new ListViews.ItemDefinitions(); ItemDefinitionsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(ItemDefinitionsList); break; #endregion case AzManItemType.ItemAuthorizations: #region Item Authorizations SelectedObject = Storage[NetSqlAzManHelper.getName(pp.Label.Trim(), 0)][NetSqlAzManHelper.getName(p.Label.Trim(), 0)]; var ItemAuthorizationsList = new ListViews.ItemAuthorizations(); ItemAuthorizationsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(ItemAuthorizationsList); break; #endregion case AzManItemType.RoleAuthorization: #region Role Definition SelectedObject = Storage[NetSqlAzManHelper.getName(pppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][node.Label.Trim()]; var roleAuthorizationList = new ListViews.RoleAuthorization(); roleAuthorizationList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(roleAuthorizationList); break; #endregion case AzManItemType.RoleAuthorizations: #region Role Authorizations SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)]; var roleAuthorizationsList = new ListViews.RoleAuthorizations(); roleAuthorizationsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(roleAuthorizationsList); break; #endregion case AzManItemType.RoleDefinition: #region Role Definition SelectedObject = Storage[NetSqlAzManHelper.getName(pppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][node.Label.Trim()]; var roleDefinitionList = new ListViews.RoleDefinition(); roleDefinitionList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(roleDefinitionList); break; #endregion case AzManItemType.RoleDefinitions: #region Role Definitions SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)]; var roleDefinitionsList = new ListViews.RoleDefinitions(); roleDefinitionsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(roleDefinitionsList); break; #endregion case AzManItemType.TaskAuthorization: #region Task Authorization SelectedObject = Storage[NetSqlAzManHelper.getName(pppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][node.Label.Trim()]; var taskAuthorizationList = new ListViews.TaskAuthorization(); taskAuthorizationList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(taskAuthorizationList); break; #endregion case AzManItemType.TaskAuthorizations: #region Task Authorizations SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)]; var taskAuthorizationsList = new ListViews.TaskAuthorizations(); taskAuthorizationsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(taskAuthorizationsList); break; #endregion case AzManItemType.TaskDefinition: #region Task Definition SelectedObject = Storage[NetSqlAzManHelper.getName(pppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][node.Label.Trim()]; var taskDefinitionList = new ListViews.TaskDefinition(); taskDefinitionList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(taskDefinitionList); break; #endregion case AzManItemType.TaskDefinitions: #region Task Definitions SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)]; var taskDefinitionsList = new ListViews.TaskDefinitions(); taskDefinitionsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(taskDefinitionsList); break; #endregion case AzManItemType.OperationAuthorization: #region Operation Authorization SelectedObject = Storage[NetSqlAzManHelper.getName(pppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][node.Label.Trim()]; var operationAuthorizationList = new ListViews.OperationAuthorization(); operationAuthorizationList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(operationAuthorizationList); break; #endregion case AzManItemType.OperationAuthorizations: #region Operation Authorizations SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)]; var operationAuthorizationsList = new ListViews.OperationAuthorizations(); operationAuthorizationsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(operationAuthorizationsList); break; #endregion case AzManItemType.OperationDefinition: #region Operation Definition SelectedObject = Storage[NetSqlAzManHelper.getName(pppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][node.Label.Trim()]; var operationDefinitionList = new ListViews.OperationDefinition(); operationDefinitionList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(operationDefinitionList); break; #endregion case AzManItemType.OperationDefinitions: #region Operation Definitions SelectedObject = Storage[NetSqlAzManHelper.getName(ppp.Label.Trim(), 0)][NetSqlAzManHelper.getName(pp.Label.Trim(), 0)]; var operationDefinitionsList = new ListViews.OperationDefinitions(); operationDefinitionsList.Dock = DockStyle.Fill; pnlRight.Controls.Clear(); pnlRight.Controls.Add(operationDefinitionsList); break; #endregion } }