public frmStoreGroupsProperties()
 {
     InitializeComponent();
     this.firstShow = true;
     this.MembersToAdd = new GenericMemberCollection();
     this.MembersToRemove = new GenericMemberCollection();
     this.NonMembersToAdd = new GenericMemberCollection();
     this.NonMembersToRemove = new GenericMemberCollection();
 }
 private bool FindMember(GenericMemberCollection members, IAzManSid sid)
 {
     foreach (GenericMember m in members)
     {
         if (m.sid.StringValue == sid.StringValue)
             return true;
     }
     return false;
 }
 private bool FindMember(GenericMemberCollection members, string objectSid)
 {
     foreach (GenericMember m in members)
     {
         if (m.sid.StringValue == objectSid)
             return true;
     }
     return false;
 }
 private bool FindMember(GenericMemberCollection members, string name)
 {
     foreach (GenericMember m in members)
     {
         if (m.Name == name)
             return true;
     }
     return false;
 }
 private void loadSessionVariables()
 {
     this.lsvMembers = this.Session["lsvMembers"] as ListView;
     this.lsvNonMembers = this.Session["lsvNonMembers"] as ListView;
     this.MembersToAdd = this.Session["MembersToAdd"] as GenericMemberCollection;
     this.MembersToRemove = this.Session["MembersToRemove"] as GenericMemberCollection;
     this.NonMembersToAdd = this.Session["NonMembersToAdd"] as GenericMemberCollection;
     this.NonMembersToRemove = this.Session["NonMembersToRemove"] as GenericMemberCollection;
     this.modified = (bool)this.Session["modified"];
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.storage = this.Session["storage"] as IAzManStorage;
            if (this.Session["selectedObject"] as IAzManStore != null)
            {
                this.store = this.Session["selectedObject"] as IAzManStore;
            }
            if (this.Session["selectedObject"] as IAzManStoreGroup != null)
            {
                this.storeGroup = this.Session["selectedObject"] as IAzManStoreGroup;
                this.Session["storeGroup"] = this.storeGroup;
                this.Session["store"] = this.storeGroup.Store;
            }
            this.Text = "Store Group properties" + (this.storeGroup != null ? ": " + this.storeGroup.Name : String.Empty);
            this.Description = "Store Group properties";
            this.Title = this.Text;
            if (!Page.IsPostBack)
            {
                this.MembersToAdd = new GenericMemberCollection();
                this.MembersToRemove = new GenericMemberCollection();
                this.NonMembersToAdd = new GenericMemberCollection();
                this.NonMembersToRemove = new GenericMemberCollection();
                this.lsvMembers = new ListView();
                this.lsvNonMembers = new ListView();
                this.mnuTab.Items[1].Selected = true; //0 is blank
                this.mnuTab_MenuItemClick(this, new System.Web.UI.WebControls.MenuEventArgs(this.mnuTab.Items[1]));
                this.txtName.Text = this.storeGroup.Name;
                this.txtDescription.Text = this.storeGroup.Description;
                this.txtGroupType.Text = (this.storeGroup.GroupType == GroupType.Basic ? "Basic group" : "LDAP Query group");

                if (this.storeGroup.GroupType == GroupType.Basic)
                {
                    this.btnMembersAddStoreGroup.Enabled = this.btnNonMembersAddStoreGroup.Enabled = this.storeGroup.Store.HasStoreGroups();
                    this.mnuTab.Items.RemoveAt(3);
                    this.mnuTab.Items.RemoveAt(2);
                    this.lsvMembers.Items.Clear();
                    this.lsvNonMembers.Items.Clear();
                    this.setImage("StoreApplicationGroup_32x32.gif");
                }
                else
                {

                    this.mnuTab.Items.RemoveAt(7);
                    this.mnuTab.Items.RemoveAt(6);
                    this.mnuTab.Items.RemoveAt(5);
                    this.mnuTab.Items.RemoveAt(4);
                    this.setImage("WindowsQueryLDAPGroup_32x32.gif");
                }
                this.RefreshStoreGroupProperties();
                this.saveSessionVariables();
                this.modified = false;
                this.txtName.Focus();
            }
            else
            {
                this.loadSessionVariables();
                if (this.Session["selectedStoreGroups"] != null)
                {
                    if (this.mnuTab.SelectedValue == "Members")
                        this.btnMembersAddStoreGroups_Click(this, EventArgs.Empty);
                    else if (this.mnuTab.SelectedValue == "Non Members")
                        this.btnNonMembersAddStoreGroup_Click(this, EventArgs.Empty);
                }
                if (this.Session["selectedDBUsers"] != null)
                {
                    if (this.mnuTab.SelectedValue == "Members")
                        this.btnMembersAddDBUsers_Click(this, EventArgs.Empty);
                    else if (this.mnuTab.SelectedValue == "Non Members")
                        this.btnNonMembersAddDBUsers_Click(this, EventArgs.Empty);
                }
                if (this.Session["selectedADObjects"] != null)
                {
                    if (this.mnuTab.SelectedValue == "Members")
                        this.btnMembersAddWindowsUsersAndGroups_Click(this, EventArgs.Empty);
                    else if (this.mnuTab.SelectedValue == "Non Members")
                        this.btnNonMembersAddWindowsUsersAndGroup_Click(this, EventArgs.Empty);
                }
            }
        }