Esempio n. 1
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();
                }
            }
        }
Esempio n. 2
0
        //TreeView Control Functions
        private void treeView1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            tbActionBar.Buttons[0].Visible = false;
            tbActionBar.Buttons[1].Visible = false;
            tbActionBar.Buttons[2].Visible = false;
            tbActionBar.Buttons[3].Visible = false;
            tbActionBar.Buttons[4].Visible = false;
            tbActionBar.Buttons[5].Visible = false;
            tbActionBar.Buttons[6].Visible = false;
            tbActionBar.Buttons[7].Visible = false;
            tbActionBar.Buttons[8].Visible = false;

            tbActionBar.Buttons[0].Enabled = true;
            //tbActionBar.Buttons[1].Enabled = true;
            tbActionBar.Buttons[2].Enabled = true;
            //tbActionBar.Buttons[3].Enabled = true;
            tbActionBar.Buttons[4].Enabled = true;
            //tbActionBar.Buttons[5].Enabled = true;
            tbActionBar.Buttons[6].Enabled = true;
            //tbActionBar.Buttons[7].Enabled = true;
            tbActionBar.Buttons[8].Enabled = true;

            pnlMediaPlayerControls.Visible = true;
            string NodeText = "";
            TreeNode Y2 = treeView1.SelectedNode;
            if(Y2 != null)
                NodeText = Y2.Text;

            //Y2 = treeView1.GetNodeAt(e.X,e.Y);
            if(Y2 == null) return;
            NodeText = Y2.Text;
            treeView1.SelectedNode = Y2;
            g_RecordingNode = Y2;
            CalculateCurrentSectionType(Y2);
            switch (e.Button)
            {
                case MouseButtons.Left:

                    object UnknownObjA;
                    UnknownObjA = Y2.Tag;
                    if(UnknownObjA is string)
                    {
                        string sText = (string)UnknownObjA;
                        if(sText == "TopofPack")
                        {
                            g_objUser = LoginUser;
                            ShowDisplay(ShowUserInfo);
                            ////////MINITOOLBAR CONFIGURATION
                            foreach(OysterClassLibrary.Permission P in LoginUser.HighestAuthorityLevel.CanDestroyAnyUsers)
                            {
                                tbActionBar.Buttons[0].Text = "Create New User";
                                tbActionBar.Buttons[0].Visible = true;
                                tbActionBar.Buttons[1].Visible = false;
                                tbActionBar.Buttons[1].ToolTipText = "Creates a new user in the system";

                                tbActionBar.Buttons[2].Text = "Delete User(s)";
                                tbActionBar.Buttons[2].Visible = true;
                                tbActionBar.Buttons[2].ToolTipText = "Permanently deletes user from the system";
                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "";
                                tbActionBar.Buttons[4].Visible = false;
                                break;
                            }
                        }

                    }
                    else if(UnknownObjA is OysterClassLibrary.User)
                    {
                        g_objUser = (OysterClassLibrary.User)UnknownObjA;
                        ShowDisplay(ShowUserInfo);
                        int[] UO = OSystem.UnassignedIDs;

                        if(g_objUser.ID != UO[0])
                        {

                            ////////MINITOOLBAR CONFIGURATION
                            ///
                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanEditSectionTypes)
                            {
                                if(P.CanOperateOn == g_objUser.CurrentSection.CreatedBySectionType.NextSectionTypeID)
                                {
                                    tbActionBar.Buttons[0].Text = "Edit User";
                                    tbActionBar.Buttons[0].Visible = true;
                                    tbActionBar.Buttons[1].Visible = false;

                                    tbActionBar.Buttons[2].Text = "";
                                    tbActionBar.Buttons[2].Visible = false;
                                    tbActionBar.Buttons[3].Visible = false;
                                    tbActionBar.Buttons[4].Text = "Remove User";
                                    tbActionBar.Buttons[4].Visible = true;
                                    break;
                                }
                            }

                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanCreateSectionTypes)
                            {
                                if(P.CanOperateOn == g_objUser.CurrentSection.CreatedBySectionType.NextSectionTypeID)
                                {
                                    if(g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.NextSectionTypeID != -99)
                                    {
                                        tbActionBar.Buttons[5].Visible = false;
                                        tbActionBar.Buttons[6].Text = "New " + g_objUser.CurrentSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                                        tbActionBar.Buttons[6].Visible = true;
                                    }
                                    else
                                    {
                                        tbActionBar.Buttons[5].Visible = false;
                                        tbActionBar.Buttons[6].Text = "";
                                        tbActionBar.Buttons[6].Visible = false;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    else if(UnknownObjA is OysterClassLibrary.Section)
                    {
                        g_objSection = (OysterClassLibrary.Section)UnknownObjA;

                        if(g_objSection.ID == MainSystemSection.ID)
                        {
                            tbActionBar.Buttons[0].Text = "Add User(s)";
                            tbActionBar.Buttons[0].Visible = false;
                            tbActionBar.Buttons[1].Visible = false;

                            tbActionBar.Buttons[2].Text = "Remove User(s)";
                            tbActionBar.Buttons[2].Visible = false;
                            tbActionBar.Buttons[3].Visible = false;
                            tbActionBar.Buttons[4].Text = "";
                            tbActionBar.Buttons[4].Visible = false;

                            tbActionBar.Buttons[6].Text = "New " + g_objSection.CreatedBySectionType.NextSectionType.CreatesSectionTypeDescription;
                            tbActionBar.Buttons[6].Visible = true;
                            return;
                        }
                        if(g_objSection.IsMember == true)
                        {
                            tbActionBar.Buttons[0].Visible = false;
                            tbActionBar.Buttons[1].Visible = false;
                            tbActionBar.Buttons[2].Visible = false;
                            tbActionBar.Buttons[3].Visible = false;
                            tbActionBar.Buttons[4].Visible = false;
                            tbActionBar.Buttons[5].Visible = false;
                            tbActionBar.Buttons[6].Visible = false;
                            return;
                        }
                        else if(g_objSection.CreatedBySectionType.PreviousSectionTypeID == -99)
                        {
                            tbActionBar.Buttons[0].Visible = false;
                            tbActionBar.Buttons[1].Visible = false;
                            tbActionBar.Buttons[2].Visible = false;
                            tbActionBar.Buttons[3].Visible = false;
                            tbActionBar.Buttons[4].Visible = false;
                            tbActionBar.Buttons[5].Visible = false;
                            tbActionBar.Buttons[6].Visible = false;
                            return;
                        }
                        ShowDisplay(ShowGroupInfo);
                        ////////MINITOOLBAR CONFIGURATION
                        ///

                        foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanEditSectionTypes)
                        {
                            if(P.CanOperateOn == g_objSection.CreatedBySectionType.NextSectionTypeID)
                            {
                                tbActionBar.Buttons[0].Text = "Add User(s)";
                                tbActionBar.Buttons[0].Visible = true;

                                tbActionBar.Buttons[1].Visible = false;
                                tbActionBar.Buttons[2].Text = "Remove User(s)";
                                tbActionBar.Buttons[2].Visible = true;

                                if(g_objSection.CurrentUsers.Count > 0)
                                {
                                    tbActionBar.Buttons[2].Enabled = true;
                                }
                                else
                                    tbActionBar.Buttons[2].Enabled = false;

                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Edit " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                                tbActionBar.Buttons[4].Visible = true;
                                break;
                            }
                        }
                        foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanRemoveSectionTypes)
                        {
                            if(P.CanOperateOn == g_objSection.CreatedBySectionType.NextSectionTypeID)
                            {
                                tbActionBar.Buttons[5].Visible = false;
                                tbActionBar.Buttons[6].Text = "Delete " + g_objSection.CreatedBySectionType.CreatesSectionTypeDescription;
                                tbActionBar.Buttons[6].Visible = true;
                            }
                        }

                    }
                    else if(UnknownObjA is OysterClassLibrary.Recording)
                    {
                        g_objRecording = (OysterClassLibrary.Recording) UnknownObjA;
                        tbActionBar.Buttons[8].Text = "View Notes";
                        tbActionBar.Buttons[8].Visible = true;

                        //						statusBar1.Text = "Recording : " + g_objRecording.Created;
                        //                        ShowDisplay(ShowRecordingInfo);
                        //                        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")
                        //                        {
                        //                            if(VSS.StorageDirectory != "")
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + VSS.StorageDirectory + "/" + g_objRecording.Description;
                        //                            else
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + g_objRecording.Description;
                        //                        }
                        //                        else
                        //                             sRecording = g_objRecording.Description;

                        //                        if(g_objRecording.VideoStorageServerControlAddress != "Not Assigned")
                        //                        {
                        //                            if(VSS.StorageDirectory != "")
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + VSS.StorageDirectory + "/" + Rec.Description;
                        //                            else
                        //                                sRecording = "mms://" + VSS.ControlAddress + "/" + Rec.Description;
                        //                        }
                        //                        else
                        //                            sRecording = Rec.Description;
                        //                        if(DebugMode == true)
                        //                            sRecording = Recording_Location + g_objRecording.Description + ".mpg";
                        //                        else
                        //                            sRecording = "ivod://" + g_objRecording.VideoStorageServerControlAddress + "/" + g_objRecording.Description + ".mpg";
                        //
                        // btnPlay.Enabled = true;
                        //gLastRecording = sRecording;
                        ////////MINITOOLBAR CONFIGURATION
                        ///
                        tbActionBar.Buttons[0].Text = "View Recording";
                        tbActionBar.Buttons[0].Visible = true;
                        OysterClassLibrary.Section local_objSection = OSystem.GetSectionById(g_objRecording.CurrentSectionID);

                        if((local_objSection != null)&&(local_objSection.IsDefault == false))
                        {
                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanMoveRecordings)
                            {
                                if(P.CanOperateOn == local_objSection.CreatedBySectionType.ID)
                                {
                                    tbActionBar.Buttons[1].Visible = false;
                                    tbActionBar.Buttons[2].Text = "Reassign Recording";
                                    tbActionBar.Buttons[2].Visible = true;
                                    break;
                                }
                            }

                            if(g_objRecording.OwnerID == LoginUser.ID)
                            {
                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Rename Recording";
                                tbActionBar.Buttons[4].Visible = true;
                            }
                            foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanDestroyRecordings)
                            {
                                if(P.CanOperateOn == local_objSection.CreatedBySectionType.ID)
                                {
                                    tbActionBar.Buttons[5].Visible = false;
                                    tbActionBar.Buttons[6].Text = "Delete Recording";
                                    tbActionBar.Buttons[6].Visible = true;
                                }
                            }
                        }
                        else if((local_objSection != null)&&(local_objSection.IsDefault == true))
                        {
                            if(g_objRecording.OwnerID == LoginUser.ID)
                            {
                                foreach(OysterClassLibrary.Permission P in CurrentSectionType.CanMoveRecordings)
                                {
                                    if(P.CanOperateOn == local_objSection.CreatedBySectionType.ID)
                                    {
                                        tbActionBar.Buttons[1].Visible = false;
                                        tbActionBar.Buttons[2].Text = "Reassign Recording";
                                        tbActionBar.Buttons[2].Visible = true;
                                        break;
                                    }
                                }

                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Rename Recording";
                                tbActionBar.Buttons[4].Visible = true;
                            }

                            foreach(OysterClassLibrary.Permission P in LoginUser.HighestAuthorityLevel.CanDestroyRecordings)
                            {
                                tbActionBar.Buttons[5].Visible = false;
                                tbActionBar.Buttons[6].Text = "Delete Recording";
                                tbActionBar.Buttons[6].Visible = true;
                            }
                        }
                        else
                        {
                            if(g_objRecording.OwnerID == LoginUser.ID)
                            {
                                tbActionBar.Buttons[3].Visible = false;
                                tbActionBar.Buttons[4].Text = "Rename Recording";
                                tbActionBar.Buttons[4].Visible = true;
                            }

                            foreach(OysterClassLibrary.Permission P in LoginUser.HighestAuthorityLevel.CanDestroyRecordings)
                            {
                                tbActionBar.Buttons[5].Visible = false;
                                tbActionBar.Buttons[6].Text = "Delete Recording";
                                tbActionBar.Buttons[6].Visible = true;
                                break;
                            }
                        }
                    }
                    break;
            }

            treeView1.Refresh();
        }
Esempio n. 3
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();
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
        private void Progress_Tick_1(object sender, System.EventArgs e)
        {
            if (runonlyonce == false)
            {
                MyGlobals.Logger.WriteLog("Begin downloading recordings...");
                runonlyonce = true;
                Progress.Enabled = false;

                NewDirectory = DI.CurrentDirectory;
                lvRecordings = DI.LV;
                lblDR.Text = "Downloading Recordings from Video Storage Server";
                this.Text = "Downloading Recordings from Video Storage Server";
                pBar.Value = 0;

                bool IsSessionConnected = false;
                System.Globalization.NumberFormatInfo nfi = new System.Globalization.CultureInfo("en-US",false).NumberFormat;
                nfi.NumberDecimalDigits = 0;
                DI.StatusLV = new ListView();
                ////////////////////////////////////////////////////////////
                VSSInfo[] VODServers = MyGlobals.GetUniqueListOfServers(lvRecordings.Items);

                MyGlobals.Logger.WriteLog("{0} servers found.", VODServers.Length);
                foreach (VSSInfo vi in VODServers)
                {
                    MyGlobals.Logger.WriteLog("Server {0}", vi);
                    try
                    {
                        if (FtpSession.State != FtpState.Disconnected)
                        {
                            MyGlobals.Logger.WriteLog("Closing FTP session at {0}", FtpSession.RemoteEndPoint as IPEndPoint);
                            //ftpSession.Close();
                            FtpSession.Disconnect();
                        }
                    }
                    catch(Exception Err)
                    {
                        MyGlobals.Logger.WriteLog(Err.ToString());
                    }

                    try
                    {
                        MyGlobals.Logger.WriteLog("connecting to ftp session at {0}", vi);
                        FtpSession.Connect(vi.Address, vi.Port);
                    }
                    catch (FtpException ftpex)
                    {
                        MyGlobals.Logger.WriteLog("Ftp Exception {0} connecting to {1}",
                            ftpex.Message, FtpSession.RemoteEndPoint as IPEndPoint);
                    }
                    catch(Exception Err)
                    {
                        MyGlobals.Logger.WriteLog("Exception {0} connecting to {1}", Err.Message, FtpSession.RemoteEndPoint as IPEndPoint);
                        MessageBox.Show(Err.Message, "Error occurred attempting to connect to " + vi);
                        MessageBox.Show("All Recordings currently residing on " + vi + " will are unavailable for download.","Unable to retrieve recordings from " + vi);
                        continue;
                    }

                    DateTime sdt = DateTime.Now;
                    while (FtpSession.State != FtpState.Ready)
                    {
                        if (DateTime.Now > sdt.AddSeconds(30.0))
                        {
                            break;
                        }
                        System.Threading.Thread.Sleep(100);
                    }

                    if (FtpSession.State == FtpState.Ready)
                    {
                        FtpSession.Login("anonymous", "*****@*****.**");
                        MyGlobals.Logger.WriteLog("Connected to ftp session at {0}. Downloading files.", FtpSession.RemoteEndPoint as IPEndPoint);

                        foreach (ListViewItem LVI in DI.LV.Items)
                        {
                            _currentRecording = (OysterClassLibrary.Recording)LVI.Tag;

                            IsSessionConnected = true;
                            try
                            {
                                if (_currentRecording.SizeOnDisk < 1)
                                {
                                    CurrentFileSize = Convert.ToInt32(
                                        FtpSession.GetFileLength(_currentRecording.Description) / 1024 / 1024);
                                }
                                else
                                {
                                    CurrentFileSize = Convert.ToInt32(_currentRecording.SizeOnDisk / 1024 / 1024);
                                }

                                CurrentFileDisplayName = "Downloading " + _currentRecording.DisplayName;
                                MyGlobals.Logger.WriteLog("Downloading {0}:{1}", _currentRecording.Description, _currentRecording.DisplayName);

                                lblDR.Text = CurrentFileDisplayName;
                                lblDR.Refresh();
                                Application.DoEvents();
                                Application.DoEvents();
                                _isDownloadingCurrentFile = true;

                                GetThisRecording(NewDirectory, ref _currentRecording);

                                if (bCloseDialog == true)
                                {
                                    this.DialogResult = DialogResult.Abort;
                                    return;
                                }

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

                            Application.DoEvents();

                            if (IsSessionConnected)
                            {
                                if (bCloseDialog)
                                {
                                    this.DialogResult = DialogResult.Abort;
                                    return;
                                }
                                string recstring = _currentRecording.Description.ToString();
                                CurrentFileDisplayName = "Downloaded " + _currentRecording.DisplayName;
                                lblDR.Text = CurrentFileDisplayName;
                                lblDR.Refresh();

                                Application.DoEvents();
                                ListViewItem LS = DI.StatusLV.Items.Add(_currentRecording.DisplayName);
                                LS.Tag = _currentRecording;
                                LS.ForeColor = Color.DarkGreen;
                            }
                            else
                            {
                                CurrentFileDisplayName = "Download failed " + _currentRecording.DisplayName;
                                MyGlobals.Logger.WriteLog(CurrentFileDisplayName);
                                lblDR.Text = CurrentFileDisplayName;
                                lblDR.Refresh();

                                Application.DoEvents();
                                ListViewItem LS = DI.StatusLV.Items.Add(_currentRecording.DisplayName);
                                LS.Tag = _currentRecording;
                                LS.ForeColor = Color.DarkBlue;
                            }

                            Application.DoEvents();
                        }
                    }
                }
                this.Tag = DI;

                this.DialogResult = DialogResult.OK;
                return;
            }
            this.DialogResult = DialogResult.OK;
            return;
        }
Esempio n. 6
0
 private void UpdateRecording_Load(object sender, System.EventArgs e)
 {
     tbNewName.Focus();
     try
     {
         g_objRecording = (OysterClassLibrary.Recording)this.Tag;
     }
     catch
     {
         MessageBox.Show("Error! No information was passed to RemoveUsers Dialog!");
         return;
     }
     tbCurrentName.Text = g_objRecording.DisplayName;
     tbNewName.Text = g_objRecording.DisplayName;
     tbNewName.Select();
 }
Esempio n. 7
0
        private void frmNotes_Load(object sender, System.EventArgs e)
        {
            if(this.Owner is Form1)
            {
                FrmParent = (Form1)this.Owner;
                WindowGUID = System.Guid.NewGuid().ToString();
            }
            else
            {
                MessageBox.Show(this.Owner,"Invalid Call to Notes! Must be called from the Main Admin Application!","Illegal call to Dialog Notes");
                this.Close();
            }
            //lvNotes.Enabled = true;

            ThisRecording = FrmParent.LastSelectedRecording;
            this.Text = ThisRecording.DisplayName;

            if((ThisRecording.OwnerID == FrmParent.LoginUser.ID)&&(ThisRecording.CurrentSectionID != 0))
                btnNewNote.Enabled = true;
            else
                btnNewNote.Enabled = false;
            btnEditNote.Enabled = false;
            btnRemoveNote.Enabled = false;

            bool DidOnce = false;
            foreach(OysterClassLibrary.Note N in ThisRecording.CurrentNotes)
            {
                ListViewItem LVI = new ListViewItem(N.SyncTime);
                LVI.Tag = N;
                lvNotes.Items.Add(LVI);
                if(DidOnce == false)
                {
                    DidOnce = true;
                    LVI.Selected = true;
                    lvNotes_SelectedIndexChanged(lvNotes,new EventArgs());
                }
            }
        }
Esempio n. 8
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();
        }
Esempio n. 9
0
        public void ExpandUnassignedUser(ref TreeNode ThisUser)
        {
            string[] sParsed = ((string)ThisUser.Tag).Split(":".ToCharArray());
            if(sParsed.Length != 2)
                return;
            if(sParsed[0].ToLower() != "UnassignedRecordingUser".ToLower())
                return;

            int DrawSectionId = Convert.ToInt32(sParsed[1]);
            OysterClassLibrary.Section DrawSection = OSystem.GetSectionById(DrawSectionId);
            ThisUser.Nodes.Clear();
            #region DisplayRecordings
            //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
        }