private void ShowDisplay(int Display) { Close_Dialog = false; ListViewItem LV = new ListViewItem(); // EnableLV = false; OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); g_treeView1_View = Display; switch(Display) { case ShowGroupInfo: // IsCreating = false; pnlCameraInfo.Visible = false; pnlGroupInfo.Visible = true; pnlUserInfo.Visible = false; pnlRecordingInfo.Visible = false; tbGroupDescription.Text = ""; pnlGroupInfo.Enabled = true; //Disable controls tbGroupDescription.ReadOnly = true; cbGroupOwner.Visible = false; tbGroupOwner.Visible = true; tbGroupOwner.ReadOnly = true; lbGroupOwner.Visible = true; lbGroupDescription.ForeColor = Color.Black; if(g_objSection == null) break; string test= ""; lstvMembersOfGroup.Items.Clear(); OysterClassLibrary.SectionType ThisUT = F.GetSectionType(g_objSection.CreatedBySectionType.NextSectionTypeID); OysterClassLibrary.User Owner; Owner = F.GetUser(g_objSection.OwnerID); if(g_objSection.CreatedBySectionType.ID == OSystem.SectionTypeSysAdmin.ID) { lbGroupLabel.Text = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + ": " + g_objSection.Description; lbGroupOwner.Text = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription; test = ThisUT.Description; test = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription; tbGroupDescription.Text = g_objSection.Description; lbGroupOwner.Visible = false; tbGroupOwner.Visible = false; cbGroupOwner.Visible = false; lbGroupDescription.Text = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; lbMembersOfGroup.Text = "Members of " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription ; } else if((g_objSection.IsRoot != false)&&(g_objSection.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.NextSectionTypeID)) { lbGroupLabel.Text = "Viewing: " + g_objSection.Description; tbGroupDescription.Text = g_objSection.Description; lbGroupOwner.Text = g_objSection.CreatedBySectionType.Description; test = g_objSection.CreatedBySectionType.Description; lbGroupDescription.Text = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription+ " Name"; lbMembersOfGroup.Text = "Members of " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription; } else if(g_objSection.IsRoot == false) { lbGroupLabel.Text = "Viewing: " + g_objSection.Description; lbGroupOwner.Text = g_objSection.CreatedBySectionType.Description; tbGroupDescription.Text = g_objSection.Description; test = g_objSection.CreatedBySectionType.Description; OysterClassLibrary.Section RootBody = F.GetRootSection(g_objSection.ID); string testme = RootBody.CreatedBySectionType.CreatesSectionTypeDescription; lbGroupDescription.Text = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; lbMembersOfGroup.Text = "Members of " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription; } else { lbGroupLabel.Text = "Viewing: " + g_objSection.Description; tbGroupDescription.Text = g_objSection.Description; lbGroupDescription.Text = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; lbMembersOfGroup.Text = "Members of " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription; OysterClassLibrary.SectionType UT = F.GetSectionType(g_objSection.CreatedBySectionType.NextSectionTypeID); lbGroupOwner.Text = g_objSection.CreatedBySectionType.Description; } cbGroupOwner.Items.Clear(); cbGroupOwner.Items.Add(Owner.Description); cbGroupOwner.Text = Owner.Description; tbGroupOwner.Text = Owner.Description; tbGroupOwner.BringToFront(); foreach(OysterClassLibrary.User UU in g_objSection.AllUsersInHierarchy) { ListViewItem LVB = lstvMembersOfGroup.Items.Add(UU.LastName); LVB.SubItems.Add(UU.FirstName); LVB.SubItems.Add(UU.MiddleName); LVB.Tag = UU; } pnlGroupInfo.Refresh(); break; case ShowUserInfo: //IsCreating = false; pnlCameraInfo.Visible = false; pnlGroupInfo.Visible = false; pnlUserInfo.Visible = true; pnlRecordingInfo.Visible = false; //Disable Controls tbLoginName.ReadOnly = true; tbFirstName.ReadOnly =true; tbMiddleName.ReadOnly = true; tbLastName.ReadOnly = true; tbPassword.ReadOnly = true; tbCardNumber.ReadOnly = true; lbLoginName.ForeColor = System.Drawing.Color.Black; lbFirstName.ForeColor = System.Drawing.Color.Black; lbMiddleName.ForeColor = System.Drawing.Color.Black; lbLastName.ForeColor = System.Drawing.Color.Black; lbPassword.ForeColor = System.Drawing.Color.Black; lbCardNumber.ForeColor = System.Drawing.Color.Black; lvMemberGroup.Items.Clear(); if(g_objUser == null) { break; } lbUserInfo.Text = "Viewing User: "******""; tbLastName.Text = ""; tbMiddleName.Text = ""; tbCardNumber.Text = ""; tbPassword.Text = ""; tbFirstName.Text = ""; return; } else { tbLoginName.Text = g_objUser.LoginName; tbLastName.Text = g_objUser.LastName; tbMiddleName.Text = g_objUser.MiddleName; tbCardNumber.Text = "*******************"; //g_objUser.CardNumber; tbPassword.Text = "*******************";//g_objUser.Password; tbFirstName.Text = g_objUser.FirstName; } string testinfo = ""; OysterClassLibrary.Sections MembersOf = g_objUser.AllMemberSections; //F.GetMemberSections(g_objUser.ID,false); foreach(OysterClassLibrary.Section Member in MembersOf) { string tester = Member.Description; int testcount = MembersOf.Count; OysterClassLibrary.User OwnerUser; OwnerUser = F.GetUser(Member.OwnerID); tester = Member.IsRoot.ToString(); tester = Member.CreatedBySectionType.ID.ToString(); tester = OSystem.SectionTypeSysAdmin.ID.ToString(); if((Member.IsRoot == true)&&(Member.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.ID)&&(Member.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.NextSectionTypeID)) { tester = Member.CreatedBySectionType.CreatesSectionTypeDescription; //clmBodyName.Text = tester + " Name"; LV = lvMemberGroup.Items.Add(Member.Description); OysterClassLibrary.SectionType UT = F.GetSectionType(Member.CreatedBySectionType.NextSectionTypeID); LV.SubItems.Add(tester); LV.Tag = Member; tester = Member.Description; testcount = MembersOf.Count; } else if(Member.IsRoot == false) { OysterClassLibrary.SectionType nUT = F.GetSectionType(Member.CreatedBySectionType.NextSectionTypeID); OysterClassLibrary.Section RootSection = F.GetRootSection(Member.ID); if(RootSection != null) { //clmBodyName.Text = RootSection.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; tester = RootSection.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; } else { //clmBodyName.Text = Member.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; tester = Member.CreatedBySectionType.CreatesSectionTypeDescription + " Name"; } testinfo = nUT.Description; testinfo = Member.CreatedBySectionType.Description; LV = lvMemberGroup.Items.Add(Member.Description); LV.SubItems.Add(tester); LV.Tag = Member; tester = Member.Description; testcount = MembersOf.Count; } else { if(Member.CreatedBySectionType.PreviousSectionTypeID != -99) { tester = Member.CreatedBySectionType.CreatesSectionTypeDescription; OysterClassLibrary.SectionType nUT = F.GetSectionType(OSystem.SectionTypeSysAdmin.NextSectionTypeID); //clmOwnerName.Text = nUT.Description; //clmBodyName.Text = tester + " Name"; LV= lvMemberGroup.Items.Add(Member.Description); LV.SubItems.Add(tester); LV.Tag = Member; tester = Member.Description; tester = Member.CreatedBySectionType.Description; tester = nUT.Description; testcount = MembersOf.Count; } } } lbFirstName.ForeColor = System.Drawing.Color.Black; lbLastName.ForeColor = System.Drawing.Color.Black; pnlUserInfo.Refresh(); break; case ShowCameraInfo: pnlGroupInfo.Visible = false; pnlUserInfo.Visible = false; pnlRecordingInfo.Visible = false; //MediaPlayer.Visible = false; pnlMediaPlayer.Visible =false; pnlCameraInfo.Visible = true; if(g_objRecording == null) break; break; case ShowRecordingInfo: pnlCameraInfo.Visible = false; pnlGroupInfo.Visible = false; pnlUserInfo.Visible = false; pnlRecordingInfo.Visible = true; //MediaPlayer.Visible = true; pnlMediaPlayer.Visible =true; if(g_objRecording == null) break; lbRecordingInfo.Text = "Viewing Recording: " + g_objRecording.DisplayName; btnPlay.Visible =true; btnPause.Visible = true; btnStop.Visible = true; btnForward.Visible =true; btnReverse.Visible = true; btnGoTo.Visible = true; tbHR.Visible = true; tbMin.Visible = true; tbSec.Visible = true; lbc1.Visible = true; lbc2.Visible = true; btnPlay.Enabled = true; btnPause.Enabled = false; btnStop.Enabled = false; btnReverse.Enabled = false; btnForward.Enabled = false; btnGoTo.Enabled = false; tbHR.Enabled = false; tbMin.Enabled = false; tbSec.Enabled = false; break; case ShowSystemInfo: pnlCameraInfo.Visible = false; pnlRecordingInfo.Visible = false; break; } F.Dispose(); }
public void BuildUserHierarchy() { treeView1.BeginUpdate(); treeView1.SuspendLayout(); System.GC.Collect(); OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); TNCount = 0; GetTotalNodes(treeView1.Nodes); TempNodes = new String[TNCount]; TNCount = 0; BackupExpandedNodes(treeView1.Nodes); ExpandedNodes = new String[TNCount]; for(int i = 0; i < TNCount;i++) { ExpandedNodes[i] = TempNodes[i]; } treeView1.Nodes.Clear(); // TreeNode Root = treeView1.Nodes.Add(cvosUser.Description); TreeNode Root = treeView1.Nodes.Add(LoginUser.Description); // Root.Tag = cvosUser; //Root.Tag = LoginUser; Root.Tag = "TopofPack"; Root.ImageIndex = 0; Root.SelectedImageIndex = 0; Root.Expand(); Root.NodeFont = new Font("Arial",10,FontStyle.Regular); int MUTCounter = 0; // foreach(OysterClassLibrary.Section B in cvosUser.Bodys) // MUTCounter = OSystem.CurrentSectionTypes.Count; // OysterClassLibrary.SectionType nUT = OSystem.SectionTypeSysAdmin; // OysterClassLibrary.SectionType LastType = null; MUTCounter = OSystem.CurrentSectionTypes.Count; OysterClassLibrary.SectionType nUT = OSystem.SectionTypeSysAdmin; OysterClassLibrary.SectionType LastType = null; string test = nUT.Description; bool listonce = false; TreeNode Label = new TreeNode(); while( MUTCounter > 0) { listonce = false; //foreach(OysterClassLibrary.Section B in cvosUser.Bodys) foreach(OysterClassLibrary.Section B in LoginUser.AllOwnedSections) { if(B.IsDefault == false) { if(B.CreatedBySectionTypeID == nUT.ID) { if(listonce == false) { if(LastType == null) LastType = OSystem.SectionTypeSysAdmin; if(LastType.NextSectionTypeID != 99) { Label = Root.Nodes.Add(nUT.Description); Label.ImageIndex = 8; Label.SelectedImageIndex = 8; Label.Tag = nUT; //MainSystemSection = B; test = nUT.Description; } else { test = B.Description; test = LastType.Description; goto Finished_Recursive; // Students don't have bodies so } // Label.Tag = LastType; listonce = true; } test = B.Description; test = LastType.Description; CurrentSectionType = LastType; //if(B.IsDefault == false) //{ RecursiveDisplay(B,ref Label,LastType); // } } } } LastType = nUT; if(nUT.NextSectionTypeID != -99) nUT = nUT.NextSectionType; //nUT = F.GetSectionType(nUT.NextSectionTypeID); else goto Finished_Recursive; test = nUT.Description; MUTCounter -= 1; } Finished_Recursive:{} foreach(OysterClassLibrary.Section B in LoginUser.AllOwnedSections) { OysterClassLibrary.Recordings AR = F.ALLRecordings(B.ID); if((B.IsDefault == true)&&(AR.Count > 0)) { TreeNode NodeX = new TreeNode(); if(OSystem.SectionTypeSysAdmin.ID == LoginUser.HighestAuthorityLevel.ID) { NodeX = Root.Nodes.Add("Recordings"); // NodeX.Tag = OSystem.SectionTypeSysAdmin; NodeX.Tag = LoginUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.DarkBlue; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; } else { NodeX = Root.Nodes.Add("Unassigned Recordings"); // NodeX.Tag = HighestSectionType; NodeX.Tag = LoginUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.Brown; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; } ListView lvSessions = new ListView(); //foreach(OysterClassLibrary.Recording R in B.Recordings) foreach(OysterClassLibrary.Recording R in AR) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LCI = lvSessions.Items.Add(R.SessionName); LCI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(ListViewItem LVI in lvSessions.Items) { NodeSessions[SessionCount] = NodeX.Nodes.Add(LVI.Text); NodeSessions[SessionCount].Tag = LVI.Tag; NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; SessionCount++; } //foreach(OysterClassLibrary.Recording DrawRecording in B.Recordings) foreach(OysterClassLibrary.Recording DrawRecording in AR) { // if(DrawRecording.DisplayName == null) // DrawRecording.DisplayName = DrawRecording.Created.ToString(); TreeNode NodeRecording = new TreeNode(); if(DrawRecording.SessionID == "") { NodeRecording = NodeX.Nodes.Add(DrawRecording.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(DrawRecording.SessionName == NodeSessions[a].Text) NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); } } //DrawRecording.Se = B.ID; if(DrawRecording.IsReady) { NodeRecording.Tag = DrawRecording; } else { NodeRecording.ForeColor = System.Drawing.Color.Gray; } NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); if(g_SelectedAnItem == false) { g_SelectedAnItem = true; treeView1.SelectedNode = NodeRecording; NodeRecording.EnsureVisible(); MouseEventArgs A = new MouseEventArgs(MouseButtons.Left,1,1,1,0); treeView1_MouseUp(treeView1,A); } if(OpenToRecording == DrawRecording.ID) { // NodeRecording.EnsureVisible(); treeView1.SelectedNode = NodeRecording; // g_objRecording = DrawRecording; g_objRecording = DrawRecording; } } } } //This Section Displays this LoginUser's Member Sections if(LoginUser.HighestAuthorityLevel.ID != OSystem.SectionTypeSysAdmin.ID) { OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections; // F.GetMemberSections(LoginUser.ID,false); TreeNode Members = new TreeNode(); if(MembersOf.Count > 0) { Members = Root.Nodes.Add("My Recordings"); Members.ForeColor = System.Drawing.Color.Green; //Members.NodeFont = new Font("Arial",10,FontStyle.Bold); Members.ImageIndex = 7; Members.SelectedImageIndex = 7; int Counter2 = OSystem.CurrentSectionTypes.Count; OysterClassLibrary.SectionType nUT2 = OSystem.SectionTypeSysAdmin; test = nUT2.Description; listonce = false; Label = new TreeNode(); TreeNode NodeMember = new TreeNode(); while( Counter2 > 0) { listonce = false; foreach(OysterClassLibrary.Section M in MembersOf) { test = M.CreatedBySectionType.Description; test = nUT2.Description; if(M.CreatedBySectionType.ID == nUT2.ID) { if(listonce == false) { OysterClassLibrary.SectionType LabelSectionType = F.GetSectionType(nUT2.NextSectionTypeID); Label = Members.Nodes.Add(LabelSectionType.Description); Label.Tag = LabelSectionType; string whatistheusertype = LabelSectionType.Description; listonce = true; } NodeMember = new TreeNode(); NodeMember = Label.Nodes.Add(M.Description); NodeMember.Tag = M; // NodeMember.NodeFont = new Font("Arial",10,FontStyle.Bold); NodeMember.ForeColor = System.Drawing.Color.DarkSlateBlue; NodeMember.ImageIndex = 1; NodeMember.SelectedImageIndex = 1; bool DrawOnce = false; if(M.CurrentRecordings.Count > 0) { TreeNode NodeRecs = new TreeNode(); ListView lvSessions = new ListView(); foreach(OysterClassLibrary.Recording R in M.CurrentRecordings) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LCI = lvSessions.Items.Add(R.SessionName); LCI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(OysterClassLibrary.Recording R in M.CurrentRecordings) { if(R.CurrentUserID == LoginUser.ID) if(DrawOnce == false) { NodeRecs = NodeMember.Nodes.Add("Recordings"); NodeRecs.ForeColor = Color.SlateBlue; NodeRecs.ImageIndex = 6; NodeRecs.SelectedImageIndex = 6; foreach(ListViewItem LVI in lvSessions.Items) { NodeSessions[SessionCount] = NodeRecs.Nodes.Add(LVI.Text); NodeSessions[SessionCount].Tag = LVI.Tag; NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; SessionCount++; } DrawOnce = true; } // if(R.DisplayName == null) // R.DisplayName = R.Created.ToString(); //R.BodyId = M.BodyId; TreeNode NRec = new TreeNode(); if(R.SessionID == "") { NRec = NodeRecs.Nodes.Add(R.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(R.SessionName == NodeSessions[a].Text) NRec = NodeSessions[a].Nodes.Add(R.DisplayName); } } if(R.IsReady) { NRec.Tag = R; } else NRec.ForeColor = Color.Gray; NRec.NodeFont = new Font("Arial",10,FontStyle.Regular); NRec.ImageIndex = 3; NRec.SelectedImageIndex = 3; } } } } if(nUT2.NextSectionTypeID != -99) nUT2 = F.GetSectionType(nUT2.NextSectionTypeID); test = nUT2.Description; Counter2 -= 1; } if(Members.Nodes.Count > 0) Members.Expand(); } } // Skipped_This: {} /// Show Group Recordings /// if(LoginUser.CurrentGroups.Count > 0) { OysterClassLibrary.Groups CG = LoginUser.CurrentGroups; TreeNode GNode = Root.Nodes.Add("Group Memberships"); GNode.Tag = CG; GNode.ImageIndex = 5; GNode.SelectedImageIndex = 5; TreeNode NPublic = new TreeNode("Public Groups",1,1); NPublic.ForeColor = Color.DarkBlue; NPublic.Tag = "Label Group"; TreeNode NPrivate = new TreeNode("Private Groups",7,7); NPrivate.Tag = "Label Group"; NPrivate.ForeColor = Color.DarkGreen; GNode.Nodes.Add(NPublic); GNode.Nodes.Add(NPrivate); foreach(OysterClassLibrary.Group CurrentGroup in CG) { TreeNode GroupNode = new TreeNode(CurrentGroup.Description); GroupNode.Tag = CurrentGroup; GroupNode.ImageIndex = 4; GroupNode.SelectedImageIndex = 4; if(CurrentGroup.IsPublicAccess) { GroupNode.ForeColor = Color.Blue; NPublic.Nodes.Add(GroupNode); } else { GroupNode.ForeColor = Color.Green; NPrivate.Nodes.Add(GroupNode); } OysterClassLibrary.Recordings AR = CurrentGroup.CurrentRecordings; if(AR.Count > 0) { ListView lvSessions = new ListView(); //foreach(OysterClassLibrary.Recording R in B.Recordings) foreach(OysterClassLibrary.Recording R in AR) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LCI = lvSessions.Items.Add(R.SessionName); LCI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(ListViewItem LVI in lvSessions.Items) { NodeSessions[SessionCount] = GroupNode.Nodes.Add(LVI.Text); NodeSessions[SessionCount].Tag = LVI.Tag; NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; SessionCount++; } //foreach(OysterClassLibrary.Recording DrawRecording in B.Recordings) foreach(OysterClassLibrary.Recording DrawRecording in AR) { // if(DrawRecording.DisplayName == null) // DrawRecording.DisplayName = DrawRecording.Created.ToString(); TreeNode NodeRecording = new TreeNode(); if(DrawRecording.SessionID == "") { NodeRecording = GroupNode.Nodes.Add(DrawRecording.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(DrawRecording.SessionName == NodeSessions[a].Text) NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); } } //DrawRecording.Se = B.ID; if(DrawRecording.IsReady) NodeRecording.Tag = DrawRecording; else NodeRecording.ForeColor = Color.Gray; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; //NodeRecording.ForeColor = System.Drawing.Color.DarkSlateBlue; } } else GroupNode.Nodes.Add("No Recordings Available"); } if(NPublic.Nodes.Count == 0) { TreeNode NoPublic = NPublic.Nodes.Add("No public groups"); } if(NPrivate.Nodes.Count == 0) { TreeNode NoPrivate = NPrivate.Nodes.Add("No private memberships"); } } //List Users Unassigned Recordings bool RunThisOnce = false; TreeNode UNURecs = new TreeNode(); if(LoginUser.HighestAuthorityLevel.CanViewUnassignedRecordings.Count > 0) { OysterClassLibrary.Users AU = null; if(LoginUser.HighestAuthorityLevel.ID == OSystem.SectionTypeSysAdmin.ID) AU = OSystem.CurrentSystemUsers; else AU = LoginUser.AllMembersInHierarchy; foreach(OysterClassLibrary.User MyUser in AU) { foreach(OysterClassLibrary.Section DrawSection in MyUser.AllOwnedSections) { if((DrawSection.IsDefault)&&(DrawSection.CurrentRecordings.Count > 0)) { if(RunThisOnce == false) { UNURecs = Root.Nodes.Add("Current Users Unassigned Recordings"); UNURecs.ForeColor = Color.BurlyWood; RunThisOnce = true; } string testme = DrawSection.Description; if(DrawSection.OwnerID != LoginUser.ID) { TreeNode ThisUser = UNURecs.Nodes.Add(MyUser.Description); ThisUser.ForeColor = Color.Blue; ThisUser.ImageIndex = 0; ThisUser.SelectedImageIndex = 0; //THIS LITTLE SECTION IS OAKLAND SPECIFIC.. THAT IS BECAUSE I HAD TOOO //TreeNode NodeURT = new TreeNode(); // if(DrawBody.CreatedBySectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID) // { // NodeURT= NodeX.Nodes.Add("Recordings"); // NodeURT.ForeColor = Color.DarkBlue; // } // else // { //NodeURT= NodeX.Nodes.Add("Unassigned Recordings"); //NodeURT.ForeColor = Color.Brown; //NodeURT.ImageIndex = 6; //NodeURT.SelectedImageIndex = 6; // } //IF Recording Sessions go ahead and prepare to draw ListView lvSessions = new ListView(); foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LGI = lvSessions.Items.Add(R.SessionName); LGI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(ListViewItem LVI in lvSessions.Items) { //OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(R.StreamingEncoderID); NodeSessions[SessionCount] = ThisUser.Nodes.Add(LVI.Text); NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; NodeSessions[SessionCount].Tag = LVI.Tag; SessionCount++; } //End Recording Session Preparation foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings) { // bool DoesOwnCopy = F.HasInstanceOfRecording(DrawSection.OwnerID,DrawRecording.ID,DrawSection.ID); if(true)// if(DoesOwnCopy == true) { //DrawRecording.BodyId = DrawBody.ID; // if(DrawRecording.DisplayName == null) // DrawRecording.DisplayName = DrawRecording.Created.ToString(); TreeNode NodeRecording = new TreeNode(); if(DrawRecording.SessionID == "") { NodeRecording = ThisUser.Nodes.Add(DrawRecording.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(DrawRecording.SessionName == NodeSessions[a].Text) NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); } } if(DrawRecording.IsReady) NodeRecording.Tag = DrawRecording; else NodeRecording.ForeColor = Color.Gray; NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; //NodeRecording.ForeColor = System.Drawing.Color.Brown; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); if(OpenToRecording == DrawRecording.ID) { // NodeRecording.EnsureVisible(); treeView1.SelectedNode = NodeRecording; g_objRecording = DrawRecording; } } } } // else {TreeNode NodeURT = NodeX.Nodes.Add("No Unassigned Recordings");} } } } } // Begin repainting the TreeView. treeView1.Refresh(); RestoreExpandedNodes(treeView1.Nodes); Root.Expand(); treeView1.EndUpdate(); F.Dispose(); treeView1.ResumeLayout(); }
//public void RecursiveDisplay(OysterClassLibrary.Section DrawBody, ref TreeNode NodeX, OysterClassLibrary.SectionType MyCurrentSectionType) public void RecursiveDisplay(OysterClassLibrary.Section DrawSection, ref TreeNode NodeX, OysterClassLibrary.SectionType MyCurrentSectionType) { OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); if(DrawSection.IsDefault == false) { TreeNode NodeBody = NodeX.Nodes.Add(DrawSection.Description); string testme = DrawSection.Description; NodeBody.Tag = DrawSection; NodeBody.ImageIndex = 1; NodeBody.SelectedImageIndex =1; NodeBody.ForeColor = System.Drawing.Color.DarkBlue; if((g_SelectedAnItem == false)&&(DrawSection.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.ID)) { g_SelectedAnItem = true; treeView1.SelectedNode = NodeBody; NodeBody.EnsureVisible(); MouseEventArgs A = new MouseEventArgs(MouseButtons.Left,1,1,1,0); treeView1_MouseUp(treeView1,A); } if(OpenToBody == DrawSection.ID) { NodeBody.EnsureVisible(); treeView1.SelectedNode = NodeBody; g_objSection = DrawSection; } //bool DidOnce = false; foreach(OysterClassLibrary.User DrawUser in DrawSection.CurrentUsers) { TreeNode NodeUser = null; int[] UO = OSystem.UnassignedIDs; if(UO[0]== DrawUser.ID) { NodeUser = NodeBody.Nodes.Add(DrawUser.Description); NodeUser.ForeColor = System.Drawing.Color.Red; NodeUser.NodeFont = new Font("Arial",10,FontStyle.Bold); } else { NodeUser = NodeBody.Nodes.Add(DrawUser.Description); NodeUser.ForeColor = System.Drawing.Color.Black; NodeUser.NodeFont = new Font("Arial",10,FontStyle.Regular); } string test = DrawUser.Description; test = DrawUser.CurrentSectionID.ToString(); NodeUser.Tag = DrawUser; NodeUser.ImageIndex = 0; NodeUser.SelectedImageIndex = 0; if(OpenToUser == DrawUser.ID) { // NodeUser.EnsureVisible(); treeView1.SelectedNode = NodeUser; g_objUser = DrawUser; } OysterClassLibrary.SectionType UT = F.GetSectionType(DrawSection.CreatedBySectionType.NextSectionTypeID); TreeNode NodeLabel = null; //if((DrawSection.CurrentRecordings.Count > 0)||(DrawUser.NextOwnedSections.Count > 0)) if(DrawUser.NextOwnedSections.Count > 0) { NodeLabel = new TreeNode(); NodeLabel = NodeUser.Nodes.Add(UT.Description); NodeLabel.ImageIndex = 8; NodeLabel.SelectedImageIndex = 8; } else { // NodeLabel = NodeUser.Nodes.Add("No Recordings"); } //TreeNode NodeLabel = NodeLabel.Nodes.Add(DrawUser.Description); foreach(OysterClassLibrary.Section B in DrawUser.NextOwnedSections) { OysterClassLibrary.SectionType prevUT = F.GetSectionType(B.CreatedBySectionType.PreviousSectionTypeID); RecursiveDisplay(B,ref NodeLabel,prevUT); } // RecursiveDisplay(DrawUser.Bodys,NodeUser); if(DrawSection.CurrentRecordings.Count > 0) { bool drawonce = false; testme = DrawSection.CurrentRecordings.Count.ToString(); //NodeRT.NodeFont = new Font("Arial",10,FontStyle.Bold); TreeNode NodeRT = new TreeNode(); //IF Recording Sessions go ahead and prepare to draw ListView lvSessions = new ListView(); foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings) { bool DoesHaveCopy = F.HasInstanceOfRecording(DrawUser.ID,R.ID,DrawSection.ID); if(DoesHaveCopy == true) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LCI = lvSessions.Items.Add(R.SessionName); LCI.Tag = R.SessionID; } SkipItem:{} } } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; //End Recording Session Preparation foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings) { bool DoesHaveCopy = F.HasInstanceOfRecording(DrawUser.ID,DrawRecording.ID,DrawSection.ID); if(DoesHaveCopy == true) { if(drawonce == false) { drawonce = true; NodeRT = NodeUser.Nodes.Add("Recordings"); NodeRT.ForeColor = System.Drawing.Color.DarkSlateBlue; NodeRT.ImageIndex = 6; NodeRT.SelectedImageIndex = 6; OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(DrawRecording.StreamingEncoderID); foreach(ListViewItem LVI in lvSessions.Items) { NodeSessions[SessionCount] = NodeRT.Nodes.Add(LVI.Text); NodeSessions[SessionCount].ImageIndex = 3; NodeSessions[SessionCount].Tag = SE.CurrentRoom; NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; SessionCount++; } } //DrawRecording.BodyId = DrawBody.ID; // if(DrawRecording.DisplayName == null) // DrawRecording.DisplayName = DrawRecording.Created.ToString(); TreeNode NodeRecording = new TreeNode(); if(DrawRecording.SessionID == "") { NodeRecording = NodeRT.Nodes.Add(DrawRecording.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(DrawRecording.SessionName == NodeSessions[a].Text) NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); } } if(DrawRecording.IsReady) NodeRecording.Tag = DrawRecording; else NodeRecording.ForeColor = Color.Gray; NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); if(OpenToRecording == DrawRecording.ID) { // NodeRecording.EnsureVisible(); treeView1.SelectedNode = NodeRecording; g_objRecording = DrawRecording; } } } // if( NodeLabel != null) // NodeLabel.Nodes.Add(NodeRT); // else if(NodeRT.Nodes.Count > 0) // NodeUser.Nodes.Add(NodeRT); } } } else { // foreach(OysterClassLibrary.Permission P in MyCurrentSectionType.CanViewUnassignedRecordings) // { // string testme = P.CanOperateOn.ToString(); // // if((DrawBody.CreatedBySectionType.ID == P.CanOperateOn)&&(DrawBody.OwnerID != cvosUser.ID)) //OAKLAND SPECIFIC CODE THAT ALLOWS ONLY SYSTEM ADMIN OR ADMIN TO VIEW UNASSIGNED RECORDINGS if(LoginUser.HighestAuthorityLevel.CanViewUnassignedRecordings.Count > 0) { string testme = MyCurrentSectionType.Description; if((DrawSection.CurrentRecordings.Count > 0)&&(DrawSection.OwnerID != LoginUser.ID)) { //THIS LITTLE SECTION IS OAKLAND SPECIFIC.. THAT IS BECAUSE I HAD TOOO TreeNode NodeURT = new TreeNode(); // if(DrawBody.CreatedBySectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID) // { // NodeURT= NodeX.Nodes.Add("Recordings"); // NodeURT.ForeColor = Color.DarkBlue; // } // else // { NodeURT= NodeX.Nodes.Add("Unassigned Recordings"); NodeURT.ForeColor = Color.Brown; NodeURT.ImageIndex = 6; NodeURT.SelectedImageIndex = 6; // } //IF Recording Sessions go ahead and prepare to draw ListView lvSessions = new ListView(); foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings) { if(R.SessionID != null) { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LGI = lvSessions.Items.Add(R.SessionName); LGI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(ListViewItem LVI in lvSessions.Items) { //OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(R.StreamingEncoderID); NodeSessions[SessionCount] = NodeURT.Nodes.Add(LVI.Text); NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; NodeSessions[SessionCount].Tag = LVI.Tag; SessionCount++; } //End Recording Session Preparation foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings) { // bool DoesOwnCopy = F.HasInstanceOfRecording(DrawSection.OwnerID,DrawRecording.ID,DrawSection.ID); if(true)// if(DoesOwnCopy == true) { //DrawRecording.BodyId = DrawBody.ID; // if(DrawRecording.DisplayName == null) // DrawRecording.DisplayName = DrawRecording.Created.ToString(); TreeNode NodeRecording = new TreeNode(); if(DrawRecording.SessionID == null) { NodeRecording = NodeURT.Nodes.Add(DrawRecording.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(DrawRecording.SessionName == NodeSessions[a].Text) NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); } } if(DrawRecording.IsReady) NodeRecording.Tag = DrawRecording; else NodeRecording.ForeColor = Color.Gray; NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; //NodeRecording.ForeColor = System.Drawing.Color.Brown; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); if(OpenToRecording == DrawRecording.ID) { // NodeRecording.EnsureVisible(); treeView1.SelectedNode = NodeRecording; g_objRecording = DrawRecording; } } } } // else {TreeNode NodeURT = NodeX.Nodes.Add("No Unassigned Recordings");} } } F.Dispose(); }
private void treeView1_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) { if(e.Node.Tag is OysterClassLibrary.User) { System.Windows.Forms.Cursor OriginalCursor = this.Cursor; this.Cursor = System.Windows.Forms.Cursors.WaitCursor; this.SuspendLayout(); OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); OysterClassLibrary.User ThisUser = (OysterClassLibrary.User)e.Node.Tag; foreach(TreeNode X in e.Node.Nodes) { if(X.Tag is string) { TreeNode XNode = X; string[] sParser = ((string)X.Tag).Split(":".ToCharArray()); if(sParser.Length == 1) { if(sParser[0].ToLower() == "NextOwnedSections".ToLower()) { X.Nodes.Clear(); foreach(OysterClassLibrary.Section B in ThisUser.NextOwnedSections) { OysterClassLibrary.SectionType prevUT = F.GetSectionType(B.CreatedBySectionType.PreviousSectionTypeID); ExpandSection(B,ref XNode,prevUT); } } } } } this.Cursor = OriginalCursor; this.ResumeLayout(); } else if(e.Node.Tag is string) { string[] sParsed = ((string)e.Node.Tag).Split(":".ToCharArray()); if(sParsed.Length == 2) { if(sParsed[0].ToLower() == "UnassignedRecordingUser".ToLower()) { TreeNode ThisNode = e.Node; ExpandUnassignedUser(ref ThisNode); } } } else if(e.Node.Tag is OysterClassLibrary.Group) { TreeNode GroupNode = e.Node; ExpandGroup(ref GroupNode); } }
public void BuildUserHierarchy() { System.Windows.Forms.Cursor OriginalCursor = this.Cursor; this.Cursor = System.Windows.Forms.Cursors.WaitCursor; this.SuspendLayout(); treeView1.SuspendLayout(); treeView1.BeginUpdate(); System.GC.Collect(); OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); TNCount = 0; //GetTotalNodes(treeView1.Nodes); TempNodes = new String[TNCount]; TNCount = 0; // BackupExpandedNodes(treeView1.Nodes); ExpandedNodes = new String[TNCount]; for(int i = 0; i < TNCount;i++) { ExpandedNodes[i] = TempNodes[i]; } treeView1.Nodes.Clear(); Root = treeView1.Nodes.Add(LoginUser.Description); Root.Tag = "TopofPack"; Root.ImageIndex = 0; Root.SelectedImageIndex = 0; Root.Expand(); Root.NodeFont = new Font("Arial",10,FontStyle.Regular); int MUTCounter = 0; MUTCounter = OSystem.CurrentSectionTypes.Count; OysterClassLibrary.SectionType nUT = OSystem.SectionTypeSysAdmin; OysterClassLibrary.SectionType LastType = null; string test = nUT.Description; bool listonce = false; TreeNode Label = new TreeNode(); #region GatherHierarchy while( MUTCounter > 0) { listonce = false; //foreach(OysterClassLibrary.Section B in cvosUser.Bodys) foreach(OysterClassLibrary.Section B in LoginUser.AllOwnedSections) { if(B.IsDefault == false) { if(B.CreatedBySectionTypeID == nUT.ID) { if(listonce == false) { if(LastType == null) LastType = OSystem.SectionTypeSysAdmin; if(LastType.NextSectionTypeID != 99) { Label = Root.Nodes.Add(nUT.Description); Label.ImageIndex = 8; Label.SelectedImageIndex = 8; Label.Tag = nUT; //MainSystemSection = B; test = nUT.Description; } else { test = B.Description; test = LastType.Description; goto Finished_Recursive; // Students don't have bodies so } // Label.Tag = LastType; listonce = true; } test = B.Description; test = LastType.Description; CurrentSectionType = LastType; ExpandSection(B,ref Label,LastType); //RecursiveDisplay(B,ref Label,LastType); } } } LastType = nUT; if(nUT.NextSectionTypeID != -99) nUT = nUT.NextSectionType; //nUT = F.GetSectionType(nUT.NextSectionTypeID); else goto Finished_Recursive; test = nUT.Description; MUTCounter -= 1; } #endregion GatherHierarchy Finished_Recursive:{} #region ShowUsersRecordings foreach(OysterClassLibrary.Section B in LoginUser.AllOwnedSections) { OysterClassLibrary.Recordings AR = F.ALLRecordings(B.ID); if((B.IsDefault == true)&&(AR.Count > 0)) { TreeNode NodeX = new TreeNode(); if(OSystem.SectionTypeSysAdmin.ID == LoginUser.HighestAuthorityLevel.ID) { NodeX = Root.Nodes.Add("Recordings"); // NodeX.Tag = OSystem.SectionTypeSysAdmin; NodeX.Tag = LoginUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.DarkBlue; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; } else { NodeX = Root.Nodes.Add("Unassigned Recordings"); // NodeX.Tag = HighestSectionType; NodeX.Tag = LoginUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.Brown; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; } ListView lvSessions = new ListView(); //foreach(OysterClassLibrary.Recording R in B.Recordings) foreach(OysterClassLibrary.Recording R in AR) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LCI = lvSessions.Items.Add(R.SessionName); LCI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(ListViewItem LVI in lvSessions.Items) { NodeSessions[SessionCount] = NodeX.Nodes.Add(LVI.Text); NodeSessions[SessionCount].Tag = LVI.Tag; NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; SessionCount++; } //foreach(OysterClassLibrary.Recording DrawRecording in B.Recordings) foreach(OysterClassLibrary.Recording DrawRecording in AR) { // if(DrawRecording.DisplayName == null) // DrawRecording.DisplayName = DrawRecording.Created.ToString(); TreeNode NodeRecording = new TreeNode(); if(DrawRecording.SessionID == "") { NodeRecording = NodeX.Nodes.Add(DrawRecording.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(DrawRecording.SessionName == NodeSessions[a].Text) NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); } } //DrawRecording.Se = B.ID; if(DrawRecording.IsReady) { NodeRecording.Tag = DrawRecording; } else { NodeRecording.ForeColor = System.Drawing.Color.Gray; } NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); if(g_SelectedAnItem == false) { g_SelectedAnItem = true; treeView1.SelectedNode = NodeRecording; NodeRecording.EnsureVisible(); MouseEventArgs A = new MouseEventArgs(MouseButtons.Left,1,1,1,0); treeView1_MouseUp(treeView1,A); } if(OpenToRecording == DrawRecording.ID) { // NodeRecording.EnsureVisible(); treeView1.SelectedNode = NodeRecording; // g_objRecording = DrawRecording; g_objRecording = DrawRecording; } } } } #endregion Show Users Recordings //This Section Displays this LoginUser's Member Sections #region Show Users Member Sections if(LoginUser.HighestAuthorityLevel.ID != OSystem.SectionTypeSysAdmin.ID) { OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections; // F.GetMemberSections(LoginUser.ID,false); TreeNode Members = new TreeNode(); if(MembersOf.Count > 0) { Members = Root.Nodes.Add("My Recordings"); Members.ForeColor = System.Drawing.Color.Green; //Members.NodeFont = new Font("Arial",10,FontStyle.Bold); Members.ImageIndex = 7; Members.SelectedImageIndex = 7; int Counter2 = OSystem.CurrentSectionTypes.Count; OysterClassLibrary.SectionType nUT2 = OSystem.SectionTypeSysAdmin; test = nUT2.Description; listonce = false; Label = new TreeNode(); TreeNode NodeMember = new TreeNode(); while( Counter2 > 0) { listonce = false; foreach(OysterClassLibrary.Section M in MembersOf) { test = M.CreatedBySectionType.Description; test = nUT2.Description; if(M.CreatedBySectionType.ID == nUT2.ID) { if(listonce == false) { OysterClassLibrary.SectionType LabelSectionType = F.GetSectionType(nUT2.NextSectionTypeID); Label = Members.Nodes.Add(LabelSectionType.Description); Label.Tag = LabelSectionType; string whatistheusertype = LabelSectionType.Description; listonce = true; } NodeMember = new TreeNode(); NodeMember = Label.Nodes.Add(M.Description); NodeMember.Tag = M; // NodeMember.NodeFont = new Font("Arial",10,FontStyle.Bold); NodeMember.ForeColor = System.Drawing.Color.DarkSlateBlue; NodeMember.ImageIndex = 1; NodeMember.SelectedImageIndex = 1; bool DrawOnce = false; if(M.CurrentRecordings.Count > 0) { TreeNode NodeRecs = new TreeNode(); ListView lvSessions = new ListView(); foreach(OysterClassLibrary.Recording R in M.CurrentRecordings) { if(R.SessionID != "") { foreach(ListViewItem LVI in lvSessions.Items) { if(LVI.Text == R.SessionName) goto SkipItem; } ListViewItem LCI = lvSessions.Items.Add(R.SessionName); LCI.Tag = R.SessionID; } SkipItem:{} } TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; int SessionCount = 0; foreach(OysterClassLibrary.Recording R in M.CurrentRecordings) { if(R.CurrentUserID == LoginUser.ID) if(DrawOnce == false) { NodeRecs = NodeMember.Nodes.Add("Recordings"); NodeRecs.ForeColor = Color.SlateBlue; NodeRecs.ImageIndex = 6; NodeRecs.SelectedImageIndex = 6; foreach(ListViewItem LVI in lvSessions.Items) { NodeSessions[SessionCount] = NodeRecs.Nodes.Add(LVI.Text); NodeSessions[SessionCount].Tag = LVI.Tag; NodeSessions[SessionCount].ImageIndex = 2; NodeSessions[SessionCount].SelectedImageIndex = 2; SessionCount++; } DrawOnce = true; } // if(R.DisplayName == null) // R.DisplayName = R.Created.ToString(); //R.BodyId = M.BodyId; TreeNode NRec = new TreeNode(); if(R.SessionID == "") { NRec = NodeRecs.Nodes.Add(R.DisplayName); } else { for(int a=0; a < SessionCount;a++) { if(R.SessionName == NodeSessions[a].Text) NRec = NodeSessions[a].Nodes.Add(R.DisplayName); } } if(R.IsReady) { NRec.Tag = R; } else NRec.ForeColor = Color.Gray; NRec.NodeFont = new Font("Arial",10,FontStyle.Regular); NRec.ImageIndex = 3; NRec.SelectedImageIndex = 3; } } } } if(nUT2.NextSectionTypeID != -99) nUT2 = F.GetSectionType(nUT2.NextSectionTypeID); test = nUT2.Description; Counter2 -= 1; } if(Members.Nodes.Count > 0) Members.Expand(); } } #endregion Show Users Member Sections /// Show Group Recordings /// #region CurrentMemberships BuildGroupNodes(); #region This Region is code that has been moved to ReBuildGroup {This section should be deleted after testing} // OysterClassLibrary.Groups CG = null; // // if(LoginUser.HighestAuthorityLevel.ID == OSystem.SectionTypeSysAdmin.ID) // CG = OSystem.GetALLGroups(false); // else // CG = LoginUser.CurrentGroups; // if(CG.Count > 0) // { // if(GNode == null) // { // // GNode = Root.Nodes.Add("Group Memberships"); // GNode.Tag = CG; // GNode.ImageIndex = 5; // GNode.SelectedImageIndex = 5; // } // GNode.Nodes.Clear(); // NPublic = new TreeNode("Public Groups",1,1); // NPublic.ForeColor = Color.DarkBlue; // NPublic.Tag = "Label Group:Public"; // NPrivate = new TreeNode("Private Groups",7,7); // NPrivate.Tag = "Label Group:Private"; // NPrivate.ForeColor = Color.DarkGreen; // // GNode.Nodes.Add(NPublic); // GNode.Nodes.Add(NPrivate); // // foreach(OysterClassLibrary.Group CurrentGroup in CG) // { // TreeNode GroupNode = new TreeNode(CurrentGroup.Description); // // GroupNode.Tag = CurrentGroup; // // GroupNode.ImageIndex = 4; // GroupNode.SelectedImageIndex = 4; // // if(CurrentGroup.IsPublicAccess) // { // GroupNode.ForeColor = Color.Blue; // NPublic.Nodes.Add(GroupNode); // } // else // { // GroupNode.ForeColor = Color.Green; // NPrivate.Nodes.Add(GroupNode); // } // #region List Groups Recordings // OysterClassLibrary.Recordings AR = CurrentGroup.CurrentRecordings; // if(AR.Count > 0) // { // // // ListView lvSessions = new ListView(); // //foreach(OysterClassLibrary.Recording R in B.Recordings) // foreach(OysterClassLibrary.Recording R in AR) // { // if(R.SessionID != "") // { // foreach(ListViewItem LVI in lvSessions.Items) // { // if(LVI.Text == R.SessionName) // goto SkipItem; // } // ListViewItem LCI = lvSessions.Items.Add(R.SessionName); // LCI.Tag = R.SessionID; // } // SkipItem:{} // } // TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; // int SessionCount = 0; // foreach(ListViewItem LVI in lvSessions.Items) // { // NodeSessions[SessionCount] = GroupNode.Nodes.Add(LVI.Text); // NodeSessions[SessionCount].Tag = LVI.Tag; // NodeSessions[SessionCount].ImageIndex = 2; // NodeSessions[SessionCount].SelectedImageIndex = 2; // SessionCount++; // } // // //foreach(OysterClassLibrary.Recording DrawRecording in B.Recordings) // foreach(OysterClassLibrary.Recording DrawRecording in AR) // { // // // if(DrawRecording.DisplayName == null) // // DrawRecording.DisplayName = DrawRecording.Created.ToString(); // TreeNode NodeRecording = new TreeNode(); // if(DrawRecording.SessionID == "") // { // NodeRecording = GroupNode.Nodes.Add(DrawRecording.DisplayName); // } // else // { // for(int a=0; a < SessionCount;a++) // { // if(DrawRecording.SessionName == NodeSessions[a].Text) // NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); // } // } // //DrawRecording.Se = B.ID; // if(DrawRecording.IsReady) // NodeRecording.Tag = DrawRecording; // else // NodeRecording.ForeColor = Color.Gray; // // NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); // NodeRecording.ImageIndex = 3; // NodeRecording.SelectedImageIndex = 3; // // //NodeRecording.ForeColor = System.Drawing.Color.DarkSlateBlue; // } // } // else // GroupNode.Nodes.Add("No Recordings Available"); // #endregion List Group Recordings // } // // if(NPublic.Nodes.Count == 0) // { // TreeNode NoPublic = NPublic.Nodes.Add("No public groups"); // } // // if(NPrivate.Nodes.Count == 0) // { // TreeNode NoPrivate = NPrivate.Nodes.Add("No private memberships"); // // } // } #endregion Delete Section #endregion CurrentMemberships //List Users Unassigned Recordings #region Users Unassigned Recordings bool RunThisOnce = false; TreeNode UNURecs = new TreeNode(); if(LoginUser.HighestAuthorityLevel.CanViewUnassignedRecordings.Count > 0) { OysterClassLibrary.Users AU = null; if(LoginUser.HighestAuthorityLevel.ID == OSystem.SectionTypeSysAdmin.ID) AU = OSystem.CurrentSystemUsers; else AU = LoginUser.AllMembersInHierarchy; foreach(OysterClassLibrary.User MyUser in AU) { foreach(OysterClassLibrary.Section DrawSection in MyUser.AllOwnedSections) { if((DrawSection.IsDefault)&&(DrawSection.CurrentRecordings.Count > 0)) { if(RunThisOnce == false) { UNURecs = Root.Nodes.Add("Current Users Unassigned Recordings"); UNURecs.ForeColor = Color.BurlyWood; RunThisOnce = true; } string testme = DrawSection.Description; if(DrawSection.OwnerID != LoginUser.ID) { TreeNode ThisUser = UNURecs.Nodes.Add(MyUser.Description); ThisUser.ForeColor = Color.Blue; ThisUser.ImageIndex = 0; ThisUser.SelectedImageIndex = 0; ThisUser.Tag = "UnassignedRecordingUser:"******"Failed to aquire listing..."); #region DisplayRecordings {This code has been moved to ExpandUnassignedUser And should be deleted after application is tested} // //IF Recording Sessions go ahead and prepare to draw // ListView lvSessions = new ListView(); // foreach(OysterClassLibrary.Recording R in DrawSection.CurrentRecordings) // { // if(R.SessionID != "") // { // foreach(ListViewItem LVI in lvSessions.Items) // { // if(LVI.Text == R.SessionName) // goto SkipItem; // } // // ListViewItem LGI = lvSessions.Items.Add(R.SessionName); // LGI.Tag = R.SessionID; // // } // SkipItem:{} // } // TreeNode[] NodeSessions = new TreeNode[lvSessions.Items.Count]; // int SessionCount = 0; // // foreach(ListViewItem LVI in lvSessions.Items) // { // //OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(R.StreamingEncoderID); // // NodeSessions[SessionCount] = ThisUser.Nodes.Add(LVI.Text); // NodeSessions[SessionCount].ImageIndex = 2; // NodeSessions[SessionCount].SelectedImageIndex = 2; // NodeSessions[SessionCount].Tag = LVI.Tag; // SessionCount++; // } // // foreach(OysterClassLibrary.Recording DrawRecording in DrawSection.CurrentRecordings) // { // // bool DoesOwnCopy = F.HasInstanceOfRecording(DrawSection.OwnerID,DrawRecording.ID,DrawSection.ID); // if(true)// if(DoesOwnCopy == true) // { // //DrawRecording.BodyId = DrawBody.ID; // // if(DrawRecording.DisplayName == null) // // DrawRecording.DisplayName = DrawRecording.Created.ToString(); // // TreeNode NodeRecording = new TreeNode(); // if(DrawRecording.SessionID == "") // { // NodeRecording = ThisUser.Nodes.Add(DrawRecording.DisplayName); // } // else // { // for(int a=0; a < SessionCount;a++) // { // if(DrawRecording.SessionName == NodeSessions[a].Text) // NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName); // } // } // // if(DrawRecording.IsReady) // NodeRecording.Tag = DrawRecording; // else // NodeRecording.ForeColor = Color.Gray; // // NodeRecording.ImageIndex = 3; // NodeRecording.SelectedImageIndex = 3; // // //NodeRecording.ForeColor = System.Drawing.Color.Brown; // NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); // // if(OpenToRecording == DrawRecording.ID) // { // // NodeRecording.EnsureVisible(); // treeView1.SelectedNode = NodeRecording; // g_objRecording = DrawRecording; // } // } // } #endregion } // else {TreeNode NodeURT = NodeX.Nodes.Add("No Unassigned Recordings");} } } } } #endregion Unassigned Users Recordings // Begin repainting the TreeView. //treeView1.Refresh(); //RestoreExpandedNodes(treeView1.Nodes); Root.Expand(); treeView1.EndUpdate(); treeView1.ResumeLayout(); this.ResumeLayout(); this.Cursor = OriginalCursor; F.Dispose(); }
public void UpdateSectionNode(TreeNode X) { if(X == null)return; if(X.Tag is OysterClassLibrary.Section) { OysterClassLibrary.Section ThisSection = (OysterClassLibrary.Section)X.Tag; X.Nodes.Clear(); OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); OysterClassLibrary.SectionType prevUT = F.GetSectionType(ThisSection.CreatedBySectionType.PreviousSectionTypeID); TreeNode Y = X.Parent; Y.Nodes.Remove(X); ExpandSection(ThisSection,ref Y,prevUT); } }