Exemplo n.º 1
0
        private void btnNext_Click(object sender, System.EventArgs e)
        {
            if(FrmParent != null)
                FrmParent.PostActivity();

            ListViewItem LVI = lvUsers.SelectedItems[0];
            OysterClassLibrary.User  UU = (OysterClassLibrary.User)LVI.Tag;

            if(IsEditing == false)
            {
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.CreateSection(tbDescription.Text,UU.ID,PreviousSection.ID);
                F.Dispose();
                Trace.WriteLine("Created Section: " + tbDescription.Text +
                    " and connected it to Section:" + PreviousSection.Description + "(" + PreviousSection.ID + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                this.DialogResult = DialogResult.OK;
                return;
            }
            else
            {
                CurrentSection.Update(tbDescription.Text,UU.ID,PreviousSection.ID);
                Trace.WriteLine("Edited Section: " + CurrentSection.Description +"(" + CurrentSection.ID.ToString() + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                this.DialogResult = DialogResult.OK;
                return;
            }
        }
Exemplo n.º 2
0
        private void btnFinished_Click(object sender, System.EventArgs e)
        {
            frm1.PostActivity();
            if(G == null)
            {
                try
                {
                    OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                    F.CreateGroup(((Form1)FrmParent.Owner).LoginUser.ID,tbDescription.Text,IsPublicAccess);
                    F.Dispose();
                }
                catch(Exception Err)
                {
                    MessageBox.Show(Err.Message);
                    return;
                }

            }
            else
            {
                try
                {
                    G.Update(tbDescription.Text);
                    Trace.WriteLine("Edited Group: " + G.Description +"(" + G.ID.ToString() + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                }
                catch(Exception Err)
                {
                    MessageBox.Show(Err.Message);
                    return;
                }
            }
             this.DialogResult = DialogResult.OK;
        }
Exemplo n.º 3
0
        private void btnFinished_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            int VSSId = 0;
            foreach(OysterClassLibrary.VideoStorageServer VSS in AV)
                if(VSS.ControlAddress + ": " + VSS.ControlPort == cbVSS.Text)
                    VSSId = VSS.ID;
            if(VSSId == 0)
            {
                this.DialogResult = DialogResult.Abort;
                MessageBox.Show("Unable to aquire the Video Storage Server Id... aborting Create New Scene...");
                return;
            }
            if(RM != null)
            {
                RM.Update(tbDescription.Text,VSSId);
                Trace.WriteLine("Edited Scene: " + RM.Description +"(" + RM.ID.ToString() + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

            }
            else
            {
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.CreateRoom(tbDescription.Text,VSSId);
                Trace.WriteLine("Created Scene: " + tbDescription.Text +"(" + tbDescription + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                F.Dispose();
            }
        }
Exemplo n.º 4
0
        private void CardReaderWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;
            else
            {
                MessageBox.Show("Illegal open attempt made on Forwarding Server Wizard");
                return;
            }
            if(this.Tag is OysterClassLibrary.CardReader)
            {
                CR = (OysterClassLibrary.CardReader)this.Tag;
                tbCardReaderAddress.Text = CR.Address;
                tbCardReaderPort.Text = CR.Port.ToString();
                chkIsOnSerialPort.Checked = CR.IsOnSerialPort;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                AR = F.ALLRooms();
                F.Dispose();
                RoomID = new string[AR.Count,2];
                Counter = 0;
                foreach(OysterClassLibrary.Room R in AR)
                {
                    cbCRRoom.Items.Add(R.Description);
                    RoomID[Counter,0] = R.Description;
                    RoomID[Counter,1] = R.ID.ToString();
                    Counter++;
                    if(R.ID == CR.RoomID)
                    {
                        cbCRRoom.Text = R.Description;
                    }
                }
                this.Text = "Editing " + CR.Address + ":" + CR.Port.ToString();
            }
            else
            {
                this.Text = "Creating New Card Reader";
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                AR = F.ALLRooms();
                int[] UO = F.GetUnassignedObjects();
                F.Dispose();
                RoomID = new string[AR.Count,2];
                Counter = 0;
                foreach(OysterClassLibrary.Room R in AR)
                {
                    cbCRRoom.Items.Add(R.Description);
                    if(R.ID == UO[1])
                        cbCRRoom.Text = R.Description;

                    RoomID[Counter,0] = R.Description;
                    RoomID[Counter,1] = R.ID.ToString();
                    Counter++;
                }
            }
        }
Exemplo n.º 5
0
        private void RoomWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;

            OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
            AV = F.ALLVideoStorageServers();
            int[] UO = F.GetUnassignedObjects();
            F.Dispose();
            if(this.Tag is OysterClassLibrary.Room)
            {
                RM = (OysterClassLibrary.Room)this.Tag;

                tbDescription.Text = RM.Description;
                this.Text = "Editing " + RM.Description;
                string tt;

                foreach(OysterClassLibrary.VideoStorageServer VSS in AV)
                {
                    cbVSS.Items.Add(VSS.ControlAddress + ": " + VSS.ControlPort.ToString());
                    if(VSS.ID == RM.VideoStorageServerID)
                    {
                        cbVSS.Text = VSS.ControlAddress + ": " + VSS.ControlPort.ToString();
                        tt = cbVSS.Text.ToString();
                        tt = VSS.ControlAddress;
                    }
                }
            }
            else
            {
                this.Text = "Creating a new Scene";

                foreach(OysterClassLibrary.VideoStorageServer VSS in AV)
                {
                    if(VSS.ID == UO[4])
                    {
                        cbVSS.Items.Add(VSS.ControlAddress + ": " + VSS.ControlPort.ToString());
                        cbVSS.Text = VSS.ControlAddress + ": " + VSS.ControlPort.ToString();

                    }
                    else
                    {
                        cbVSS.Items.Add(VSS.ControlAddress + ": " + VSS.ControlPort.ToString());
                    }

                }
            }
        }
Exemplo n.º 6
0
        private void VideoStorageServerWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;
            else
            {
                MessageBox.Show("Illegal open attempt made on Forwarding Server Wizard");
                return;
            }
            if(this.Tag is OysterClassLibrary.VideoStorageServer)
            {
                g_objVSS = (OysterClassLibrary.VideoStorageServer)this.Tag;
                this.Text = "Editing " + g_objVSS.ControlAddress + ":" + g_objVSS.ControlPort;
                tbVSSControlAddress.Text = g_objVSS.ControlAddress;
                tbVSSControlPort.Text = g_objVSS.ControlPort.ToString();
                tbVSSUploadAddress.Text = g_objVSS.UploadAddress;
                tbStorageDirectory.Text = g_objVSS.StorageDirectory;
                chkIsUploadFTP.Checked = g_objVSS.IsUploadFTP;

                foreach(OysterClassLibrary.VideoStorageServerType VST in g_objVSS.AllVideoStorageServerTypes)
                {
                    cbVSSType.Items.Add(VST.Description);
                    if(VST.ID == g_objVSS.VideoStorageServerTypeId)
                    {
                        cbVSSType.Text = VST.Description;
                    }
                }
            }
            else
            {
                this.Text = "Creating New Video Storage Server";
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                OysterClassLibrary.VideoStorageServerTypes AVST = F.ALLVideoStorageServerTypes();
                F.Dispose();
                bool DidOnce = false;
                foreach(OysterClassLibrary.VideoStorageServerType VST in AVST)
                {
                    cbVSSType.Items.Add(VST.Description);
                    if(DidOnce == false)
                    {
                        DidOnce = true;
                        cbVSSType.Text = VST.Description;
                    }
                }

            }
        }
Exemplo n.º 7
0
        private void CreateUser()
        {
            string Password = "";
            if(tbPassword.Text != "*******************")
            {
                Password = tbPassword.Text;
            }

            try
            {
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.CreateUser(tbFirstName.Text,tbMiddleName.Text,tbLastName.Text,tbLoginName.Text,
                    tbPassword.Text,cbCanRecord.Checked,tbIDCard.Text);
                F.Dispose();
                Trace.WriteLine("Created NewUser: "******" " + tbLastName.Text,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                this.DialogResult = DialogResult.OK;
            }
            catch(Exception Err)
            {
                this.DialogResult = DialogResult.None;
                MessageBox.Show(Err.Message);
                return;
            }
        }
Exemplo n.º 8
0
        private void ForwardingServerWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;
            else
            {
                MessageBox.Show("Illegal open attempt made on Forwarding Server Wizard");
                return;
            }

            if(this.Tag is OysterClassLibrary.ForwardingServer)
            {
                FS = (OysterClassLibrary.ForwardingServer)this.Tag;
                tbFSAddress.Text = FS.Address;
                tbFSPort.Text = FS.Port.ToString();
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                OysterClassLibrary.VideoStorageServers AV = F.ALLVideoStorageServers();
                F.Dispose();
                VSID = new string[AV.Count,2];
                int iCount = 0;

                foreach(OysterClassLibrary.VideoStorageServer V in AV)
                {
                    VSID[iCount,0] = V.ControlAddress + ":" + V.ControlPort.ToString();
                    VSID[iCount,1] = V.ID.ToString();
                    cbFSVSS.Items.Add(VSID[iCount,0]);

                    if(V.ID == FS.VideoStorageServerID)
                        cbFSVSS.Text = VSID[iCount,0];

                    iCount++;
                }
                this.Text = "Editing " + FS.Address + ":" + FS.Port.ToString();
            }
            else
            {
                this.Text = "Creating New Forwarding Server";
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                OysterClassLibrary.VideoStorageServers AV = F.ALLVideoStorageServers();
                int[] UO = F.GetUnassignedObjects();
                F.Dispose();
                VSID = new string[AV.Count,2];
                int iCount = 0;
                foreach(OysterClassLibrary.VideoStorageServer V in AV)
                {
                    VSID[iCount,0] = V.ControlAddress + ":" + V.ControlPort.ToString();
                    VSID[iCount,1] = V.ID.ToString();
                    cbFSVSS.Items.Add(VSID[iCount,0]);
                    if(V.ID == UO[4])
                        cbFSVSS.Text = VSID[iCount,0];

                    iCount++;
                }
            }
        }
Exemplo n.º 9
0
        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();
        }
Exemplo n.º 10
0
        //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();
        }
Exemplo n.º 11
0
        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();
        }
Exemplo n.º 12
0
        private void btnDeleteSE_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Streaming Encoder?","Confirm permanent deletion",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.OK)
            {
                OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)lvSE.SelectedItems[0].Tag;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.DeleteStreamingEncoder(SE.ID);
                F.Dispose();
                Trace.WriteLine("Deleted Streaming Encoder: " + SE.Description + "(" + SE.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                lvSE.Items.Clear();
                FrmParent.LoginUser = FrmParent.OSystem.Refresh();
                bool DidOnce = false;
                //Reset_All();
                foreach(OysterClassLibrary.StreamingEncoder S in FrmParent.OSystem.STREAMINGENCODERS)
                {
                    if(UO[5] != S.ID)
                    {
                        ListViewItem LVI = lvSE.Items.Add(S.Description);
                        LVI.SubItems.Add(S.CurrentRoom.Description);
                        LVI.Tag = S;

                        if(DidOnce == false)
                        {
                            DidOnce = true;
                            LVI.Selected = true;
                            lvSE_SelectedIndexChanged(lvSE,new EventArgs());
                        }
                    }
                }

            }
        }
Exemplo n.º 13
0
        private void btnDeleteVSS_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Video Storage Server?","Confirm permanent deletion",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.OK)
            {
                OysterClassLibrary.VideoStorageServer V = (OysterClassLibrary.VideoStorageServer)lvVSS.SelectedItems[0].Tag;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.DeleteVideoStorageServer(V.ID);
                F.Dispose();
                Trace.WriteLine("Deleted VideoStorageServer: " + V.ControlAddress +":" + V.ControlPort.ToString() + "(" + V.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

            }
            bool DidOnce = false;
            FrmParent.LoginUser = FrmParent.OSystem.Refresh();
            lvVSS.Items.Clear();
            //Reset_All();
            foreach(OysterClassLibrary.VideoStorageServer V in FrmParent.OSystem.VIDEOSTORAGESERVERS)
            {
                if(UO[4] != V.ID)
                {
                    ListViewItem LVI = lvVSS.Items.Add(V.ControlAddress);
                    LVI.SubItems.Add(V.ControlPort.ToString());
                    LVI.Tag = V;

                    if(DidOnce == false)
                    {
                        DidOnce = true;
                        LVI.Selected = true;
                        lvVSS_SelectedIndexChanged(lvVSS,new EventArgs());
                    }
                }
            }
        }
Exemplo n.º 14
0
        private void btnDeleteR_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            DialogResult DR = MessageBox.Show("Continuing will permanently delete this Scene?","Confirm permanent deletion",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.OK)
            {
                OysterClassLibrary.Room RM = (OysterClassLibrary.Room)lvR.SelectedItems[0].Tag;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.DeleteRoom(RM.ID);
                F.Dispose();
                Trace.WriteLine("Deleted Scene: " + RM.Description + "(" + RM.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                lvR.Items.Clear();
                FrmParent.LoginUser = FrmParent.OSystem.Refresh();
                bool DidOnce = false;
                //Reset_All();
                foreach(OysterClassLibrary.Room R in FrmParent.OSystem.ROOMS)
                {
                    if(UO[1] != R.ID)
                    {
                        ListViewItem LVI = lvR.Items.Add(R.Description);
                        LVI.Tag = R;

                        if(DidOnce == false)
                        {
                            DidOnce = true;
                            LVI.Selected = true;
                            lvR_SelectedIndexChanged(lvR,new EventArgs());
                        }
                    }
                }

            }
        }
Exemplo n.º 15
0
        private void btnDeletePubGroup_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            if(lvPublic.SelectedItems.Count == 0)
            {
                MessageBox.Show("You must first select the Group you wish to delete","No Group Selected");
                return;
            }
            DialogResult DD = MessageBox.Show(this,"Permanently delete selected Group","Confirm delete Group",MessageBoxButtons.OKCancel);

            if(DD == DialogResult.Cancel)return;
            lvPublicUR.Clear();
            lvPublicSE.Clear();
            lvPublicUR.Refresh();
            lvPublicSE.Refresh();
            OysterClassLibrary.Group Gp = (OysterClassLibrary.Group)lvPublic.SelectedItems[0].Tag;
            OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
            F.DeleteGroup(Gp.ID);
            F.Dispose();
            Trace.WriteLine("Deleted Public Group: " + Gp.Description + "(" + Gp.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

            FrmParent.LoginUser = FrmParent.OSystem.Refresh();

            lvPublic.Items.Clear();
            //Reset_All();
            if(FrmParent.LoginUser.HighestAuthorityLevel.ID == FrmParent.OSystem.SectionTypeSysAdmin.ID)
            {

                foreach(OysterClassLibrary.Group G in FrmParent.OSystem.GetALLGroups(false))
                {
                    bool PubOnce = false;

                    if(G.IsPublicAccess == true)
                    {
                        ListViewItem pubLVI = lvPublic.Items.Add(G.Description);
                        pubLVI.Tag = G;
                        if(PubOnce == false)
                        {
                            PubOnce = true;
                            pubLVI.Selected = true;
                            lvPublic_SelectedIndexChanged(lvPublic,new EventArgs());
                        }
                    }
                }
            }
            else
            {
                foreach(OysterClassLibrary.Group G in FrmParent.LoginUser.CurrentGroups)
                {
                    bool PubOnce = false;

                    if(G.IsPublicAccess == true)
                    {
                        ListViewItem pubLVI = lvPublic.Items.Add(G.Description);
                        pubLVI.Tag = G;
                        if(PubOnce == false)
                        {
                            PubOnce = true;
                            pubLVI.Selected = true;
                            lvPublic_SelectedIndexChanged(lvPublic,new EventArgs());
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
        private void btnDeleteMBS_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Media Buffer Server?","Confirm permanent deletion",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.OK)
            {
                OysterClassLibrary.MediaBufferServer M = (OysterClassLibrary.MediaBufferServer)lvMBS.SelectedItems[0].Tag;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.DeleteMediaBufferServer(M.ID);
                F.Dispose();
                Trace.WriteLine("Deleted MediaBufferServer: " + M.Address + ":" + M.Port.ToString() + "(" + M.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                lvMBS.Items.Clear();
                FrmParent.LoginUser = FrmParent.OSystem.Refresh();
                bool DidOnce = false;
                //Reset_All();
                foreach(OysterClassLibrary.MediaBufferServer MBS in FrmParent.OSystem.MEDIABUFFERSERVERS)
                {
                    if(UO[3] != MBS.ID)
                    {
                        ListViewItem LVI = lvMBS.Items.Add(MBS.Address);
                        LVI.SubItems.Add(MBS.Port.ToString());
                        LVI.Tag = MBS;

                        if(DidOnce == false)
                        {
                            DidOnce = true;
                            LVI.Selected = true;
                            lvMBS_SelectedIndexChanged(lvMBS,new EventArgs());
                        }
                    }
                }

            }
        }
Exemplo n.º 17
0
        private void btnDeleteCR_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Card Reader?","Confirm permanent deletion",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.OK)
            {
                OysterClassLibrary.CardReader CR = (OysterClassLibrary.CardReader)lvCR.SelectedItems[0].Tag;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.DeleteCardReader(CR.ID);
                F.Dispose();
                Trace.WriteLine("Deleted Card Reader: " + CR.Address + "(" + CR.ID + ") From Scene:" + CR.CurrentRoom.Description + "(" + CR.CurrentRoom.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                lvCR.Items.Clear();
                FrmParent.LoginUser = FrmParent.OSystem.Refresh();
                bool DidOnce = false;
                //Reset_All();
                foreach(OysterClassLibrary.CardReader C in FrmParent.OSystem.CARDREADERS)
                {
                    if(UO[6] != C.ID)
                    {
                        ListViewItem LVI = lvCR.Items.Add(C.Address);
                        LVI.SubItems.Add(C.Port.ToString());
                        LVI.Tag = C;

                        if(DidOnce == false)
                        {
                            DidOnce = true;
                            LVI.Selected = true;
                            lvCR_SelectedIndexChanged(lvCR,new EventArgs());
                        }
                    }
                }
            }
        }
Exemplo n.º 18
0
        private void btnRemoveUser_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            OysterClassLibrary.User SelectedUser = (OysterClassLibrary.User)lvUsers.SelectedItems[0].Tag;
            if(SelectedUser == null)return;
            DialogResult DR = MessageBox.Show(this,"Deleting this User will permanently delete user from this system. All recordings currently owned by this user will be lost.","Delete " + SelectedUser.Description + "?",MessageBoxButtons.OKCancel);
            if(DR == DialogResult.Cancel)
                return;

            try
            {
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.RemoveUser(SelectedUser.ID);
                F.Dispose();
                Trace.WriteLine("Deleted User: "******"(" + SelectedUser.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                FrmParent.LoginUser = FrmParent.OSystem.Refresh();
            }
            catch(Exception Err)
            {
                MessageBox.Show(Err.Message);
                return;
            }
            bool DidOnce = false;
            //Reset_All();
            lvUsers.Items.Clear();
            foreach(OysterClassLibrary.User U in FrmParent.OSystem.CurrentSystemUsers)
            {
                if(UO[0] != U.ID)
                {
                    ListViewItem LVI = lvUsers.Items.Add(U.Description);
                    LVI.Tag = U;
                    if(DidOnce == false)
                    {
                        DidOnce = true;
                        LVI.Selected = true;
                        lvUsers_SelectedIndexChanged(lvUsers,new EventArgs());
                    }
                }
            }
        }
Exemplo n.º 19
0
        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();
        }
Exemplo n.º 20
0
        private void btnFinished_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            int ControlPort = 0;
            int StreamingPort = 0;
            lbSEControlAddress.ForeColor = Color.Black;
            lbSEControlPort.ForeColor = Color.Black;

            lbStreamingPort.ForeColor = Color.Black;
            lbStreamingAddress.ForeColor = Color.Black;

            try
            {
                ControlPort = System.Convert.ToInt32(tbSEControlPort.Text,10);
                if((ControlPort < 1)||(ControlPort > 65535))
                    ControlPort = System.Convert.ToInt32("Mess this up on purpose to trigger catch!",10);
            }
            catch
            {
                MessageBox.Show("Control Port must be a value between 1 and 65535!");
                lbSEControlPort.ForeColor = Color.Red;
                return;
            }
            try
            {
                StreamingPort = System.Convert.ToInt32(tbStreamingPort.Text,10);
                if((ControlPort < 1)||(ControlPort > 65535))
                    ControlPort = System.Convert.ToInt32("Mess this up on purpose to trigger catch!",10);
            }
            catch
            {
                MessageBox.Show("Streaming Port must be a value between 1 and 65535!");
                lbStreamingPort.ForeColor = Color.Red;
                return;
            }
            if(SE != null)
            {
                if((SE.ControlAddress.ToUpper() != tbSEControlAddress.Text.ToUpper())||(SE.ControlPort != ControlPort))
                {

                    if(!FrmParent.OSystem.CheckAddressPortPair(tbSEControlAddress.Text,ControlPort))
                    {
                        lbSEControlAddress.ForeColor = Color.Red;
                        lbSEControlPort.ForeColor = Color.Red;
                        MessageBox.Show("Control Address/Port pair not unique in database");
                        return;
                    }
                }
                if((SE.StreamingAddress.ToUpper()!= tbStreamingAddress.Text.ToUpper())||(StreamingPort != SE.StreamingPort))
                {
                    if(!FrmParent.OSystem.CheckAddressPortPair(tbStreamingAddress.Text,StreamingPort))
                    {
                        lbStreamingAddress.ForeColor = Color.Red;
                        lbStreamingPort.ForeColor = Color.Red;
                        MessageBox.Show("Control Address/Port pair not unique in database");
                        return;
                    }
                }
            }
            else
            {
                if(!FrmParent.OSystem.CheckAddressPortPair(tbSEControlAddress.Text,ControlPort))
                {
                    lbSEControlAddress.ForeColor = Color.Red;
                    lbSEControlPort.ForeColor = Color.Red;
                    MessageBox.Show("Control Address/Port pair not unique in database");
                    return;
                }
                if(!FrmParent.OSystem.CheckAddressPortPair(tbStreamingAddress.Text,StreamingPort))
                {
                    lbStreamingAddress.ForeColor = Color.Red;
                    lbStreamingPort.ForeColor = Color.Red;
                    MessageBox.Show("Control Address/Port pair not unique in database");
                    return;
                }
            }
            int RoomIndex = cbR.SelectedIndex;
            int MBSIndex = cbMBS.SelectedIndex;

            try
            {
                if(SE == null)
                {
                    //Creating new streaming Encoder
                    OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                    F.CreateStreamingEncoder(tbDescription.Text,tbSEControlAddress.Text,ControlPort,tbStreamingAddress.Text,StreamingPort,chkIsMulticast.Checked,chkIsControlableCamera.Checked,
                        Convert.ToInt32(MBSID[MBSIndex,1],10),Convert.ToInt32(RoomID[RoomIndex,1],10),tbStreamingHeader.Text);
                    F.Dispose();
                    Trace.WriteLine("Created Streaming Encoder: " + tbDescription.Text + " " + tbSEControlAddress.Text + ":" + ControlPort.ToString(),System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    SE.Update(tbDescription.Text,tbSEControlAddress.Text,ControlPort,tbStreamingAddress.Text,StreamingPort,chkIsMulticast.Checked,chkIsControlableCamera.Checked,
                        Convert.ToInt32(MBSID[MBSIndex,1],10),Convert.ToInt32(RoomID[RoomIndex,1],10),tbStreamingHeader.Text);
                    Trace.WriteLine("Edited Streaming Encoder: " + SE.Description + "(" + SE.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
                    this.DialogResult = DialogResult.OK;
                }
            }
            catch(Exception Err)
            {
                MessageBox.Show(this,Err.Message,"Streaming Encoder Window");
                return;
            }
        }
Exemplo n.º 21
0
        /*
            private void MediaPlayer_ErrorEvent(object sender, System.EventArgs e)
            {

               // AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Player = (AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer) sender;
                AxWMPLib.AxWindowsMediaPlayer Player = (AxWMPLib.AxWindowsMediaPlayer) sender;

                string sError = Player.Error.ToString();

                if((sError == "An unknown error has occurred.")||(sError == "Failed to set the property on this stream."))
                {

                }
                else if(sError == "Cannot play back the file.  The format is not supported.")
                {
                    MessageBox.Show("Cannot play back file. Either file is missing or Video Server is down.","Adminstrative Software Video Playback Error");
                }
                else
                    MessageBox.Show(sError,"Video Player Message");

                try
                {
                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;
                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
            {
                AxWMPLib.AxWindowsMediaPlayer Player = (AxWMPLib.AxWindowsMediaPlayer) sender;
                //AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer Player = (AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer) sender;

                string sError = Player.Error.ToString();

                if((sError == "An unknown error has occurred.")||(sError == "Failed to set the property on this stream."))
                {

                }
                else if(sError == "Cannot play back the file.  The format is not supported.")
                {
                    MessageBox.Show("Cannot play back file. Either file is missing or Video Server is down.","Adminstrative Software Video Playback Error");
                }
                else
                    MessageBox.Show(sError,"Video Player Message");

                try
                {
                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;
                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_EndOfStream(object sender, AxWMPLib._WMPOCXEvents_EndOfStreamEvent e)
            {
                try
                {

                    btnPause.ForeColor = System.Drawing.Color.Black;
                    btnReverse.ForeColor = Color.Black;
                    btnForward.ForeColor = Color.Black;

                    btnPlay.Enabled = true;
                    btnPause.Enabled = false;
                    btnStop.Enabled = false;
                    btnForward.Enabled = false;
                    btnReverse.Enabled = false;
                    btnGoTo.Enabled = false;
                    tbHR.Enabled = false;
                    tbMin.Enabled = false;
                    tbSec.Enabled = false;

                }
                catch(Exception Err)
                {
                    string peekerror = Err.Message;
                }
            }

            private void MediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
            {
                HeadSpeedCount = 0;
                ReverseTimer.Enabled = false;
                ForwardTimer.Enabled = false;
                //if(e.newState == e.oldState) return;

                switch(e.newState)
                {
                    case 0:

                        btnPause.ForeColor = System.Drawing.Color.Black;
                        btnReverse.ForeColor = Color.Black;
                        btnForward.ForeColor = Color.Black;
                        MediaPlayer.Ctlcontrols.currentPosition = 0;
                        btnPlay.Enabled = true;
                        btnPause.Enabled = false;
                        btnStop.Enabled = false;
                        btnForward.Enabled = false;
                        btnReverse.Enabled = false;

                        break;
                    case 1:

                        btnPause.ForeColor = System.Drawing.Color.Red;
                        btnPlay.Enabled = false;
                        btnPause.Enabled = true;
                        btnStop.Enabled = true;
                        btnForward.Enabled = true;
                        btnReverse.Enabled = true;
                        break;
                    case 2:

                        btnPause.ForeColor = System.Drawing.Color.Black;
                        btnPlay.Enabled = true;
                        btnPause.Enabled = false;
                        btnStop.Enabled = true;
                        btnForward.Enabled = true;
                        btnReverse.Enabled = true;
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                    case 5:
                        break;
                    case 6:
                        break;
                    case 7:
                        break;
                    case 8:
                        MediaPlayer.Ctlcontrols.currentPosition = 0;
                        btnPlay.Enabled = false;
                        btnPause.Enabled = false;
                        btnStop.Enabled = false;
                        btnForward.Enabled = false;
                        btnReverse.Enabled = false;
                        break;
                }
            }

            */
        private void tbActionBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            if(e.Button == tbActionBar.Buttons[0])
            {
                switch(e.Button.Text)
                {
                    case "Add User(s)":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.Section)
                            {
                                g_objSection = (OysterClassLibrary.Section)XNode.Tag;
                                PassOysterData POD = new PassOysterData();
                                POD.CurrentSection = g_objSection;
                                POD.CurrentUser = LoginUser;
                                POD.OSystem = OSystem;

                                AddUsersDialog1 AUD = new AddUsersDialog1();
                                AUD.Tag = POD;
                                DialogResult DR = AUD.ShowDialog(this);
                                POD = (PassOysterData)AUD.Tag;
                                AUD.Dispose();
                                if(DR == DialogResult.Abort)
                                {
                                    MessageBox.Show("An error has occurred attempting to open AddUsersDialog!");
                                    return;
                                }
                                else if(DR == DialogResult.OK)
                                {

                                    if(POD.NumMessages != 0)
                                    {
                                        string Display_Errors = "";
                                        foreach(string err_msg in POD.sMessage)
                                        {
                                            if(err_msg != "")
                                                Display_Errors += "\n" + "System Error! Failed to Add User: "******"One or more Users failed to be Added to Group! These Users may have been deleted by another party...");
                                    }
                                    if(POD.IsSuccess == true)
                                    {
                                        LoginUser = OSystem.Refresh();
                                        BuildUserHierarchy();
                                    }
                                }
                            }
                        }
                        break;

                    case "Edit User":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.User)
                            {
                                UserWizard UW = new UserWizard();
                                UW.Tag = XNode.Tag;
                                DialogResult DR = UW.ShowDialog(this);
                                UW.Dispose();
                                if(DR == DialogResult.OK)
                                {
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                }
                                else
                                {
                                    return;
                                }
                            }

                        }
                        break;
                    case "Create New User":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is string)
                            {
                                UserWizard UW = new UserWizard();

                                DialogResult DR = UW.ShowDialog(this);
                                UW.Dispose();
                                if(DR == DialogResult.OK)
                                {
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                        break;
                    case "View Recording":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode = treeView1.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.Recording)
                            {
                                g_objRecording = (OysterClassLibrary.Recording)XNode.Tag;
                                ShowDisplay(ShowRecordingInfo);
                                CurrentPlayingRecording = g_objRecording;
                                btnPlay.Enabled = false;

                                //						MediaPlayer.Height = 512;
                                //						MediaPlayer.Width = 696;
                                //						MediaPlayer.Location  = new System.Drawing.Point(pnlRecordingInfo.Location.X + 28, pnlRecordingInfo.Location.Y + 53);

                                OysterClassLibrary.VideoStorageServer VSS =  OSystem.GetVideoStorageServerById(g_objRecording.VideoStorageServerID);
                                string sRecording = "";
                                if(VSS.ControlAddress != "Not Assigned")
                                {
                                    OysterClassLibrary.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;

                                    bool UsePort = Convert.ToBoolean(VST["UsePort"]);
                                    string StreamHeader = (string)VST["StreamHeader"];
                                    string VSS_Directory = VSS.StorageDirectory;//(string)VST["OysterSourceDirectory"];
                                    if(VSS_Directory != "")
                                        sRecording = StreamHeader + VSS.ControlAddress + "/" + VSS_Directory + "/" + g_objRecording.Description;
                                    else if(UsePort == true)
                                        sRecording = StreamHeader + VSS.ControlAddress + ":" + VSS.ControlPort + "/" + VSS_Directory + "/" + g_objRecording.Description;
                                    else
                                        sRecording = StreamHeader + VSS.ControlAddress + "/" + g_objRecording.Description;
                                }
                                else
                                    sRecording = "d://" + g_objRecording.Description;
                                try
                                {
                                    WWWW.Open(sRecording);
                                    // MediaPlayer.URL = sRecording;
                                    //frmPlayer fP = new frmPlayer();
                                    //fP.sURL = sRecording;
                                    //fP.Show();
                                    gLastRecording = sRecording;
                                    //MediaPlayer.Ctlcontrols.play();
                                    //btnPlay_Click(btnPlay,new EventArgs());

                                }
                                catch(Exception Err)
                                {
                                    MessageBox.Show(Err.Message + ":" + Err.InnerException);
                                }

                                // btnPlay.Enabled = true;
                            }
                        }
                        break;
                    case "View Camera":
                        if(tvCameras.SelectedNode != null)
                        {
                            TreeNode XNode = tvCameras.SelectedNode;
                            if(XNode.Tag is OysterClassLibrary.StreamingEncoder)
                            {
                                OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)XNode.Tag;
                                string sURL = "";
                                switch(SE.StreamingHeader.ToLower())
                                {
                                    case "vbricksys://":
                                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort.ToString();

                                        break;
                                    case "vbrick://":
                                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort.ToString();
                                        break;
                                    default:
                                        MessageBox.Show("System not able to read header: '" + SE.StreamingHeader + "' at this time");
                                        return;
                                        break;
                                }
                                //								CameraPlayer.URL = sURL;
                                //								CameraPlayer.Ctlcontrols.play();
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
            else if(e.Button == tbActionBar.Buttons[2])
            {
                switch(e.Button.Text)
                {
                    case "Record Scene":
                        TreeNode RSNode = tvCameras.SelectedNode;

                        if(RSNode.Tag is OysterClassLibrary.Room)
                        {
                            OysterClassLibrary.Room RM = (OysterClassLibrary.Room)RSNode.Tag;

                            frmRecordScene RC = new frmRecordScene();
                            RC.ThisRoom = RM;

                            DialogResult DR = RC.ShowDialog(this);
                            if(DR == DialogResult.Abort)
                            {
                                //MessageBox.Show("Detected Abort");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                //MessageBox.Show("Detected OK");
                            }
                        }
                        break;
                    case "Control Camera":
                        TreeNode XNode = tvCameras.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.StreamingEncoder)
                        {
                            OysterClassLibrary.StreamingEncoder SE = (OysterClassLibrary.StreamingEncoder)XNode.Tag;

                            frmCameraControl CC = new frmCameraControl();
                            CC.CodecAddress = SE.ControlAddress;
                            CC.CodecPort = SE.ControlPort;

                            CC.ShowDialog(this);
                        }

                        break;
                    case "Delete User(s)":
                        DialogResult DR2 = new DialogResult();

                        DR2 = MessageBox.Show(this,"You have the authority to permanently delete any User in the System! For each User that you delete all of that User's Recordings will also be permanently deleted!","Show Delete User(s) Screen?",MessageBoxButtons.YesNo);
                        if(DR2 == DialogResult.No)
                            return;
                        Status(g_objUser.Description + " is preparing to delete users....");
                        Form RU = new RemoveUsers();

                        g_OAU.AllUsers = OSystem.CurrentSystemUsers;
                        g_OAU.CurrentUser = LoginUser;
                        g_OAU.CurrentBody = null;
                        g_OAU.ThisCurrentSectionType = LoginUser.HighestAuthorityLevel;
                        g_OAU.TrueDelete = true;

                        RU.Tag = g_OAU;
                        RU.ShowDialog(this);

                        if(RU.DialogResult == DialogResult.OK)
                        {
                            AdministrativeSoftware.RemoveUsers.User_List UL = (AdministrativeSoftware.RemoveUsers.User_List) RU.Tag;
                            foreach(string sUser in UL.DeletedUsers)
                                Status("Permanently deleted User: "******" has aborted Delete User operation.");
                            RU.Dispose();
                        }
                        break;
                    case "Remove User(s)":
                        if(treeView1.SelectedNode != null)
                        {
                            TreeNode XNode2 = treeView1.SelectedNode;
                            if(XNode2.Tag is OysterClassLibrary.Section)
                            {
                                g_objSection = (OysterClassLibrary.Section)XNode2.Tag;
                                DialogResult DR3 = new DialogResult();

                                OysterClassLibrary.SectionType UT = OSystem.GetSectionTypeById(g_objSection.CreatedBySectionType.NextSectionTypeID);

                                DR3 = MessageBox.Show(this,"You have the authority to remove any " + UT.Description  + " in this " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription + ". For each " + UT.Description  + " that you delete all of that " + UT.Description  + "'s recordings will also be permanently deleted!","Show Delete " + UT.Description  + "(s) Screen?",MessageBoxButtons.YesNo);
                                if(DR3 == DialogResult.No)
                                    return;

                                Form RU2 = new RemoveUsers();

                                g_OAU.AllUsers = null;
                                g_OAU.CurrentUser = null;
                                g_OAU.CurrentBody = g_objSection;
                                g_OAU.ThisCurrentSectionType = g_objSection.CreatedBySectionType;
                                g_OAU.TrueDelete = false;
                                g_OAU.iLocalMBSAddress = LocalIpAddress;

                                RU2.Tag = g_OAU;

                                RU2.ShowDialog(this);

                                if(RU2.DialogResult == DialogResult.OK)
                                {
                                    AdministrativeSoftware.RemoveUsers.User_List UL = (AdministrativeSoftware.RemoveUsers.User_List) RU2.Tag;
                                    foreach(string sUser in UL.DeletedUsers)
                                        Status("Removed User: "******" has aborted Remove User operation.");
                                    RU2.Dispose();
                                }
                            }
                        }
                        break;
                    case "Reassign Recording":
                        AdministrativeSoftware.PassRecordingInfo PRI= new AdministrativeSoftware.PassRecordingInfo();

                        ListView lvMember = new ListView();

                        OysterClassLibrary.Section B = OSystem.GetSectionById(g_objRecording.CurrentSectionID);

                        PRI.objSectionType = CurrentSectionType;
                        OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                        OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections;//F.GetMemberSections(LoginUser.ID,false);
                        if(PRI.objSectionType == null)
                            PRI.objSectionType = HighestSectionType;
                        F.Dispose();
                        //Check to See if B is in LoginUsers Hierarchy
                        if(!B.IsMember)
                        {
                            ListView lvCheckEm = new ListView();
                            if(B.IsDefault)
                            {
                                foreach(OysterClassLibrary.Section TSection in LoginUser.AllOwnedSections)
                                {
                                    if(!TSection.IsDefault)
                                    {
                                        bool AddToMe = true;
                                        foreach(ListViewItem LVIK in lvMember.Items)
                                        {
                                            OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVIK.Tag;

                                            if(lvMSection.ID == TSection.ID)
                                            {
                                                AddToMe = false;
                                                break;
                                            }
                                        }
                                        if(AddToMe)
                                        {
                                            ListViewItem LVAM = lvMember.Items.Add(TSection.Description);
                                            LVAM.Tag = TSection;
                                        }
                                    }
                                }
                            }

                            foreach(OysterClassLibrary.Section MySection in LoginUser.AllOwnedSections)
                            {
                                if((!MySection.IsDefault)&&(MySection.CreatedBySectionType.ID != OSystem.SectionTypeSysAdmin.ID))

                                {
                                    bool AddToMe = true;
                                    foreach(ListViewItem LVJK in lvMember.Items)
                                    {
                                        OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVJK.Tag;

                                        if(lvMSection.ID == MySection.ID)
                                        {
                                            AddToMe = false;
                                            break;
                                        }
                                    }
                                    if(AddToMe)
                                    {
                                        ListViewItem LVI = lvCheckEm.Items.Add(MySection.Description);
                                        LVI.Tag = MySection;
                                    }
                                }
                            }

                            if(lvCheckEm.Items.Count != 0)
                            {
                                foreach(ListViewItem TLVI in lvCheckEm.Items)
                                {
                                    OysterClassLibrary.Section S = (OysterClassLibrary.Section)TLVI.Tag;
                                    ListViewItem LII = lvMember.Items.Add(S.Description);
                                    LII.Tag = S;

                                    foreach(OysterClassLibrary.User U in S.AllUsersInHierarchy)
                                    {
                                        foreach(OysterClassLibrary.Section USection in U.AllOwnedSections)
                                        {
                                            if(S.IsSectionInMyHierarchy(USection.ID))
                                            {
                                                bool AddToMe = true;
                                                foreach(ListViewItem LVIK in lvMember.Items)
                                                {
                                                    OysterClassLibrary.Section lvMSection = (OysterClassLibrary.Section)LVIK.Tag;

                                                    if(lvMSection.ID == USection.ID)
                                                    {
                                                        AddToMe = false;
                                                        break;
                                                    }
                                                }
                                                if(AddToMe)
                                                {
                                                    ListViewItem LVAM = lvMember.Items.Add(USection.Description);
                                                    LVAM.Tag = USection;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                        }

                        if(PRI.objSectionType.ID == OSystem.SectionTypeSysAdmin.ID)
                        {
                            foreach(OysterClassLibrary.Section SystemBody in LoginUser.AllOwnedSections)
                            {
                                if(SystemBody.IsDefault == false)
                                {
                                    if(SystemBody.CreatedBySectionTypeID != OSystem.SectionTypeSysAdmin.ID)
                                    {
                                        bool AddIt = true;
                                        foreach(ListViewItem ALVI in lvMember.Items)
                                        {
                                            OysterClassLibrary.Section OS = (OysterClassLibrary.Section)ALVI.Tag;

                                            if(OS.ID == SystemBody.ID)
                                            {
                                                AddIt = false;
                                                break;
                                            }
                                        }
                                        if(AddIt)
                                        {
                                            ListViewItem LI = new ListViewItem();
                                            LI = lvMember.Items.Add(SystemBody.Description);
                                            LI.Tag = SystemBody;
                                        }
                                    }
                                    GatherAllBodys(lvMember,SystemBody.CurrentUsers);
                                }
                            }
                        }
                        else
                        {
                            if(!B.IsDefault)
                            {
                                if(B.CreatedBySectionTypeID != OSystem.SectionTypeSysAdmin.ID)
                                {
                                    bool AddIt = true;
                                    foreach(ListViewItem BLVI in lvMember.Items)
                                    {
                                        OysterClassLibrary.Section OS = (OysterClassLibrary.Section)BLVI.Tag;

                                        if(OS.ID == B.ID)
                                        {
                                            AddIt = false;
                                            break;
                                        }
                                    }
                                    if(AddIt)
                                    {
                                        ListViewItem LI = new ListViewItem();
                                        LI = lvMember.Items.Add(B.Description);
                                        LI.Tag = B;
                                    }
                                }
                                GatherAllBodys(lvMember,B.CurrentUsers);
                            }
                            foreach(OysterClassLibrary.Section M in MembersOf)
                            {
                                bool AddIt = true;
                                foreach(ListViewItem ALVI in lvMember.Items)
                                {
                                    OysterClassLibrary.Section OS = (OysterClassLibrary.Section)ALVI.Tag;

                                    if(OS.ID == M.ID)
                                    {
                                        AddIt = false;
                                        break;
                                    }
                                }
                                if(AddIt)
                                {
                                    ListViewItem LA = lvMember.Items.Add(M.Description);
                                    LA.Tag = M;
                                }
                            }
                        }
                        if(lvMember.Items.Count == 0)
                        {
                            MessageBox.Show("No Member Sections or Owned Sections detected for " + LoginUser.FirstName + " " + LoginUser.LastName +
                                " at this time.","No legal location to send recording...abort action.");
                            return;
                        }

                        PRI.CurrentUser = LoginUser;
                        PRI.Rec = g_objRecording;
                        PRI.LV = lvMember;
                        PRI.OSystem = OSystem;
                        //PRI.objSectionType = CurrentSectionType;

                        Form RA = new frmMoveRecording();

                        RA.Tag = PRI;

                        RA.ShowDialog(this);

                        if(RA.DialogResult == DialogResult.OK)
                        {
                            LoginUser = OSystem.Refresh();
                            BuildUserHierarchy();
                        }
                        else
                            RA.Dispose();
                        break;
                    default:
                        break;
                }
            }
            else if(e.Button == tbActionBar.Buttons[4])
            {
                string sEditButton = "Edit " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;

                if(e.Button.Text == sEditButton) //Edit Section
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.CurrentSection = (OysterClassLibrary.Section)XNode.Tag;
                            PSI.PreviousSection = PSI.CurrentSection.PreviousSection;
                            PSI.OSystem = OSystem;
                            PSI.CurrentUser = LoginUser;
                            PSI.IsEdit = true;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Edit " + PSI.CurrentSection.Description + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }
                        }
                    }
                }
                else if(e.Button.Text == "Remove User")
                {
                    //User doesn't exist
                    System.Windows.Forms.DialogResult DR = new System.Windows.Forms.DialogResult();
                    bool bSuccess = false;
                    TreeNode X = null;
                    //int ErrorNumber = 0;
                    if(g_objUser == null)
                    {
                        X = treeView1.SelectedNode;
                        if(X == null)return;
                        g_objUser = (OysterClassLibrary.User)X.Tag;
                    }

                    if(g_objUser == null)return;

                    string UserName = g_objUser.FirstName + " " + g_objUser.MiddleName + ". " + g_objUser.LastName;
                    DR = System.Windows.Forms.MessageBox.Show("Removing " + UserName + " will delete any of " +
                        UserName + " recordings that are assigned to " + g_objUser.CurrentSection.Description + ".", "Do you wish to proceed with Remove User?", System.Windows.Forms.MessageBoxButtons.YesNo);
                    if(DR == DialogResult.Yes)
                    {
                        OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                        try
                        {
                            //OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                            try
                            {
                                F.RemoveUser(g_objUser.ID,g_objUser.CurrentSectionID);
                                F.Dispose();

                                g_objSection = g_objUser.CurrentSection;
                                bSuccess = true;
                            }
                            catch(Exception Err)
                            {
                                string peekError = Err.Message;
                                bSuccess = false;
                            }
                            //       bSuccess = objBody.DestroyUser(g_objUser,false,ref ErrorNumber);
                            if(bSuccess ==true)
                            {

                                Status("Successfully Removed " + g_objUser.Description + " from " + g_objSection.Description);

                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                                ShowDisplay(ShowGroupInfo);
                            }
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                            return;
                        }
                    }
                }
                else if(e.Button.Text == "Rename Recording")
                {
                    UpdateRecording RR = new UpdateRecording();

                    RR.Tag = g_objRecording;
                    RR.ShowDialog(this);

                    if(RR.DialogResult == DialogResult.OK)
                    {
                        BuildUserHierarchy();
                        //ShowDisplay(ShowRecordingInfo);
                        Status("Rename Recording completed.");
                        RR.Dispose();
                    }
                    else
                        Status("Aborted Rename Recording operation.");
                    RR.Dispose();
                }
                else
                {
                    switch(e.Button.Text)
                    {
                        default:
                            break;
                    }
                }
            }
            else if(e.Button == tbActionBar.Buttons[6])
            {
                string sNewSection = "";
                string sDeleteSection = "";
                string sSType = "";
                //TreeNode YNode = treeView1.SelectedNode;
                if(treeView1.SelectedNode.Tag is OysterClassLibrary.User)
                {
                    sSType = g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                    sNewSection = "New " + sSType;
                }
                else if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section)
                {
                    if(g_objSection.ID == MainSystemSection.ID)
                    {
                        sSType = g_objSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;

                    }
                    else
                    {
                        sSType = g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                    }
                    sDeleteSection = "Delete " + sSType;
                    sNewSection = "New " + sSType;

                }
                if(e.Button.Text == sNewSection)
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.PreviousSection = (OysterClassLibrary.Section)XNode.Tag;
                            PSI.OSystem = OSystem;
                            PSI.CurrentUser = LoginUser;
                            PSI.IsEdit = false;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Create New " + PSI.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }

                        }
                        else if(XNode.Tag is OysterClassLibrary.User)
                        {
                            OysterClassLibrary.User UU = (OysterClassLibrary.User)XNode.Tag;
                            SectionWizard SW = new SectionWizard();
                            PassSectionInfo PSI = new PassSectionInfo();
                            PSI.PreviousSection = UU.CurrentSection;
                            PSI.CurrentUser = UU;
                            PSI.OSystem = OSystem;
                            PSI.IsEdit = false;
                            SW.Tag = PSI;
                            DialogResult DR = SW.ShowDialog(this);
                            SW.Dispose();
                            if(DR == DialogResult.Abort)
                            {
                                MessageBox.Show("Create New " + PSI.PreviousSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription + " failed");
                            }
                            else if(DR == DialogResult.OK)
                            {
                                LoginUser = OSystem.Refresh();
                                BuildUserHierarchy();
                            }
                        }
                    }
                }
                else if(e.Button.Text == sDeleteSection)
                {
                    if(treeView1.SelectedNode != null)
                    {
                        TreeNode XNode = treeView1.SelectedNode;
                        if(XNode.Tag is OysterClassLibrary.Section)
                        {
                            System.Windows.Forms.DialogResult DR = new System.Windows.Forms.DialogResult();
                            bool bSuccess = false;

                            DR = System.Windows.Forms.MessageBox.Show("Destroying " + g_objSection.Description + " will permanently destroy ALL Recordings that have been assigned to this " + sSType,"Do you wish to proceed with Delete " + sSType + "?",System.Windows.Forms.MessageBoxButtons.YesNo);

                            if(DR == DialogResult.Yes)
                            {
                                Status(LoginUser.Description + " gave order to proceed with deletion...");
                                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                                OysterClassLibrary.User objUser = F.GetUser(g_objSection.OwnerID);
                                if(objUser == null)
                                    return;
                                try
                                {
                                    F.RemoveSection(g_objSection.ID);
                                    F.Dispose();
                                    bSuccess = true;
                                }
                                catch(Exception Err)
                                {
                                    string peekerror = Err.Message;
                                    F.Dispose();
                                    bSuccess = false;
                                }

                                if(bSuccess ==true)
                                {
                                    Status("Successfully deleted: " + g_objSection.Description);
                                    //cbSectionType.Items.Clear();
                                    //cbSectionType.Text = "";
                                    LoginUser = OSystem.Refresh();
                                    BuildUserHierarchy();
                                    ShowDisplay(ShowGroupInfo);
                                }
                            }
                        }
                    }
                }
                else if(e.Button.Text == "Delete Recording")
                {
                    DialogResult DR = new DialogResult();
                    if((btnPlay.Enabled == true)||(btnPause.Enabled == true)||(btnStop.Enabled == true))
                    {
                        try
                        {
                            //                            MediaPlayer.Ctlcontrols.stop();
                            if(gLastRecording != "")
                            {
                                try
                                {
                                    // MediaPlayer.URL = "";
                                }
                                catch(Exception Err)
                                {
                                    string peekerror = Err.Message;
                                }
                            }
                            btnPlay.Enabled = false;

                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                        }

                    }

                    DR = MessageBox.Show(this,"Do you wish to permanently delete tne recording: '" + g_objRecording.DisplayName + "'","Deleting Recording",MessageBoxButtons.YesNo);

                    if(DR == DialogResult.No)
                        return;
                    OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                    TreeNode X = treeView1.SelectedNode;
                    string test = X.Text;
                    X = X.Parent;
                    test = X.Text;
                    OysterClassLibrary.Section B = F.GetSection(g_objRecording.CurrentSectionID);

                    if(g_objRecording.CurrentUserID == g_objRecording.OwnerID)
                    {
                        int CurrentUser = 0;
                        if(g_objUser == null)
                        {
                            if(g_objRecording.CurrentUserID == 0)
                                CurrentUser = LoginUser.ID;
                            else
                                CurrentUser = g_objRecording.CurrentUserID;
                        }
                        else
                            CurrentUser = g_objUser.ID;
                        try
                        {
                            F.RemoveRecording(g_objRecording.ID,CurrentUser,B.ID);
                            LoginUser = OSystem.Refresh();
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message,"Error occurred during Delete Recording operation");
                        }
                        BuildUserHierarchy();
                        return;
                    }
                    else  // test == "Recordings" which means all we have to do is go up till we find the body it is attached to
                    {
                        try
                        {
                            F.RemoveRecording(g_objRecording.ID,g_objRecording.CurrentUserID,g_objRecording.CurrentSectionID);
                            LoginUser = OSystem.Refresh();
                            BuildUserHierarchy();
                            return;
                        }
                        catch(Exception Err)
                        {
                            MessageBox.Show(Err.Message);
                            return;
                        }
                    }
                }
                else
                {
                    switch(e.Button.Text)
                    {
                        default:
                            break;
                    }
                }
            }
            else if(e.Button == tbActionBar.Buttons[8])
            {
                if(e.Button.Text == "View Notes")
                {
                    if(FN != null)
                    {
                        if(FN.IsDisposed != true)
                        {
                            FN.Dispose();
                        }
                    }
                    FN = new frmNotes();
                    FN.Owner = this;
                    LastSelectedRecording = g_objRecording;
                    FN.Show();
                }
            }
        }
Exemplo n.º 22
0
        private void MediaBufferServerWizard_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is System_Properties)
                FrmParent = (Form1)this.Owner.Owner;
            else if(this.Owner is Form1)
                FrmParent = (Form1)this.Owner;
            else
            {
                MessageBox.Show("Illegal open attempt made on Forwarding Server Wizard");
                return;
            }
            if(this.Tag is OysterClassLibrary.MediaBufferServer)
            {
                MBS = (OysterClassLibrary.MediaBufferServer)this.Tag;
                tbAddress.Text = MBS.Address;
                tbPort.Text = MBS.Port.ToString();
                tbFileDirectory.Text = MBS.StorageDirectory;
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                OysterClassLibrary.ForwardingServers AF = F.ALLForwardingServers();
                F.Dispose();
                FSID = new string[AF.Count,2];
                int iCount = 0;

                foreach(OysterClassLibrary.ForwardingServer FS in AF)
                {
                    FSID[iCount,0] = FS.Address + ":" + FS.Port.ToString();
                    FSID[iCount,1] = FS.ID.ToString();
                    cbMBSFS.Items.Add(FSID[iCount,0]);

                    if(FS.ID == MBS.ForwardingServerID)
                        cbMBSFS.Text = FSID[iCount,0];

                    iCount++;
                }
                this.Text = "Editing " + MBS.Address + ":" + MBS.Port.ToString();
            }
            else
            {
                this.Text = "Creating New Media Buffer Server";
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                OysterClassLibrary.ForwardingServers AF = F.ALLForwardingServers();

                FSID = new string[AF.Count,2];
                int iCount = 0;
                int[] UO = F.GetUnassignedObjects();
                F.Dispose();
                foreach(OysterClassLibrary.ForwardingServer FS in AF)
                {
                    FSID[iCount,0] = FS.Address + ":" + FS.Port.ToString();
                    FSID[iCount,1] = FS.ID.ToString();
                    cbMBSFS.Items.Add(FSID[iCount,0]);
                    if(FS.ID == UO[2])
                        cbMBSFS.Text = FSID[iCount,0];
                    iCount++;
                }
            }
        }
Exemplo n.º 23
0
        private void btnFinished_Click(object sender, System.EventArgs e)
        {
            this.DialogResult = DialogResult.None;
            int ControlPort = 0;
            lbFSAddress.ForeColor = Color.Black;
            lbFSPort.ForeColor = Color.Black;

            try
            {
                ControlPort = System.Convert.ToInt32(tbFSPort.Text,10);
                if((ControlPort < 1)||(ControlPort > 65535))
                    ControlPort = System.Convert.ToInt32("Mess this up on purpose to trigger catch!",10);
            }
            catch
            {
                MessageBox.Show("Control Port must be a value between 1 and 65535!");
                lbFSPort.ForeColor = Color.Red;
                return;
            }

            if(FS != null)
            {
                if((FS.Address != tbFSAddress.Text)||(FS.Port != ControlPort))
                {
                    if(!FrmParent.OSystem.CheckAddressPortPair(tbFSAddress.Text,ControlPort))
                    {
                        MessageBox.Show("Address/Port Pair not unique in system");
                        lbFSAddress.ForeColor = Color.Red;
                        lbFSPort.ForeColor = Color.Red;
                        return;
                    }
                }
            }
            else
            {
                if(!FrmParent.OSystem.CheckAddressPortPair(tbFSAddress.Text,ControlPort))
                {
                    MessageBox.Show("Address/Port Pair not unique in system");
                    lbFSAddress.ForeColor = Color.Red;
                    lbFSPort.ForeColor = Color.Red;
                    return;
                }
            }
            int VSIndex = cbFSVSS.SelectedIndex;

            if(FS == null)
            {
                //Creating New Forwarding Server
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();
                F.CreateForwardingServer(tbFSAddress.Text,Convert.ToInt32(VSID[VSIndex,1],10),ControlPort);
                F.Dispose();

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                //Editing Current Forward Server
                FS.Update(tbFSAddress.Text,Convert.ToInt32(VSID[VSIndex,1],10),ControlPort);
                Trace.WriteLine("Edited Forwarding Server: " + FS.Address + "(" + FS.ID + ")",
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                this.DialogResult = DialogResult.OK;
            }
        }
Exemplo n.º 24
0
        private void btnFinished_Click(object sender, System.EventArgs e)
        {
            FrmParent.PostActivity();
            int ControlPort = 0;
            try
            {
                ControlPort = System.Convert.ToInt32(tbPort.Text,10);
                if((ControlPort < 1)||(ControlPort > 65535))
                    ControlPort = System.Convert.ToInt32("Mess this up on purpose to trigger catch!",10);
            }
            catch
            {
                MessageBox.Show("Control Port must be a value between 1 and 65535!");
                lbPort.ForeColor = Color.Red;
                return;
            }
            int FSIndex = cbMBSFS.SelectedIndex;
            if(MBS != null)
            {
                if((MBS.Address.ToUpper() != tbAddress.Text.ToUpper())||(MBS.Port != ControlPort))
                {
                    bool IsGood = FrmParent.OSystem.CheckAddressPortPair(tbAddress.Text,ControlPort);
                    if(IsGood == false)
                    {
                        if(!FrmParent.OSystem.CheckAddressPortPair(tbAddress.Text,ControlPort))
                        {
                            MessageBox.Show("Address/Port Pair not unique in system");
                            lbServerAddress.ForeColor = Color.Red;
                            lbPort.ForeColor = Color.Red;
                            return;
                        }
                    }
                }
            }
            else
            {
                if(!FrmParent.OSystem.CheckAddressPortPair(tbAddress.Text,ControlPort))
                {
                    MessageBox.Show("Address/Port Pair not unique in system");
                    lbServerAddress.ForeColor = Color.Red;
                    lbPort.ForeColor = Color.Red;
                    return;
                }
            }

            if(MBS == null)
            {
                //Create New Media Buffer Server
                OysterClassLibrary.Functions F = new OysterClassLibrary.Functions();

                F.CreateMediaBufferServer(tbAddress.Text,Convert.ToInt32(FSID[FSIndex,1],10),tbFileDirectory.Text,ControlPort);
                Trace.WriteLine("Created MediaBufferServer: " + tbAddress.Text + ":" + ControlPort.ToString() + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);

                F.Dispose();
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                //Editing Current Media Buffer Server
                MBS.Update(tbAddress.Text,Convert.ToInt32(FSID[FSIndex,1],10),tbFileDirectory.Text,ControlPort);
                Trace.WriteLine("Edited MediaBufferServer: " + MBS.Address + ":" + MBS.Port.ToString() +"(" + MBS.ID.ToString() + ")",System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
                this.DialogResult = DialogResult.OK;
            }
        }