Esempio n. 1
0
 public Recording GetRecordingById(int Id)
 {
     Functions F = new Functions();
     Recording X = F.GetRecording(Id);
     F.Dispose();
     return X;
 }
Esempio n. 2
0
        private void imgButtonRename_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            Transitioning = true;
            LUser = (User)Session["LUser"];
            try
            {
                string[] checkit = imgButtonRename.ImageUrl.Split('/');

                switch(checkit[1])
                {
                    case "Tab_B_RenameRec.jpg":
                        TreeNode XNode = tv.GetNodeFromIndex(tv.SelectedNodeIndex);

                        if(XNode.Type == "Recording")
                        {
                            Functions F = new Functions();
                            string[] sarray = XNode.NodeData.Split(':');
                            int RecordingId = Convert.ToInt32(sarray[0],10);
                            Recording Rec = F.GetRecording(RecordingId);

                            int UserId = Convert.ToInt32(sarray[1],10);
                            User U = F.GetUser(UserId);

                            int SectionId = Convert.ToInt32(sarray[2],10);
                            Section S = F.GetSection(SectionId);

                            int CurrentSectionTypeId = S.CreatedBySectionType.ID;
                            LUser = (User)Session["LUser"];

                            if(LUser.ID == UserId)
                            {
                                Session["Recording"] = Rec;
                                Session["Section"] = S;
                                Session["User"] = U;
                                tbDialogData.Value = Rec.DisplayName;
                                //Response.Redirect("RenameRecording.aspx",false);
                                tbShowDialog.Value = "RenameRecording";
                                return;
                            }
                            else
                            {
                                txtAlert.Value = "Sorry: Only the owner of a recording may change the recording's name.";
                            }
                        }

                        break;

                    case "Tab_B_RenameSes.jpg":
                        TreeNode XNode2 = tv.GetNodeFromIndex(tv.SelectedNodeIndex);
                        if(XNode2.Type == "RecordingSession")
                        {
                            string[] SID = XNode2.NodeData.Split(':');
                            int UserId = Convert.ToInt32(SID[1],10);

                            if(LUser.ID == UserId)
                            {
                                Session["SessionInfo"] = XNode2;
                                //Response.Redirect("RenameSession.aspx",false);
                                tbDialogData.Value = XNode2.Text;
                                tbShowDialog.Value = "RenameSession";
                                return;
                            }
                            else
                            {
                                txtAlert.Value = "Sorry: Only the owner of a Session may change the Session's name.";
                            }
                        }
                        break;
                    case "Tab_B_RecordView.jpg":

                        break;
                    case "Tab_B_RecordSce.jpg":
                        TreeNode NScene = CTV.GetNodeFromIndex(CTV.SelectedNodeIndex);
                        OysterClassLibrary.Room RM = null;

                        OSystem = (Oyster)Session["Oyster"];
                        if(NScene.Type == "Scene")
                        {
                            int RoomId = Convert.ToInt32(NScene.NodeData,10);
                            RM = OSystem.GetRoomById(RoomId);
                        }
                        else
                        {
                            int SEId = Convert.ToInt32(NScene.NodeData,10);
                            OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(SEId);
                            RM = SE.CurrentRoom;
                        }

                        tbDialogData.Value = LUser.CardNumber+ "*" + RM.AllCurrentCardReaders.Item(0).ID + "*" + RM.AllCurrentStreamingEncoders.Item(0).CurrentMediaBufferServer.Address + "*" + RM.AllCurrentStreamingEncoders.Item(0).CurrentMediaBufferServer.Port + "*" + RM.Description;
                        Session["RECORDSCENE"] = RM;

                        tbShowDialog.Value =  "RECORDSCENE";

                        break;

                    case "Tab_B_EditNote.jpg":
                        if(dgNotes.SelectedIndex == -1) return;
                        //txtPausePlayers.Value = "Pause";
                        LockAll.Value = "true";
                        DataRow r = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                        //dgNotes.Visible = false;
                        //lblSync.Visible = true;
                        //tbSync.Visible = true;
                        //taNote.Visible = true;
                        //tbSync.Value = r[1].ToString();
                        //taNote.Value = r[2].ToString();

                        //TabStrip1.Enabled = false;
                        //imgButtonView.ImageUrl = "images/btnCancel.jpg";
                        //imgButtonRename.ImageUrl = "images/btnConfirm.jpg";
                        //imgButtonView.Visible=true;
                        //imgButtonRename.Visible=true;
                        //imgButtonMove.Visible=false;
                        //imgButtonMisc.Visible=false;
                        //Session["NoteAction"] = "Update";

                        tbDialogData.Value = r[1].ToString() +"*"+ r[2].ToString();

                        tbShowDialog.Value =  "EditNote";
                        //imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg";
                        //imgButtonMisc.Visible = true;
                        //                    Session["DS"] = DS;
                        //                    Session["DA"] = DA;
                        //                    Session["SC"] = SC;
                        break;
                    case "Tab_B_UpdateNote.jpg":
                        //DS.Tables[0].Rows[dgNotes.SelectedIndex].AcceptChanges;
                        DS = (DataSet)Session["DS"];
                        DA = (SqlDataAdapter)Session["DA"];
                        SC = (SqlConnection)Session["SC"];
                        DA.Update(DS);
                        imgButtonMisc.Visible = true;
                        Session["DS"] = DS;
                        Session["DA"] = DA;
                        Session["SC"] = SC;
                        LockAll.Value = "false";

                        break;
                    case "btnConfirm.jpg":
                        string sAction = (string)Session["NoteAction"];
                        LockAll.Value = "false";

                        if(sAction == "New")
                        {
                            string[] NodeData = txtNotes.Value.Split(' ');
                            // Functions F = new Functions();
                            string sNoteValue = taNote.Value;
                            //F.AddNote(Convert.ToInt32(NodeData[0],10),NodeData[2],sNoteValue);
                            string sTimeStamp = txtTimeStamp.Value;
                            DS = (DataSet)Session["DS"];
                            DA = (SqlDataAdapter)Session["DA"];
                            SC = (SqlConnection)Session["SC"];
                            DataRow NewRow = DS.Tables[0].NewRow();
                            NewRow[1] = sTimeStamp;
                            NewRow[2] = sNoteValue;
                            NewRow[3] = Convert.ToInt32(NodeData[0],10);
                            DS.Tables[0].Rows.Add(NewRow);
                            try
                            {
                                DA.Update(DS);
                            }
                            catch(Exception Err)
                            {
                                txtAlert.Value = Err.Message;
                            }
                            SwitchButtons(3);
                            //RefreshGrid();
                            Session["NoteAction"] = "Nutn";
                            TabStrip1.Enabled = true;
                        }
                        else if(sAction == "Update")
                        {

                            DS = (DataSet)Session["DS"];
                            DA = (SqlDataAdapter)Session["DA"];
                            SC = (SqlConnection)Session["SC"];

                            DataRow r2 = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                            r2[2] = taNote.Value;
                            //DS.Tables[0].AcceptChanges();
                            DA.Update(DS);
                            SwitchButtons(3);
                            //RefreshGrid();
                            Session["NoteAction"] = "Nutn";
                            TabStrip1.Enabled = true;
                        }
                        else if(sAction == "Delete")
                        {
                            DS = (DataSet)Session["DS"];
                            DA = (SqlDataAdapter)Session["DA"];
                            SC = (SqlConnection)Session["SC"];
                            DataRow r3 = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                            r3.Delete();
                            //DS.Tables[0].AcceptChanges();
                            DA.Update(DS);
                            SwitchButtons(3);
                            //RefreshGrid();
                            Session["NoteAction"] = "Nutn";
                            TabStrip1.Enabled = true;
                        }
                        break;
                }
            }
            catch(Exception Err)
            {
                txtAlert.Value = Err.Message;
            }
        }
Esempio n. 3
0
        private void imgButtonView_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            string[] checkit = imgButtonView.ImageUrl.Split('/');
            Functions F = new Functions();
            Transitioning = true;
            switch(checkit[1])
            {
                case "Tab_B_ViewRec.jpg":
                    TreeNode XNode = tv.GetNodeFromIndex(tv.SelectedNodeIndex);

                    string seeText = XNode.Type;
                    if(XNode.Type != "Recording")
                    {
                        return;
                    }
                    if(XNode.Type == "Recording")
                    {
                        string[] sarray = XNode.NodeData.Split(':');
                        int RecordingId = Convert.ToInt32(sarray[0],10);
                        Recording Rec = F.GetRecording(RecordingId);
                        if(Rec.Description == "")
                        {
                            return;
                        }
                        VideoStorageServer VSS =  F.GetVideoStorageServer(Rec.VideoStorageServerID);
                        string sRecording = "";
                        VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;
                        if(VSS.ControlAddress != "Not Assigned")
                        {
                            if(VST.Description == "Windows Media Server")
                                sRecording = VST.StreamHeader + VSS.ControlAddress + "/" + VSS.StorageDirectory + "/" + Rec.Description;
                            else
                                sRecording = VST.StreamHeader + VSS.ControlAddress + "/" + Rec.Description;
                        }
                        else
                            sRecording = Rec.Description;
                        string NodeData = Rec.ID + "~" + sRecording + "~" + Rec.DisplayName + "~" + "RECORDING";
                        txtRecording.Value = NodeData;
                    }

                    break;

                case "Tab_B_ViewSes.jpg":
                    TreeNode XNode2 = tv.GetNodeFromIndex(tv.SelectedNodeIndex);

                    string seeText2 = XNode2.Type;
                    if(XNode2.Type != "RecordingSession")
                    {
                        return;
                    }

                    string[] sarray2 = XNode2.NodeData.Split(':');

                    string SessionId = Convert.ToString(sarray2[0]);

                    string[] sRecordingIds = new string[XNode2.Nodes.Count];
                    int nCount = 0;
                    while(nCount < XNode2.Nodes.Count)
                    {

                        TreeNode YNode = XNode2.Nodes[nCount];

                        if(YNode.Type != "Recording")
                            goto SkipIt;
                        else if (YNode == null)
                            break;

                        sRecordingIds[nCount] = YNode.NodeData;
                        nCount++;

                    SkipIt:{}
                    }

                    // Recordings AR = F.GetSessionById(SessionId);
                    Recordings AR = new Recordings();
                    for(int p=0; p<nCount;p++)
                    {
                        string[] sarray3 = sRecordingIds[p].Split(':');
                        int RecordingId = Convert.ToInt32(sarray3[0],10);
                        Recording Rec = F.GetRecording(RecordingId);
                        AR.Add(Rec);
                    }
                    int GlobalPlayers = Convert.ToInt32(NumPlayers.Value);

                    if((6 - GlobalPlayers) < AR.Count)
                    {
                        txtAlert.Value = "Action Aborted: Not enough Players to view all Session's Recordings. You must remove some of the current view windows before viewing this entire session.";
                        return;
                    }
                    else if(AR.Count > 6)
                    {
                        txtAlert.Value = "Action Aborted: Not enough Players to view all Session's Recordings. You must manually add the recordings you wish to view from this session.";
                        return;
                    }
                    string NodeData2 = "";
                    bool DidOnce = false;
                    foreach(Recording r in AR)
                    {
                        if(DidOnce == false)
                        {
                            DidOnce=true;
                        }
                        else
                            NodeData2 += "~";
                        VideoStorageServer VSS =  F.GetVideoStorageServer(r.VideoStorageServerID);
                        string sRecording = "";
                        if(VSS.ControlAddress != "Not Assigned")
                        {
                            if(VSS.StorageDirectory != "")
                                sRecording = "mms://" + VSS.ControlAddress + "/" + VSS.StorageDirectory + "/" + r.Description;
                            else
                                sRecording = "mms://" + VSS.ControlAddress + "/" + r.Description;
                        }
                        else
                            sRecording = r.Description;
                        NodeData2 += r.ID + "*" + sRecording + "*" + r.DisplayName + "*" + "*" + "SESSION";

                    }
                    if(NodeData2 != "")
                        txtRecording.Value = NodeData2;

                    break;
                case "Tab_B_ViewCam.jpg":
                    TreeNode NCam = CTV.GetNodeFromIndex(CTV.SelectedNodeIndex);

                    string seeText3 = NCam.Type;
                    if(NCam.Type != "Camera")
                    {
                        return;
                    }
                    int EncoderId = 0;
                    try
                    {
                        EncoderId = Convert.ToInt32(NCam.NodeData,10);
                    }
                    catch(Exception Err)
                    {
                        txtAlert.Value = "Unable to aquire Encoder Identification";
                        return;
                    }
                    OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(EncoderId);
                    string sURL = "";

                switch(SE.CurrentStreamingEncoderType.Description)
                {
            //					case "":
            //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
            //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
            //						break;
            //					case "rstp://":
            //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
            //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
            //						break;
            //					case @"http://":
            //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
            //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
            //						break;
                    case "VBrick":
                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort;

                        break;
                    case "VBrick Sys":
                        sURL = SE.StreamingHeader + "ip=" + SE.StreamingAddress + "&port=" + SE.StreamingPort;
                        break;
                    case "Oyster Encoder":
                        //sURL = "Unreal`" + SE.ControlAddress + ":" + SE.StreamingPort + "`" + SE.StreamingAddress;
                        sURL = "Unreal`" + SE.StreamingAddress + ":" + "5119" + "`" + SE.ControlAddress;

                        break;
                    default:
                        string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                        sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                        break;
                }

                    string CameraData = SE.ID + "~" + sURL + "~" + SE.Description + "~" + "CAMERA";
                    txtRecording.Value = CameraData;
                    break;
                case "Tab_B_ViewSce.jpg":

                    TreeNode NScene = CTV.GetNodeFromIndex(CTV.SelectedNodeIndex);

                    string seeText4 = NScene.Type;
                    if(NScene.Type != "Scene")
                    {
                        return;
                    }
                    int GroupId = 0;
                    int SceneId = 0;
                    string SceneData = "";
                    try
                    {
                        SceneData = NScene.NodeData;
                    }
                    catch(Exception Err)
                    {
                        txtAlert.Value = "Unable to aquire Scene Identification";
                        return;
                    }
                    string[] ScenePacket = SceneData.Split('~');
                    try
                    {
                        GroupId = Convert.ToInt32(ScenePacket[0],10);
                        SceneId = Convert.ToInt32(ScenePacket[1],10);
                    }
                    catch(Exception Err)
                    {
                        txtAlert.Value = "Action Aborted: Error loading Scenes!";
                    }
                    OysterClassLibrary.Group CurGroup = null;
                    OysterClassLibrary.Room CurRoom = null;
                    OysterClassLibrary.Groups AllGroups = OSystem.GetALLGroups(false);
                    foreach(OysterClassLibrary.Group G in AllGroups)
                    {
                        if(G.ID == GroupId)
                        {
                            CurGroup = G;
                            break;
                        }
                    }
                    foreach(OysterClassLibrary.Room CRM in CurGroup.CurrentRooms)
                    {
                        if(CRM.ID == SceneId)
                        {
                            CurRoom = CRM;
                            break;
                        }
                    }

                    string sURL2 = "";
                    bool DidOnce2 = false;
                    string CameraData2 = "";
                    int NumberCamerasCount = 0;
                    if(CurGroup.IsPublicAccess)
                    {
                        foreach(OysterClassLibrary.StreamingEncoder SE2 in CurGroup.CurrentStreamingEncoders)
                        {
                            bool CanContinue = false;

                            if(SE2.CurrentRoom.ID == SceneId)
                            {
                                CanContinue = true;

                            }

                            if(CanContinue == false)
                            {
                                continue;
                            }
                            if(DidOnce2 == false)
                            {
                                DidOnce2=true;
                            }
                            else
                                CameraData2 += "~";
                            NumberCamerasCount++;
                            //switch(SE2.StreamingHeader)
                            switch(SE2.CurrentStreamingEncoderType.Description)
                            {
                                    //					case "":
                                    //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                    //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                                    //						break;
                                    //					case "rstp://":
                                    //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                    //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                                    //						break;
                                    //					case @"http://":
                                    //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                    //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                                    //						break;
                                case "VBrick":
                                    sURL2 = SE2.StreamingHeader + "ip=" + SE2.StreamingAddress + "&port=" + SE2.StreamingPort;
                                    break;
                                case "VBrick Sys":
                                    sURL2 = SE2.StreamingHeader + "ip=" + SE2.StreamingAddress + "&port=" + SE2.StreamingPort;
                                    break;
                                case "Oyster Encoder":
                                    //sURL2 = "Unreal`" + SE2.ControlAddress + ":" + SE2.StreamingPort + "`" + SE2.StreamingAddress;
                                    sURL2 = "Unreal`" + SE2.StreamingAddress + ":" + "5119" + "`" + SE2.ControlAddress;

                                    break;
                                default:
                                    string VSSAddress = SE2.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                    sURL2 = SE2.StreamingHeader + VSSAddress + @"/"+ SE2.ControlAddress;
                                    break;
                            }

                            CameraData2 += SE2.ID + "*" + sURL2 + "*" + SE2.Description + "*" + "CAMERA";
                        }
                    }
                    else
                    {
                        foreach(OysterClassLibrary.StreamingEncoder SE2 in CurRoom.AllCurrentStreamingEncoders)
                        {
                            if(SE2.RoomID == SceneId)
                            {
                                if(DidOnce2 == false)
                                {
                                    DidOnce2=true;
                                }
                                else
                                    CameraData2 += "~";
                                NumberCamerasCount++;
                                //switch(SE2.StreamingHeader)
                                switch(SE2.CurrentStreamingEncoderType.Description)
                                {
                                        //					case "":
                                        //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                        //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                                        //						break;
                                        //					case "rstp://":
                                        //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                        //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                                        //						break;
                                        //					case @"http://":
                                        //						string VSSAddress = SE.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                        //						sURL = SE.StreamingHeader + VSSAddress + @"/"+ SE.ControlAddress;
                                        //						break;
                                    case "VBrick":
                                        sURL2 = SE2.StreamingHeader + "ip=" + SE2.StreamingAddress + "&port=" + SE2.StreamingPort;

                                        break;
                                    case "VBrick Sys":
                                        sURL2= SE2.StreamingHeader + "ip=" + SE2.StreamingAddress + "&port=" + SE2.StreamingPort;
                                        break;
                                    case "Oyster Encoder":
                                        //sURL2 = "Unreal`" + SE2.StreamingAddress + ":" + 5119 + "`" + SE2.ControlAddress;
                                        sURL2 = "Unreal`" + SE2.StreamingAddress + ":" + "5119" + "`" + SE2.ControlAddress;
                                        break;
                                    default:
                                        string VSSAddress = SE2.CurrentMediaBufferServer.CurrentForwardingServer.CurrentVideoStorageServer.ControlAddress;
                                        sURL2 = SE2.StreamingHeader + VSSAddress + @"/"+ SE2.ControlAddress;
                                        break;
                                }

                                CameraData2 += SE2.ID + "*" + sURL2 + "*" + SE2.Description + "*" + "CAMERA";
                            }
                        }
                    }
                    int GlobalPlayers2 = Convert.ToInt32(NumPlayers.Value);

                    if((6 - GlobalPlayers2) < NumberCamerasCount)
                    {
                        txtAlert.Value = "Action Aborted: Not enough Players to view all Scene's Cameras. You must remove some of the current view windows before viewing this entire scene.";
                        return;
                    }
                    else if(NumberCamerasCount > 6)
                    {
                        txtAlert.Value = "Action Aborted: Not enough Players to view all Scene's Cameras. You must manually add the recordings you wish to view from this scene.";
                        return;
                    }
                    txtRecording.Value = CameraData2;

                    break;
                case "Tab_B_NewNote.jpg":
                    //txtPausePlayers.Value = "Pause";
                    //dgNotes.Visible = false;
                    //lblSync.Visible = true;
                    //tbSync.Visible = true;
                    //taNote.Visible = true;
                    //lblNoNote.Visible = false;
                    LockAll.Value = "true";
                    //Response.Write("<script language=javascript> Temp1.taNote.Focus() </script>");
                    //txtFocus.Value = "taNote";
                    //string[] NodeData3 = txtNotes.Value.Split(' ');

                    if(txtTimeStamp.Value == "")
                        tbDialogData.Value = "00:00:00~Please type your Note description here.";
                    else
                        tbDialogData.Value = txtTimeStamp.Value + "*Type your Note description here.";
                    //                    if(txtTimeStamp.Value == "")
                    //                        tbDialogData.Value = "00:00:00~Please type your Note description here.";
                    //                    else
                    //                        tbDialogData.Value = txtTimeStamp.Value + "~Please type your Note description here.";

                    //TabStrip1.Enabled = false;
                    //imgButtonView.ImageUrl = "images/btnCancel.jpg";
                    //imgButtonRename.ImageUrl = "images/btnConfirm.jpg";
                    //imgButtonView.Visible=true;
                    //imgButtonRename.Visible=true;
                    //imgButtonMove.Visible=false;
                    //imgButtonMisc.Visible=false;
                    //Session["NoteAction"] = "New";
                    //tbSync.Disabled = false;

                    tbShowDialog.Value =  "NewNote";
                    break;
                case "btnCancel.jpg":
                    LockAll.Value = "false";

                    SwitchButtons(3);
                    //RefreshGrid();
                    TabStrip1.Enabled = true;
                    break;
            }
        }
Esempio n. 4
0
        private void imgButtonMove_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            Transitioning = true;
            string[] checkit = imgButtonMove.ImageUrl.Split('/');
            OSystem = (Oyster)Session["Oyster"];
            LUser = (User)Session["LUser"];
            switch(checkit[1])
            {
                case "Tab_B_MoveRec.jpg":
                    TreeNode XNode =tv.GetNodeFromIndex(tv.SelectedNodeIndex);

                    if(XNode.Type == "Recording")
                    {
                        Functions F = new Functions();
                        string[] sarray = XNode.NodeData.Split(':');
                        int RecordingId = Convert.ToInt32(sarray[0],10);
                        Recording Rec = F.GetRecording(RecordingId);

                        int UserId = Convert.ToInt32(sarray[1],10);
                        User U = F.GetUser(UserId);

                        int SectionId = Convert.ToInt32(sarray[2],10);
                        Section S = F.GetSection(SectionId);

                        int CurrentSectionTypeId = S.CreatedBySectionType.ID;
                        LUser = (User)Session["LUser"];

                        if(LUser.ID != UserId)
                        {
                            foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings)
                            {
                                if(P.CanOperateOn == CurrentSectionTypeId)
                                {
                                    Session["Recording"] = Rec;
                                    Session["Section"] = S;
                                    Session["User"] = U;
                                    Sections M1 = LUser.AllMemberSections;
                                    string sDataCol = "";
                                    bool FirstPass = false;
                                    foreach(Section MemberS in M1)
                                    {
                                        if(S.ID != MemberS.ID)
                                        {
                                            //if(S.IsDefault == false)
                                            //{
                                            if(FirstPass == false)
                                            {
                                                FirstPass = true;
                                                sDataCol = MemberS.Description + ":" + MemberS.ID.ToString();
                                            }
                                            else
                                                sDataCol += "~" + MemberS.Description + ":" + MemberS.ID.ToString();
                                            // }
                                        }
                                    }
                                    tbDialogData.Value = sDataCol;
                                    tbShowDialog.Value =  "MoveRecording";
                                    //Response.Redirect("WebForm2.aspx",false);
                                    return;
                                }
                            }
                        }
                        else
                        {

                            if(LUser.HighestAuthorityLevel.PreviousSectionTypeID != -99)
                            {
                                foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings)
                                {
                                    if(P.CanOperateOn == CurrentSectionTypeId)
                                    {
                                        Session["Recording"] = Rec;
                                        Session["Section"] = S;
                                        Session["User"] = U;
                                        Sections M2 = LUser.AllMemberSections;
                                        string sDataCol = "";
                                        bool FirstPass = false;
                                        foreach(Section MemberS in M2)
                                        {
                                            if(S.ID != MemberS.ID)
                                            {
                                                //if(S.IsDefault == false)
                                                //{
                                                if(FirstPass == false)
                                                {
                                                    FirstPass = true;
                                                    sDataCol = MemberS.Description + ":" + MemberS.ID.ToString();
                                                }
                                                else
                                                    sDataCol += "~" + MemberS.Description + ":" + MemberS.ID.ToString();
                                                // }
                                            }
                                        }
                                        tbDialogData.Value = sDataCol;
                                        tbShowDialog.Value =  "MoveRecording";
                                        //Response.Redirect("WebForm2.aspx",false);
                                        return;
                                    }
                                }
                            }

                        }
                        txtAlert.Value = "Sorry you do not have sufficient privilege to move this recording";
                            return;
                        //FillTree(UserId);
                    }
                    break;

                case "Tab_B_MoveSes.jpg":
                    TreeNode XNode2 =tv.GetNodeFromIndex(tv.SelectedNodeIndex);

                    if(XNode2.Type == "RecordingSession")
                    {
                        //Functions F = new Functions();
                        string[] sarray = XNode2.NodeData.Split(':');
                        string SessionId = Convert.ToString(sarray[0]);

                        int UserId = Convert.ToInt32(sarray[1],10);
                        User U = OSystem.GetUserById(UserId);

                        int SectionId = Convert.ToInt32(sarray[2],10);
                        Section S = OSystem.GetSectionById(SectionId);

                        int CurrentSectionTypeId = S.CreatedBySectionType.ID;
                        LUser = (User)Session["LUser"];

                        if(LUser.ID != UserId)
                        {
                            foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings)
                            {
                                if(P.CanOperateOn == CurrentSectionTypeId)
                                {
                                    Session["SessionId"] = SessionId;
                                    Session["Section"] = S;
                                    Session["User"] = U;
                                    //Sections M = (Sections)Session["Members"];
                                    Sections M = LUser.AllMemberSections;
                                    string sDataCol = "";
                                    bool FirstPass = false;
                                    foreach(Section MemberS in M)
                                    {
                                        if(S.ID != MemberS.ID)
                                        {
                                            //if(S.IsDefault == false)
                                            //{
                                                if(FirstPass == false)
                                                {
                                                    FirstPass = true;
                                                    sDataCol = MemberS.Description + ":" + MemberS.ID.ToString();
                                                }
                                                else
                                                    sDataCol += "~" + MemberS.Description + ":" + MemberS.ID.ToString();
                                           // }
                                        }
                                    }
                                    tbDialogData.Value = sDataCol;
                                    tbShowDialog.Value =  "MoveSession";
                                    //Response.Redirect("MoveSession.aspx",false);
                                    return;
                                }
                            }
                        }
                        else
                        {

                            if(LUser.HighestAuthorityLevel.PreviousSectionTypeID != -99)
                            {
                                foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings)
                                {
                                    if(P.CanOperateOn == CurrentSectionTypeId)
                                    {
                                        Session["SessionId"] = SessionId;
                                        Session["Section"] = S;
                                        Session["User"] = U;
                                        //Sections M = (Sections)Session["Members"];
                                        Sections M = LUser.AllMemberSections;
                                        string sDataCol = "";
                                        bool FirstPass = false;
                                        foreach(Section MemberS in M)
                                        {
                                            if(S.ID != MemberS.ID)
                                            {
                                                //if(S.IsDefault == false)
                                                //{
                                                    if(FirstPass == false)
                                                    {
                                                        FirstPass = true;
                                                        sDataCol = MemberS.Description + ":" + MemberS.ID.ToString();
                                                    }
                                                    else
                                                        sDataCol += "~" + MemberS.Description + ":" + MemberS.ID.ToString();
                                               // }
                                            }
                                        }
                                        tbDialogData.Value = sDataCol;
                                        tbShowDialog.Value =  "MoveSession";

                                        //Response.Redirect("WebForm2.aspx",false);
                                        return;
                                    }
                                }
                            }
                        }
                        FillTree(UserId);
                    }

                    break;

                case "Tab_B_RemoveNote.jpg":
                    LockAll.Value = "true";
                    //Session["NoteAction"] = "Delete";
                    //dgNotes.Visible = false;
                    //lblSync.Visible = false;
                    //tbSync.Visible = false;
                    //taNote.Visible = false;
                    //lblNoNote.Visible = true;
                    //lblNoNote.Text = "Are you sure you wish to permanently remove this note?";
                    //TabStrip1.Enabled = false;
                    //imgButtonView.ImageUrl = "images/btnCancel.jpg";
                    //imgButtonRename.ImageUrl = "images/btnConfirm.jpg";
                    //imgButtonView.Visible=true;
                    //imgButtonRename.Visible=true;
                    //imgButtonMove.Visible=false;
                    //imgButtonMisc.Visible=false;
                    tbDialogData.Value = "Permanently delete note?";
                    tbShowDialog.Value = "DeleteNote";
                    break;

                case "Tab_B_MoveCamera.jpg":
                    TreeNode TN3 = CTV.GetNodeFromIndex(CTV.SelectedNodeIndex);
                    if(TN3 != null)
                    {

                        if(TN3.Type == "Camera")
                        {
                            int SEID = Convert.ToInt32(TN3.NodeData,10);
                            OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(SEID);
                            tbDialogData.Value = SE.ControlAddress + "~" + SE.ControlPort;
                            tbShowDialog.Value = "CONTROLCAMERA";
                        }
                    }
                    break;
            }
        }