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(); }
private void Form1_Load(object sender, System.EventArgs e) { this.Opacity = 0; Splash = new frmSplash(); Splash.lblVersion.Text = VERSION; Splash.lblStatus.Text = "Loading Login Screen..."; Splash.Show(); Login1 L = new Login1(); System.Windows.Forms.DialogResult LDR = L.ShowDialog(this); if(LDR != DialogResult.OK) { Application.Exit(); return; } else { Splash.Msg("Loading User data..."); OSystem = L.OSystem; LoginUser = L.LoginUser; g_COMPORT = L.g_COMPORT; g_LoginDenied = OSystem.SystemAdminLoginDenied; } // if(this.Tag is PassOysterLogin) // { // // PassOysterLogin POL = (PassOysterLogin)this.Tag; // OSystem = POL.OSystem; // LoginUser = POL.LoginUser; // g_COMPORT = POL.COMPORT; // g_LoginDenied = OSystem.SystemAdminLoginDenied; // this.Tag = null; // } // else // return; //ReadMediaBufferServerLocalAddress(); g_Obj = new System.Object(); try { CardSwipe = new CARDSCAN.SerialPortScanClass(); //MHClient = new MHCOM.MediaHawkClientClass(); } catch(Exception Err) { MessageBox.Show(Err.Message,"Application Closing.."); Application.Exit(); return; } gLogTime = new DateTime(); gLogTime = System.DateTime.Now; gLastActivity = System.DateTime.Now; StatusTimer.Enabled = true; ActivityTimer.Enabled = true; HighestSectionType = LoginUser.HighestAuthorityLevel; MainSystemSection = OSystem.CurrentSystemSection("6419DC43-84B9-43e2-89FE-BB8C96D5CF6F"); menuItem1.Visible = false; menuItem3.Visible = false; mnuSystem.Visible = false; mnuHelp.Visible = false; //For Oakland Permissions if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.ID) { menuItem3.Visible = true; mnuSystem.Visible = true; menuItem1.Visible = true; } else if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID) { mnuSystem.Visible = true; menuItem3.Visible = true; menuItem1.Visible = true; } else { foreach(OysterClassLibrary.Permission P in HighestSectionType.CanShareRecordings) { string peek = P.TargetSectionTypeId.ToString(); menuItem1.Visible = true; break; } } ShowDisplay(ShowUserInfo); Splash.Msg("Building Users Hierarchy..."); Status(LoginUser.Description + " logged in..."); BuildUserHierarchy(); BuildCameraView(); treeView1.Focus(); if(treeView1.SelectedNode != null) { if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section) { } else { treeView1.SelectedNode = treeView1.Nodes[0]; } } else { treeView1.SelectedNode = treeView1.Nodes[0]; } treeView1_MouseUp(treeView1,new MouseEventArgs(MouseButtons.Left,1,0,0,0)); Splash.Msg("Completed..exiting Splash Screen"); Splash.Dispose(); this.Opacity = 100; }
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(); }
/* private void pnlRoomInfo_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { gLastActivity = System.DateTime.Now; } private void pnlVSSInfo_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { gLastActivity = System.DateTime.Now; } private void pnlRecordingInfo_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { gLastActivity = System.DateTime.Now; } private void pnlStreamingEncoder_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { gLastActivity = System.DateTime.Now; } private void pnlCardReader_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { gLastActivity = System.DateTime.Now; } private void cbGroupOwner_SelectedIndexChanged(object sender, System.EventArgs e) { foreach(ListViewItem LI in lstvMembersOfGroup.Items) { OysterClassLibrary.User U = (OysterClassLibrary.User)LI.Tag; if(cbGroupOwner.Text == U.Description) { g_objNewUser = U; cbGroupOwner.Items.Add(U.Description); } } } private void lstvMembersOfGroup_Click(object sender, System.EventArgs e) { if((EnableLV == true)&&(pnlGroupInfo.Visible == true)) { btnFinishGroup.Enabled = true; foreach(ListViewItem LI in lstvMembersOfGroup.SelectedItems) { OysterClassLibrary.User U = (OysterClassLibrary.User)LI.Tag; tbGroupOwner.Text = U.Description; g_objNewUser = U; } } } */ private void CalculateCurrentSectionType(TreeNode SelectedNode) { // THIS FUNCTION SIMPLY CHECKS FOR THE LABEL USERTYPE // NOTE EACH LABELED USERTYPE DOES HAVE A USERTYPE OBJECT ASSIGNED TO IT BUT THE TREEVIEW ITERATION OF NODES DOESN'T WORK // CORRECTLY OR MAYBE I JUST NEED TO DO MORE RESEARCH ON THE TREEVIEW BUT TO ME IT DOESN"T WORK RIGHT BECAUSE TREEVIEW.NODES // WILL NOT ITERATE ALL THE NODES. string path = SelectedNode.FullPath; string[] treePath = SelectedNode.FullPath.Split('\\'); if(treePath.Length > 1) { if((treePath[1] == "Rooms")||(treePath[1] == "Video Storage Servers")) return; } if(treePath.Length > 2) //means the first node was not selected { CurrentSectionType = null; if(treePath[1] == "Recordings") { CurrentSectionType = OSystem.SectionTypeSysAdmin; } else if(treePath[1] == "Unassigned Recordings") CurrentSectionType = HighestSectionType; else if(treePath[1] == "Current Memberships") { TreeNode NewView = SelectedNode; while(NewView.Text != "My Recordings") { if(NewView.Tag is OysterClassLibrary.Oyster) break; if(NewView.Tag is OysterClassLibrary.SectionType) CurrentSectionType = (OysterClassLibrary.SectionType)NewView.Tag; NewView = NewView.Parent; } } else if(treePath[1] == "Group Memberships") { CurrentSectionType = HighestSectionType; } else { TreeNode NewView = SelectedNode; while(NewView.Text != treePath[1]) { NewView = NewView.Parent; if(NewView.Tag is OysterClassLibrary.Oyster) break; if(NewView.Tag is OysterClassLibrary.SectionType) CurrentSectionType = (OysterClassLibrary.SectionType)NewView.Tag; } } if(CurrentSectionType == null) // Check the Members Section since it is off by a couple { foreach(OysterClassLibrary.SectionType nUT in OSystem.CurrentSectionTypes) { if(nUT.Description == treePath[2]) { CurrentSectionType = nUT; break; } } } if(CurrentSectionType == null) { //MessageBox.Show("ERROR: CURRENT SectionType cannot be determined! Type is missing from UserName!"); CurrentSectionType = LoginUser.HighestAuthorityLevel; return; } } }
// /// <summary> // /// The main entry point for the application. // /// </summary> // [STAThread] // static void Main() // { // Application.Run(new Form1()); // } private void Form1_Load(object sender, System.EventArgs e) { frmSplash Splash = (frmSplash)this.Owner; g_Obj = new System.Object(); try { CardSwipe = new CARDSCAN.SerialPortScanClass(); } catch(Exception Err) { MessageBox.Show(Err.Message,"Application Closing.."); Application.Exit(); return; } UserLicense.OnTimedOut +=new EventHandler(UserLicense_OnTimedOut); UserLicense.ResetTimer(); m_OCLWriter = new CarverLabUtility.OCLWriter("Oyster Executive",Application.ProductVersion,LoginUser.ID,ref OSystem); System.Diagnostics.Debug.Listeners.Add(m_OCLWriter); Trace.WriteLine("Logged In",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); gLogTime = new DateTime(); gLogTime = System.DateTime.Now; // gLastActivity = System.DateTime.Now; StatusTimer.Enabled = true; //ActivityTimer.Enabled = true; HighestSectionType = LoginUser.HighestAuthorityLevel; MainSystemSection = OSystem.CurrentSystemSection("6419DC43-84B9-43e2-89FE-BB8C96D5CF6F"); menuItem1.Visible = false; menuItem3.Visible = false; mnuSystem.Visible = false; mnuHelp.Visible = false; //For Oakland Permissions if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.ID) { menuItem3.Visible = true; mnuSystem.Visible = true; menuItem1.Visible = true; } else if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID) { mnuSystem.Visible = true; menuItem3.Visible = true; menuItem1.Visible = true; } else { foreach(OysterClassLibrary.Permission P in HighestSectionType.CanShareRecordings) { string peek = P.TargetSectionTypeId.ToString(); menuItem1.Visible = true; break; } } ShowDisplay(ShowUserInfo); Splash.Msg("Building Users Hierarchy..."); Status(LoginUser.Description + " logged in..."); BuildUserHierarchy(); BuildCameraView(); treeView1.Focus(); if(treeView1.SelectedNode != null) { if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section) { } else { treeView1.SelectedNode = treeView1.Nodes[0]; } } else { treeView1.SelectedNode = treeView1.Nodes[0]; } treeView1_MouseUp(treeView1,new MouseEventArgs(MouseButtons.Left,1,0,0,0)); Splash.Msg("Completed..exiting Splash Screen"); //Splash.Dispose(); this.WindowState = System.Windows.Forms.FormWindowState.Maximized; //this.Opacity = 100; }