private void FillTree(int UserId) { LUser = (User)Session["LUser"]; Functions F = new Functions(); User CU = F.GetUser(UserId); Sections SS = CU.AllMemberSections; Session["Members"] = SS; tv.Nodes[0].Text = CU.Description; tv.Nodes[0].Type = "User"; tv.Nodes[0].NodeData = CU.ID.ToString() + ":" + "-999"; tv.Nodes[0].Expanded = true; tv.Nodes[0].Nodes.Clear(); TreeNode L = new TreeNode(); L.Text = "Current Sections"; L.Type = "Label"; L.Expanded = true; tv.Nodes[0].Nodes.Add(L); TreeNode U = new TreeNode(); U.Text = "Unassigned Recordings"; U.Type = "Label"; U.DefaultStyle.Add("color","brown"); U.Expanded = true; //Current Sections if(CU.ID == LUser.ID) { foreach(Section CurrentSection in SS) { if(CurrentSection.IsDefault == false) { // Sections AOS = LUser.AllOwnedSections; // if(AOS == null) goto SkipSections; //Add this Section to the treeview and the users recordings in it. TreeNode N = new TreeNode(); N.Text = CurrentSection.Description; N.Type = "Section"; N.DefaultStyle.Add("color","DarkGreen"); N.NodeData = CurrentSection.ID.ToString(); N.ImageUrl = tv.TreeNodeTypes[4].ImageUrl; Recordings CurrentRecordings = F.ALLRecordings(UserId,CurrentSection.ID); int SessionCount = 0; TreeNode[] NSession = new TreeNode[1]; ListBox LB = new ListBox(); string NData = ""; foreach(Recording R in CurrentRecordings) { NData = R.SessionID + ":" + CU.ID.ToString() +":" + CurrentSection.ID.ToString(); if(R.SessionID != "") { bool SkipThis = false; foreach(ListItem LI in LB.Items) { if(LI.Text == NData) { SkipThis = true; } } if(SkipThis == false) { SessionCount++; ListItem LI = new ListItem(NData,R.SessionName); LB.Items.Add(LI); } } } NSession = new TreeNode[SessionCount]; int FillItem = 0; foreach(ListItem LI in LB.Items) { NSession[FillItem] = new TreeNode(); NSession[FillItem].Text = LI.Value; NSession[FillItem].NodeData = LI.Text; NSession[FillItem].Type = "RecordingSession"; NSession[FillItem].DefaultStyle.Add("color","DarkBlue"); NSession[FillItem].ImageUrl = tv.TreeNodeTypes[2].ImageUrl; N.Nodes.Add(NSession[FillItem]); FillItem++; } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":" + CurrentSection.ID.ToString(); N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID != null) { for(int i = 0; i< SessionCount;i++) { string[] SID = NSession[i].NodeData.Split(':'); if(R.SessionID == SID[0]) { NSession[i].Nodes.Add(N2); } } } } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; if(!R.IsReady) { N2.Type = "Label"; N2.DefaultStyle.Add("color","Gray"); } else { N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); } N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":" + CurrentSection.ID.ToString(); N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID == "") { N.Nodes.Add(N2); } } L.Nodes.Add(N); } // SkipSections:{} } } else { foreach(Section CurrentSection in SS) { if(CurrentSection.IsDefault == false) { Sections AOS = LUser.AllOwnedSections; if(AOS == null) goto SkipSections; foreach(Section LoginUserSection in AOS) { if(LoginUserSection.IsDefault == false) { bool Addit = F.IsInMyHierarchy(LoginUserSection.ID,CurrentSection.ID); if(Addit == true) { //Add this Section to the treeview and the users recordings in it. TreeNode N = new TreeNode(); N.Text = CurrentSection.Description; N.Type = "Section"; N.DefaultStyle.Add("color","DarkGreen"); N.NodeData = CurrentSection.ID.ToString(); N.ImageUrl = tv.TreeNodeTypes[4].ImageUrl; Recordings CurrentRecordings = F.ALLRecordings(UserId,CurrentSection.ID); int SessionCount = 0; TreeNode[] NSession = new TreeNode[1]; ListBox LB = new ListBox(); string NData = ""; foreach(Recording R in CurrentRecordings) { NData = R.SessionID + ":" + CU.ID.ToString() +":" + LoginUserSection.ID.ToString(); if(R.SessionID != "") { bool SkipThis = false; foreach(ListItem LI in LB.Items) { if(LI.Text == NData) { SkipThis = true; } } if(SkipThis == false) { SessionCount++; ListItem LI = new ListItem(NData,R.SessionName); LB.Items.Add(LI); } } } NSession = new TreeNode[SessionCount]; int FillItem = 0; foreach(ListItem LI in LB.Items) { NSession[FillItem] = new TreeNode(); NSession[FillItem].Text = LI.Value; NSession[FillItem].NodeData = LI.Text; NSession[FillItem].Type = "RecordingSession"; NSession[FillItem].DefaultStyle.Add("color","DarkBlue"); NSession[FillItem].ImageUrl = tv.TreeNodeTypes[2].ImageUrl; N.Nodes.Add(NSession[FillItem]); FillItem++; } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":" + CurrentSection.ID.ToString(); N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID != null) { for(int i = 0; i< SessionCount;i++) { string[] SID = NSession[i].NodeData.Split(':'); if(R.SessionID == SID[0]) { NSession[i].Nodes.Add(N2); } } } } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; if(!R.IsReady) { N2.Type = "Label"; N2.DefaultStyle.Add("color","Gray"); } else { N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); } N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":" + CurrentSection.ID.ToString(); N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID == "") { N.Nodes.Add(N2); } } L.Nodes.Add(N); } } } } SkipSections:{} } } if(L.Nodes.Count == 0) L.Text = "No Member Sections"; // Owned Sections foreach(Section CurrentSection in CU.AllOwnedSections) { if(CurrentSection.IsDefault == true) { bool CanView = false; foreach(Permission P in LUser.HighestAuthorityLevel.CanViewUnassignedRecordings) { CanView = true; } if((CanView == true)||(LUser.ID == UserId)) { Recordings CurrentRecordings = CurrentSection.CurrentRecordings; int SessionCount = 0; TreeNode[] NSession = new TreeNode[1]; ListBox LB = new ListBox(); string NData = ""; foreach(Recording R in CurrentRecordings) { NData = R.SessionID + ":" + CU.ID.ToString() +":" + CurrentSection.ID.ToString(); if(R.SessionID != "") { bool SkipThis = false; foreach(ListItem LI in LB.Items) { if(LI.Text == NData) { SkipThis = true; } } if(SkipThis == false) { SessionCount++; ListItem LI = new ListItem(NData,R.SessionName); LB.Items.Add(LI); } } } NSession = new TreeNode[SessionCount]; int FillItem = 0; foreach(ListItem LI in LB.Items) { NSession[FillItem] = new TreeNode(); NSession[FillItem].Text = LI.Value; NSession[FillItem].NodeData = LI.Text; NSession[FillItem].Type = "RecordingSession"; NSession[FillItem].DefaultStyle.Add("color","DarkBlue"); NSession[FillItem].ImageUrl = tv.TreeNodeTypes[2].ImageUrl; U.Nodes.Add(NSession[FillItem]); FillItem++; } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":" + CurrentSection.ID.ToString(); N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID != "") { for(int i = 0; i< SessionCount;i++) { string[] SID = NSession[i].NodeData.Split(':'); if(R.SessionID == SID[0]) { NSession[i].Nodes.Add(N2); } } } } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; if(!R.IsReady) { N2.Type = "Label"; N2.DefaultStyle.Add("color","Gray"); } else { N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); } N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":" + CurrentSection.ID.ToString(); N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID == "") { U.Nodes.Add(N2); } } if(U.Nodes.Count == 0) U.Text = "No Unassigned Recordings"; tv.Nodes[0].Nodes.Add(U); } } } //Groups OysterClassLibrary.Groups GPS = null; if(LUser.HighestAuthorityLevel.ID == OSystem.SectionTypeSysAdmin.ID) GPS = OSystem.GetALLGroups(false); else GPS = LUser.CurrentGroups; TreeNode NodeGroups = new TreeNode(); NodeGroups.Text = "Current Groups"; NodeGroups.DefaultStyle.Add("color","Green"); NodeGroups.Type = "labelGroup"; tv.Nodes[0].Nodes.Add(NodeGroups); TreeNode NPublic = new TreeNode(); TreeNode NPrivate = new TreeNode(); NPublic.Text = "Public Groups"; NPrivate.Text = "Private Groups"; NPublic.Type = "GroupName"; NPrivate.Type = "GroupName"; NPublic.DefaultStyle.Add("color","DarkBlue"); NPrivate.DefaultStyle.Add("color","DarkGreen"); NodeGroups.Nodes.Add(NPublic); NodeGroups.Nodes.Add(NPrivate); foreach(OysterClassLibrary.Group G in GPS) { TreeNode GNode = new TreeNode(); GNode.Text = G.Description; GNode.NodeData = G.ID.ToString(); if(G.IsPublicAccess) { GNode.DefaultStyle.Add("color","Blue"); NPublic.Nodes.Add(GNode); } else { GNode.DefaultStyle.Add("color","Green"); NPrivate.Nodes.Add(GNode); } if(G.CurrentRecordings.Count == 0) { TreeNode NoRecs = new TreeNode(); NoRecs.Text = "No available recordings"; NoRecs.DefaultStyle.Add("color","#696969"); GNode.Nodes.Add(NoRecs); } else //if(G.CurrentRecordings.Count > 0) { Recordings CurrentRecordings = G.CurrentRecordings; int SessionCount = 0; TreeNode[] NSession = new TreeNode[1]; ListBox LB = new ListBox(); string NData = ""; foreach(Recording R in CurrentRecordings) { NData = R.SessionID + ":" + CU.ID.ToString() +":0"; if(R.SessionID != "") { bool SkipThis = false; foreach(ListItem LI in LB.Items) { if(LI.Text == NData) { SkipThis = true; } } if(SkipThis == false) { SessionCount++; ListItem LI = new ListItem(NData,R.SessionName); LB.Items.Add(LI); } } } NSession = new TreeNode[SessionCount]; int FillItem = 0; foreach(ListItem LI in LB.Items) { NSession[FillItem] = new TreeNode(); NSession[FillItem].Text = LI.Value; NSession[FillItem].NodeData = LI.Text; NSession[FillItem].Type = "RecordingSession"; NSession[FillItem].DefaultStyle.Add("color","DarkBlue"); NSession[FillItem].ImageUrl = tv.TreeNodeTypes[2].ImageUrl; GNode.Nodes.Add(NSession[FillItem]); FillItem++; } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":0"; N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID != "") { for(int i = 0; i< SessionCount;i++) { string[] SID = NSession[i].NodeData.Split(':'); if(R.SessionID == SID[0]) { NSession[i].Nodes.Add(N2); } } } } foreach(Recording R in CurrentRecordings) { TreeNode N2 = new TreeNode(); N2.Text = R.DisplayName; if(!R.IsReady) { N2.Type = "Label"; N2.DefaultStyle.Add("color","Gray"); } else { N2.Type = "Recording"; N2.DefaultStyle.Add("color","Blue"); } N2.NodeData = R.ID.ToString()+ ":" + CU.ID.ToString() + ":0"; N2.ImageUrl = tv.TreeNodeTypes[1].ImageUrl; if(R.SessionID == "") { GNode.Nodes.Add(N2); } } //NodeGroups.Nodes.Add(GNode); } } if(NPublic.Nodes.Count == 0) { TreeNode NPNGroups = new TreeNode(); NPNGroups.Text = "No groups available"; NPNGroups.DefaultStyle.Add("color","#696969"); NPublic.Nodes.Add(NPNGroups); } if(NPrivate.Nodes.Count == 0) { TreeNode NPriGroups = new TreeNode(); NPriGroups.Text = "No groups available"; NPriGroups.DefaultStyle.Add("color","#696969"); NPrivate.Nodes.Add(NPriGroups); } }
private void dgNotes_SelectedIndexChanged(object sender, System.EventArgs e) { for(int i=0;i<dgNotes.Items.Count;i++) { dgNotes.Items[i].BorderStyle = BorderStyle.Groove; } dgNotes.SelectedItem.BorderStyle = BorderStyle.Dashed; DataGridItem DGI = dgNotes.SelectedItem; TableCell tc = DGI.Cells[1]; txtSyncTime.Value = tc.Text; Recording R = (Recording)Session["NoteRecording"]; LUser = (User)Session["LUser"]; bool bEnableControls = false; if(R.OwnerID == LUser.ID) bEnableControls = true; if(bEnableControls == true) { imgButtonView.ImageUrl = "images/Tab_B_NewNote.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_EditNote.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote.jpg"; } else { imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg"; } //imgButtonRename.Visible = true; //imgButtonMove.Visible = true; }
private void FillCameras() { CTV.Nodes[0].Nodes.Clear(); CTV.Nodes[0].Expanded = true; Functions F = new Functions(); Rooms AR = F.ALLRooms(); LUser = (OysterClassLibrary.User)Session["LUser"]; OSystem = (OysterClassLibrary.Oyster)Session["Oyster"]; OysterClassLibrary.Groups AG = null; if(LUser.HighestAuthorityLevel.ID == OSystem.SectionTypeSysAdmin.ID) { AG = OSystem.GetALLGroups(false); } else AG = LUser.CurrentGroups; TreeNode NPublic = new TreeNode(); NPublic.Type = "Group"; NPublic.ImageUrl = CTV.TreeNodeTypes[4].ImageUrl; NPublic.Text = "Public Groups"; NPublic.DefaultStyle.Add("color","DarkBlue"); CTV.Nodes[0].Nodes.Add(NPublic); TreeNode NPrivate = new TreeNode(); NPrivate.Type = "Group"; NPrivate.ImageUrl = CTV.TreeNodeTypes[5].ImageUrl; NPrivate.DefaultStyle.Add("color","DarkGreen"); NPrivate.Text = "Private Groups"; CTV.Nodes[0].Nodes.Add(NPrivate); int[] UO = OSystem.UnassignedIDs; foreach(OysterClassLibrary.Group CurrentGroup in AG) { TreeNode GroupNODE = new TreeNode(); GroupNODE.Text = CurrentGroup.Description; GroupNODE.ImageUrl = CTV.TreeNodeTypes[3].ImageUrl; if(CurrentGroup.IsPublicAccess) { int NumEncoders = CurrentGroup.CurrentStreamingEncoders.Count; if(NumEncoders > 0) NPublic.Nodes.Add(GroupNODE); GroupNODE.DefaultStyle.Add("color","Blue"); TreeNode[] PubScenes = new TreeNode[NumEncoders]; int iCount = 0; ListBox LB = new ListBox(); foreach(OysterClassLibrary.StreamingEncoder S in CurrentGroup.CurrentStreamingEncoders) { foreach(ListItem LI in LB.Items) { if(S.RoomID.ToString() == LI.Value) { goto skipme; } } ListItem LA = new ListItem(S.CurrentRoom.Description,S.RoomID.ToString()); LB.Items.Add(LA); PubScenes[iCount] = new TreeNode(); PubScenes[iCount].Type = "Scene"; PubScenes[iCount].ImageUrl = CTV.TreeNodeTypes[2].ImageUrl; PubScenes[iCount].NodeData = CurrentGroup.ID.ToString() + "~" + S.RoomID.ToString(); PubScenes[iCount].Text = S.CurrentRoom.Description; GroupNODE.Nodes.Add(PubScenes[iCount]); iCount++; skipme:{} } foreach(OysterClassLibrary.StreamingEncoder S in CurrentGroup.CurrentStreamingEncoders) { for(int i=0;i<iCount;i++) { string sMatch = CurrentGroup.ID.ToString() + "~" + S.RoomID.ToString(); if(sMatch == PubScenes[i].NodeData) { TreeNode SEncoder = new TreeNode(); SEncoder.Type = "Camera"; SEncoder.ImageUrl = CTV.TreeNodeTypes[1].ImageUrl; SEncoder.NodeData = S.ID.ToString(); SEncoder.Text = S.Description; PubScenes[i].Nodes.Add(SEncoder); } } } } else { if(CurrentGroup.CurrentRooms.Count > 0) NPrivate.Nodes.Add(GroupNODE); foreach(Room r in CurrentGroup.CurrentRooms) { if(r.ID != UO[1]) { int NumEncoders = r.AllCurrentStreamingEncoders.Count; GroupNODE.DefaultStyle.Add("color","Green"); TreeNode Scene = new TreeNode(); Scene.Type = "Scene"; Scene.ImageUrl = CTV.TreeNodeTypes[2].ImageUrl; Scene.NodeData = CurrentGroup.ID.ToString() + "~" + r.ID.ToString(); Scene.Text = r.Description; Scene.DefaultStyle.Add("color","Green"); GroupNODE.Nodes.Add(Scene); int NumCameras = 0; StreamingEncoders ASE = r.AllCurrentStreamingEncoders; foreach(StreamingEncoder SE in ASE) { NumCameras++; TreeNode SEncoder = new TreeNode(); SEncoder.Type = "Camera"; SEncoder.ImageUrl = CTV.TreeNodeTypes[1].ImageUrl; SEncoder.NodeData = SE.ID.ToString(); SEncoder.Text = SE.Description; Scene.Nodes.Add(SEncoder); } //if(NumCameras > 0) //{ // CTV.Nodes[0].Nodes.Add(Scene); //} } } } } }
private void RefreshNoteButtons() { try { imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg"; imgButtonView.ToolTip = "Create a new Note"; imgButtonRename.ToolTip = "Edit selected Note"; imgButtonMove.ToolTip = "Permanently removes selected Note"; OSystem = (Oyster)Session["Oyster"]; LUser = (User)Session["LUser"]; TabStrip1.Enabled = true; int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10); if(SelectedIndex != 1) { dgNotes.Visible = false; lblSync.Visible = false; tbSync.Visible = false; taNote.Visible = false; return; } int numselected = 0; try { numselected = Convert.ToInt32(NumSelected.Value,10); } catch(Exception Err) { return; } lblNoNote.Visible = true; dgNotes.Visible = false; if(numselected == 0) lblNoNote.Text = "Notes for each recording are available only after selecting a Player View. To do this: Click the Recording Tab then select the desired recording. Click View Recording. When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab."; else if(numselected > 1) lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes."; else { lblNoNote.Visible = false; dgNotes.Visible = true; } if((txtLastNote.Value != "")&&(txtLastNote.Value != "Restricted")) { taNote.Visible = false; string[] NodeData = txtLastNote.Value.Split('~'); //Functions F = new Functions(); int RecordingId = Convert.ToInt32(NodeData[0]); //imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg"; //imgButtonMisc.Visible = false; dgNotes.Visible = true; lblSync.Visible = false; tbSync.Visible = false; tbSync.Disabled = true; taNote.Visible = false; lblNoNote.Visible = false; Recording R = OSystem.GetRecordingById(RecordingId); Session["NoteRecording"] = R; bool bEnableControls = false; if(R.OwnerID == LUser.ID) bEnableControls = true; if(bEnableControls == true) { imgButtonView.ImageUrl = "images/Tab_B_NewNote.jpg"; } else { imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg"; } if(dgNotes.Items.Count != 0) { if((dgNotes.SelectedItem != null)&&(bEnableControls == true)) { imgButtonRename.ImageUrl = "images/Tab_B_EditNote.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote.jpg"; } else { } } else { imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg"; dgNotes.Visible = false; lblNoNote.Text = "There are currently no notes associated with this recording"; } } else { imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg"; imgButtonMisc.Visible = false; lblSync.Visible = false; tbSync.Visible = false; taNote.Visible = false; } } catch(Exception Err) { string peekerror = Err.Message; } }
private void SwitchButtons(int PanelId) { try { LUser = (User)Session["LUser"]; OSystem = (Oyster)Session["Oyster"]; imgButtonView.Visible = true; imgButtonRename.Visible = true; imgButtonMove.Visible = true; switch(PanelId) { case 1: /*Recordings Tab (Recording)*/ imgButtonView.ImageUrl = "images/Tab_B_ViewRec.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RenameRec.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveRec.jpg"; imgButtonView.ToolTip = "Opens selected recording in a new player window"; imgButtonRename.ToolTip = "Renames selected recording"; imgButtonMove.ToolTip = "Move selected recording"; imgButtonMove.Visible = true; TreeNode TN = tv.GetNodeFromIndex(tv.SelectedNodeIndex); if(TN == null) return; else if(TN.Type == "Recording") { string[] sarray = TN.NodeData.Split(':'); int RecordingId = Convert.ToInt32(sarray[0],10); int SectionId = Convert.ToInt32(sarray[2],10); Recording Rec = OSystem.GetRecordingById(RecordingId); Section S = OSystem.GetSectionById(SectionId); TreeNode CN = (TreeNode)TN.Parent; bool IsUnassigned = false; imgButtonRename.ImageUrl = "images/Tab_B_RenameRec_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveRec_Disabled.jpg"; while((CN.Type != "User")&&(CN.Type != "labelGroup")) { if(CN.Text == "Unassigned Recordings") IsUnassigned = true; CN = (TreeNode)CN.Parent; } if(CN.Type == "User") { imgButtonView.Visible = true; if(LUser.ID == Rec.OwnerID) { imgButtonRename.ImageUrl = "images/Tab_B_RenameRec.jpg"; } if((LUser.ID == Rec.OwnerID)||((LUser.ID!=Rec.OwnerID)&&(IsUnassigned == false))) { foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings) { if(P.CanOperateOn == S.CreatedBySectionTypeID) { imgButtonMove.ImageUrl = "images/Tab_B_MoveRec.jpg"; break; } } } // else // { // foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings) // { // if(P.CanOperateOn == S.CreatedBySectionTypeID) // { // imgButtonMove.Visible = true; // break; // } // } // } } else { imgButtonView.ImageUrl = "images/Tab_B_ViewRec.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RenameRec_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveRec_Disabled.jpg"; } } else { imgButtonView.ImageUrl = "images/Tab_B_ViewRec_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RenameRec_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveRec_Disabled.jpg"; } string sview = ResponseToHandle.Value; if(txtEnableViewButton.Value == "false") imgButtonView.ImageUrl = "images/Tab_B_ViewRec_Disabled.jpg"; //imgButtonMisc.Visible = false; break; case 2: /*Recordings Tab (Sessions)*/ imgButtonView.ImageUrl = "images/Tab_B_ViewSes_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RenameSes_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveSes_Disabled.jpg"; imgButtonMove.Visible = true; imgButtonView.ToolTip = "Opens selected session's recordings into player windows"; imgButtonRename.ToolTip = "Renames selected session"; imgButtonMove.ToolTip = "Move selected session"; TreeNode TN2 = tv.GetNodeFromIndex(tv.SelectedNodeIndex); if(TN2 == null) return; else if(TN2.Type == "RecordingSession") { string[] sarray2 = TN2.NodeData.Split(':'); string SessionId = Convert.ToString(sarray2[0]); int SectionId = Convert.ToInt32(sarray2[2]); Section S = OSystem.GetSectionById(SectionId); int CUserId = Convert.ToInt32(sarray2[1]); TreeNode CN = (TreeNode)TN2.Parent; bool IsUnassigned = false; //imgButtonRename.Visible = false; //imgButtonMove.Visible = false; while((CN.Type != "User")&&(CN.Type != "labelGroup")) { if(CN.Text == "Unassigned Recordings") IsUnassigned = true; CN = (TreeNode)CN.Parent; } if(CN.Type == "User") { imgButtonView.ImageUrl = "images/Tab_B_ViewSes.jpg"; if(OSystem.CanRenameSession(SessionId,LUser.ID)) imgButtonRename.ImageUrl = "images/Tab_B_RenameSes.jpg"; if((LUser.ID == CUserId)||((LUser.ID != CUserId)&&(IsUnassigned == false))) { foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings) { if(P.CanOperateOn == S.CreatedBySectionTypeID) { imgButtonMove.ImageUrl = "images/Tab_B_MoveSes.jpg"; break; } } } // else // { // foreach(Permission P in LUser.HighestAuthorityLevel.CanMoveRecordings) // { // if(P.CanOperateOn == S.CreatedBySectionTypeID) // { // imgButtonMove.Visible = true; // break; // } // } // } } else { imgButtonView.ImageUrl = "images/Tab_B_ViewSes.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RenameSes_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveSes_Disabled.jpg"; } } else { imgButtonView.ImageUrl = "images/Tab_B_ViewSes_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RenameSes_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveSes_Disabled.jpg"; } if(txtEnableViewButton.Value == "false") imgButtonView.ImageUrl = "images/Tab_B_ViewSes_Disabled.jpg"; //imgButtonMisc.Visible = false; break; case 3: /*Notes Tab (Sessions)*/ imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg"; imgButtonMove.Visible = true; RefreshGrid(); imgButtonView.ToolTip = "Create a new Note"; imgButtonRename.ToolTip = "Edit selected Note"; imgButtonMove.ToolTip = "Permanently removes selected Note"; //imgButtonMisc.Visible = false; break; case 4: /*Camera Tab (Camera)*/ imgButtonView.ImageUrl = "images/Tab_B_ViewCam.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RecordSce_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_MoveCamera_Disabled.jpg"; imgButtonRename.Visible = false; imgButtonView.ToolTip = "Opens selected stream in a new player window"; imgButtonRename.ToolTip = "Begin recording this entire Scene"; imgButtonMove.ToolTip = "Moves camera"; TreeNode TN3 = CTV.GetNodeFromIndex(CTV.SelectedNodeIndex); if(TN3 != null) { if(TN3.Type == "Camera") { imgButtonView.ImageUrl = "images/Tab_B_ViewCam.jpg"; int SEID = Convert.ToInt32(TN3.NodeData,10); OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(SEID); if(SE.HasControlableCamera) { imgButtonMove.ImageUrl = "images/Tab_B_MoveCamera.jpg"; } if(LUser.CanRecord) { //imgButtonRename.ImageUrl = "images/Tab_B_RecordSce.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RecordSce_Disabled.jpg"; } } else imgButtonView.ImageUrl = "images/Tab_B_ViewCam_Disabled.jpg"; } else imgButtonView.ImageUrl = "images/Tab_B_ViewCam_Disabled.jpg"; if(NumPlayers.Value == "enabled") imgButtonView.ImageUrl = "images/Tab_B_ViewCam_Disabled.jpg"; //imgButtonRename.Visible = false; imgButtonMove.Visible = true; imgButtonMisc.Visible = false; break; case 5: imgButtonView.ImageUrl = "images/Tab_B_ViewSce.jpg"; //imgButtonView.ImageUrl = "images/Tab_B_ViewCam_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_RecordSce_Disabled.jpg"; //imgButtonMove.ImageUrl = "images/Tab_B_MoveSce.jpg"; if(txtEnableViewButton.Value == "false") imgButtonView.ImageUrl = "images/Tab_B_ViewSce_Disabled.jpg"; imgButtonRename.Visible = false; imgButtonMove.Visible = false; imgButtonMisc.Visible = false; break; } } catch(Exception Err) { txtAlert.Value = Err.Message; } }
/// <summary> /// Returns the User object for the specified CardNumber /// </summary> /// <param name="CardNumber"></param> /// <returns></returns> public User GetUser(string CardNumber) { User U = new User(); string sSQL = "Select * FROM tblUser WHERE CardNumber = '" + CardNumber + "'"; try { Functions.RFConnection RF = GetAvailableConnection(); DataTable DTUser = GetDataTable(sSQL); int icount = DTUser.Rows.Count; if(icount == 0) return null; DataRow R = DTUser.Rows[0]; if(R != null) { FillUser(ref U,R); } DTUser.Dispose(); return U; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
private void RefreshGrid() { try { imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg"; imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg"; imgButtonView.ToolTip = "Create a new Note"; imgButtonRename.ToolTip = "Edit selected Note"; imgButtonMove.ToolTip = "Permanently removes selected Note"; OSystem = (Oyster)Session["Oyster"]; LUser = (User)Session["LUser"]; //TabStrip1.Enabled = true; int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10); if(SelectedIndex != 1) { return; } int numselected = Convert.ToInt32(NumSelected.Value,10); lblNoNote.Visible = true; dgNotes.Visible = false; if(numselected == 0) lblNoNote.Text = "Notes for each recording are available only after selecting a Player View. To do this: Click the Recording Tab then select the desired recording. Click View Recording. When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab."; else if(numselected > 1) lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes."; else { lblNoNote.Visible = false; dgNotes.Visible = true; } if((txtLastNote.Value != "")&&(txtLastNote.Value != "Restricted")) { taNote.Visible = false; string[] NodeData = txtLastNote.Value.Split('~'); Functions F = new Functions(); int RecordingId = Convert.ToInt32(NodeData[0],10); F.GetNotes(RecordingId,ref DA,ref DS,ref SC); //OSystem.GetNotes(RecordingId,ref DS); DS.Tables[0].Columns[0].ColumnMapping = MappingType.Hidden; Session["DS"] = DS; Session["DA"] = DA; Session["SC"] = SC; dgNotes.DataSource = DS.Tables[0]; dgNotes.SelectedIndex = -1; //dgNotes.AllowSorting = true; dgNotes.DataBind(); //imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg"; //imgButtonMisc.Visible = false; dgNotes.Visible = true; lblSync.Visible = false; tbSync.Visible = false; tbSync.Disabled = true; taNote.Visible = false; lblNoNote.Visible = false; Recording R = OSystem.GetRecordingById(RecordingId); Session["NoteRecording"] = R; bool bEnableControls = false; if(R.OwnerID == LUser.ID) bEnableControls = true; if(bEnableControls == true) { imgButtonView.ImageUrl = "images/Tab_B_NewNote.jpg"; } else { imgButtonView.ImageUrl = "images/Tab_B_NewNote_Disabled.jpg"; } if(dgNotes.Items.Count != 0) { if((dgNotes.SelectedItem != null)&&(bEnableControls == true)) { imgButtonRename.ImageUrl = "images/Tab_B_EditNote.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote.jpg"; } else { } } else { imgButtonRename.ImageUrl = "images/Tab_B_EditNote_Disabled.jpg"; imgButtonMove.ImageUrl = "images/Tab_B_RemoveNote_Disabled.jpg"; dgNotes.Visible = false; lblNoNote.Visible = true; lblNoNote.Text = "There are currently no notes associated with this recording"; } if(DS.Tables[0].Rows.Count < 1) { // imgButtonRename.Visible = false; // imgButtonMove.Visible = false; // imgButtonMisc.Visible = false; // imgButtonView.Visible = true; // lblNoNote.Visible = true; // dgNotes.Visible = false; // if(numselected == 0) // lblNoNote.Text = "Notes for each recording are available only after selecting a Player View. To do this: Click the Recording Tab then select the desired recording. Click View Recording. When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab."; // else if(numselected > 1) // lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes."; // else // { // lblNoNote.Visible = false; // dgNotes.Visible = true; // } } // else // { // imgButtonRename.Visible = false; // imgButtonMove.Visible = false; // imgButtonMisc.Visible = false; // imgButtonView.Visible = true; // } } else { //DataTable dt = new DataTable(); //dgNotes.DataSource = dt; imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg"; imgButtonMisc.Visible = false; lblSync.Visible = false; tbSync.Visible = false; taNote.Visible = false; // lblNoNote.Visible = true; // dgNotes.Visible = false; // if(numselected == 0) // lblNoNote.Text = "Notes for each recording are available only after selecting a Player View. To do this: Click the Recording Tab then select the desired recording. Click View Recording. When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab."; // else if(numselected > 1) // lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes."; // else // { // lblNoNote.Visible = false; // dgNotes.Visible = true; // } // if(txtNotes.Value == "") // lblNoNote.Text = "Notes for each recording are available only after selecting a Player View. To do this: Click the Recording Tab then select the desired recording. Click View Recording. When ever the recording is selected in the view area, its Notes options will become available by clicking the Notes Tab."; // else // lblNoNote.Text = "Notes will not show if multiple Players are selected. Please choose only one Player to view it's Notes."; // //imgButtonRename.Visible = false; //imgButtonMove.Visible = false; //imgButtonMisc.Visible = false; //imgButtonView.Visible = false; } } catch(Exception Err) { string peekerror = Err.Message; } }
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; } }
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; } }
private void Form1_Load(object sender, System.EventArgs e) { try { IsLoading = true; SplashScreen = (frmSplash)this.Owner; //new frmSplash(); //SplashScreen.lblVersion.Text = "2.0.15.0"; SplashScreen.lblStatus.Text = "Initializing Hard Copy resources..."; SplashScreen.Refresh(); UserLicense.OnTimedOut += new EventHandler(UserLicense_OnTimedOut); //Application.DoEvents(); //Acquire the Custom Color CustomRed = lblAvailableSpace.ForeColor; //Variables used to get Video Information //ReadMediaBufferServerLocalAddress(); cmdAddOne.Image = imgButtons.Images[16]; cmdAddAll.Image = imgButtons.Images[12]; cmdRemoveOne.Image = imgButtons.Images[8]; cmdRemoveAll.Image = imgButtons.Images[4]; cmdBurn.Image = imgButtons.Images[0]; lstvMembersOfGroup = new ListView(); CurrentUsersRecordings = new ListView(); lblSizeOnDVD.Text = "Total File Size : 0" + " Bytes"; string CarverLabDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), CarverLab.Utility.AppInfo.Title); MyGlobals.Logger.WriteLog("Carver Lab Folder: {0}", CarverLabDirectory); DefaultDirectory = Path.Combine(CarverLabDirectory, "DownloadFiles"); MyGlobals.Logger.WriteLog("Downloaded files folder: {0}", DefaultDirectory); if (!Directory.Exists(DefaultDirectory)) Directory.CreateDirectory(DefaultDirectory); //Initialize Card Video System //CVOS = new CardVideoObjects.SystemClass(); //Initialize MHCOM object //MHClient = new MHCOM.MediaHawkClientClass(); //MHClient.ListVideo += new MHCOM._IMediaHawkClientEvents_ListVideoEventHandler(this.mhListVideo); Total_File_SizeMH = 0; Total_File_SizeDVD = 0; //this.MHClient.DownloadComplete = new MHCOM._IMediaHawkClientEvents_DownloadCompleteEventHandler(OnMHClient_DownloadComplete(string str, bool bb)); //this.MHClient.DownloadProgress = new MHCOM._IMediaHawkClientEvents_DownloadProgressEventHandler(OnMHClient_DownloadProgress(string str, double d1, double d2)); // LoginUser(); // if(bLOGOFF == true) // { // //SplashScreen.Dispose(); // Application.Exit(); // return; // } ListViewItem LV = new ListViewItem(); // g_objUser = cvosUser; SelectedUser = LUser; //LV = lstvMembersOfGroup.Items.Add(cvosUser.Description); //LV.Tag = g_objUser; UserCollection = new OysterDictionary(); UserCollection.Add(SelectedUser.Description,SelectedUser); //LV = lstvMembersOfGroup.Items.Add(SelectedUser.Description); //LV.Tag = SelectedUser; SplashScreen.lblStatus.Text = "Verifying login user's recordings..."; //Application.DoEvents(); SplashScreen.Refresh(); cbUsers.Items.Add(SelectedUser.Description); cbUsers.Text = SelectedUser.Description; MyGlobals.Logger.WriteLog("Adding users to user collection..."); OysterClassLibrary.Users ALLUSERSINHIERACHY = SelectedUser.AllMembersInHierarchy; int[] UO = OSystem.UnassignedIDs; foreach(OysterClassLibrary.User myUser in ALLUSERSINHIERACHY) { if(myUser.ID != UO[0]) { UserCollection.Add(myUser.Description,myUser); cbUsers.Items.Add(myUser.Description); LV.Tag = myUser; } //NOTE TO SELF:: MAY NEED TO ADD ALL USERS TO THE UserCollection Object } // foreach(CardVideoObjects.Body BB in cvosUser.Bodys) // { // ListUserMembers(BB); // } //Variables used in the following DVD Burner Info and Stats SplashScreen.lblStatus.Text = "Detecting connected devices..."; //Application.DoEvents(); SplashScreen.Refresh(); short s = 0; short i =0; short first_burner = 0; bool first_pass = false; bool bBool = false; bool found_burner =false; found_burner = false; int Found_Count = 0; MyGlobals.Logger.WriteLog("Detecting writable drives ..."); s = MCD.DeviceCount; Application.DoEvents(); s = MCD.DeviceCount; MyGlobals.Logger.WriteLog("Found {0} drives.", s); MCDWriters = new Devices[s]; for( i = 0; i <= (s - 1); i++) { bBool = MCD.SelectDevice(i); if (bBool) { if( MCD.DeviceIsBurner()) { string deviceName = MCD.get_DeviceName(i); MyGlobals.Logger.WriteLog("Adding optical drive {0} to the list.", deviceName); cboBurners.Items.Add(deviceName); found_burner = true; MCDWriters[Found_Count].Description = deviceName; MCDWriters[Found_Count].DeviceId = i; MCDWriters[Found_Count].SetCount(Found_Count + 1); int test = MCDWriters[Found_Count].Count(); Found_Count += 1; if (first_pass == false) { first_burner = i; first_pass = true; } } } } //Checks to see if a burner was found if (!found_burner) { //MessageBox.Show("No CD/DVD Burners found! Only Network Storage option is available."); cboBurners.Items.Add(NETWORKDEVICENAME); cboBurners.Text = NETWORKDEVICENAME; lblAvailableSpace.Visible = false; UseNetwork = true; } else //if a burner was found add the option to store on network drive { cboBurners.Items.Add(NETWORKDEVICENAME); //cboBurners.Text = GetSetting("Card Video Burner", "SAVE_DEVICES", "LAST_SELECTED", MCD.SelectDevice(1).ToString()); cboBurners.Text =(string) GetRegistryValue(MAJORSECTION,MINORSECTION,MINISECTION,KEYSECTION,"FIRSTTIME"); Application.DoEvents(); if( cboBurners.Text == "FIRSTTIME")//This means that there was no entry in registry--FIRST TIME APPLICATION RUN ONLY { MCD.SelectDevice(first_burner); cboBurners.Text = MCD.get_DeviceName(first_burner); lblAvailableSpace.Visible = true; if (MCD.TestUnitReady() == false) { lblAvailableSpace.Text = "Disc not ready...."; lblAvailableSpace.Refresh(); } else { if (cboBurners.Text != NETWORKDEVICENAME) { s = MCD.DeviceCount; found_burner = false; // Search to see if Device in registry is still attached to system for(i = 0; i<=(s-1);i++) { bBool = MCD.SelectDevice(i); if(bBool == true) { if( MCD.get_DeviceName(i) == cboBurners.Text) { found_burner = true; } } } //If the Device in the registry no longer exist then assign first device found. if( found_burner == false) { MCD.SelectDevice(first_burner); } lblAvailableSpace.Visible = true; if( MCD.TestUnitReady() == false) { lblAvailableSpace.Text = "Disc not ready...."; lblAvailableSpace.Refresh(); } else { lblAvailableSpace.Visible = false; UseNetwork = true; } } } } } SplashScreen.lblStatus.Text = "Load completed. Launching Application.."; //Application.DoEvents(); SplashScreen.Refresh(); IsLoading = false; cmdBurn.Enabled = false; CheckBurner = true; TMonitor_Disc = new System.Threading.Thread(new System.Threading.ThreadStart(CheckBurnerDevice)); TMonitor_Disc.Start(); // RefreshScreen.Enabled = true; } catch (System.Exception ex) { MyGlobals.Logger.WriteLog("Exception: {0}", ex.ToString()); MessageBox.Show(this,ex.Message,AppInfo.Title + ": Error"); } }
private void cbUsers_SelectedIndexChanged(object sender, System.EventArgs e) { PostActivity(); CurrentUsersRecordings.Items.Clear(); //Variables used to get Video Information SelectedUser = (OysterClassLibrary.User)UserCollection[cbUsers.Text]; if(SelectedUser == null) return; OysterClassLibrary.Sections SS = SelectedUser.AllMemberSections; Msg("Loading " + SelectedUser.Description + "'s recordings... please wait"); MyGlobals.Logger.WriteLog("Loading " + SelectedUser.Description + "'s recordings"); tvVSS.BeginUpdate(); tvVSS.Nodes.Clear(); TreeNode URecordings = new TreeNode(); OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); foreach(OysterClassLibrary.Section CurrentSection in SS) { if (SelectedUser.ID != LUser.ID) { foreach(OysterClassLibrary.Section LoginUserSection in LUser.AllOwnedSections) { if (F.IsInMyHierarchy(LoginUserSection.ID,CurrentSection.ID)) { bool Addit = F.IsInMyHierarchy(LoginUserSection.ID,CurrentSection.ID); Recordings AR = CurrentSection.CurrentRecordings; if(Addit == true) { if((CurrentSection.IsDefault == false)&&(AR.Count > 0)) { TreeNode NodeX = tvVSS.Nodes.Add(CurrentSection.Description); NodeX.Tag = LUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.DarkBlue; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; ListView lvSessions = new ListView(); //foreach(OysterClassLibrary.Recording R in B.Recordings) foreach(OysterClassLibrary.Recording R in AR) { if(SelectedUser.ID == R.OwnerID) { 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(); if(SelectedUser.ID == DrawRecording.OwnerID) { 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; ListViewItem LVI = CurrentUsersRecordings.Items.Add(DrawRecording.Description); LVI.Tag = DrawRecording; NodeRecording.Tag = DrawRecording; NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); } } } } } } } else { foreach(OysterClassLibrary.Section B in SS) { OysterClassLibrary.Recordings AR = F.ALLRecordings(B.ID); if((B.IsDefault == false)&&(AR.Count > 0)) { TreeNode NodeX = tvVSS.Nodes.Add(B.Description); NodeX.Tag = LUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.DarkBlue; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; ListView lvSessions = new ListView(); //foreach(OysterClassLibrary.Recording R in B.Recordings) foreach(OysterClassLibrary.Recording R in AR) { if(SelectedUser.ID == R.OwnerID) { 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(); if(SelectedUser.ID == DrawRecording.OwnerID) { 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; ListViewItem LVI = CurrentUsersRecordings.Items.Add(DrawRecording.Description); LVI.Tag = DrawRecording; NodeRecording.Tag = DrawRecording; NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); } } } #region MovingCode // else if((B.IsDefault == true)&&(AR.Count > 0)) // { // TreeNode NodeX = new TreeNode(); // if(OSystem.SectionTypeSysAdmin.ID == LUser.HighestAuthorityLevel.ID) // { // NodeX = tvVSS.Nodes.Add("Recordings"); // // NodeX.Tag = OSystem.SectionTypeSysAdmin; // NodeX.Tag = LUser.HighestAuthorityLevel; // NodeX.ForeColor = System.Drawing.Color.DarkBlue; // NodeX.ImageIndex = 6; // NodeX.SelectedImageIndex = 6; // // } // else // { // NodeX = tvVSS.Nodes.Add("Unassigned Recordings"); // // NodeX.Tag = HighestSectionType; // NodeX.Tag = LUser.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(SelectedUser.ID == R.OwnerID) // { // 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(); // if(SelectedUser.ID == DrawRecording.OwnerID) // { // 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; // ListViewItem LVI = CurrentUsersRecordings.Items.Add(DrawRecording.Description); // LVI.Tag = DrawRecording; // NodeRecording.Tag = DrawRecording; // NodeRecording.ImageIndex = 3; // NodeRecording.SelectedImageIndex = 3; // NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); // } // } // } #endregion } } } F.Dispose(); //Unassigned Recordings Section DefaultSection = null; if((LUser.ID == SelectedUser.ID)||(LUser.HighestAuthorityLevel.CanViewUnassignedRecordings.Count > 0)) DefaultSection = SelectedUser.DefaultSection; if(DefaultSection != null) { Recordings AR = DefaultSection.CurrentRecordings; if(AR.Count > 0) { TreeNode NodeX = new TreeNode(); if(OSystem.SectionTypeSysAdmin.ID == LUser.HighestAuthorityLevel.ID) { NodeX = tvVSS.Nodes.Add("Recordings"); // NodeX.Tag = OSystem.SectionTypeSysAdmin; NodeX.Tag = LUser.HighestAuthorityLevel; NodeX.ForeColor = System.Drawing.Color.DarkBlue; NodeX.ImageIndex = 6; NodeX.SelectedImageIndex = 6; } else { NodeX = tvVSS.Nodes.Add("Unassigned Recordings"); // NodeX.Tag = HighestSectionType; NodeX.Tag = LUser.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(SelectedUser.ID == R.OwnerID) { 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(); if(SelectedUser.ID == DrawRecording.OwnerID) { 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; ListViewItem LVI = CurrentUsersRecordings.Items.Add(DrawRecording.Description); LVI.Tag = DrawRecording; NodeRecording.Tag = DrawRecording; NodeRecording.ImageIndex = 3; NodeRecording.SelectedImageIndex = 3; NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular); } } } } Msg("Verifying recording availability. Please wait..."); HardCopy.DownloadInfo DI = new HardCopy.DownloadInfo(); DI.LV = CurrentUsersRecordings; DI.iLocalMBSAddress = 0; FDownload = new frmValidateRecordings(); FDownload.Tag = DI; if(IsLoading) FDownload.Opacity = 0; FDownload.ShowDialog(this); if(FDownload.DialogResult == DialogResult.OK) { } else MessageBox.Show("Returned failed!"); Msg("Recordings verified. Calculated total file sizes..."); DI =(HardCopy.DownloadInfo) FDownload.Tag; CurrentUsersRecordings = DI.LV; Total_File_SizeMH = DI.SizeOfAllFilesInBytes; CheckNodes(tvVSS.Nodes); tvVSS.EndUpdate(); //Total_File_SizeMH =1549035830; if(Total_File_SizeMH > 0) { lblSizeOnMediaHawk.Text = "Total File Size : " + ConvertByteToString(Total_File_SizeMH); } else { lblSizeOnMediaHawk.Text = "Total File Size : 0" + " Bytes"; } Msg(""); }
public void Add(User X) { List.Add(X); }
/// <summary> /// Used by other Functions to fill a User object /// </summary> /// <param name="U"></param> /// <param name="dr"></param> /// <returns></returns> internal bool FillUser(ref User U, DataRow dr) { U = new User(); try { U.mvarID = Convert.ToInt32((object)dr[0]); U.mvarDescription = Convert.ToString((object)dr[1]); U.mvarFirstName = Convert.ToString((object)dr[2]); U.mvarMiddleName = Convert.ToString((object)dr[3]); U.mvarLastName = Convert.ToString((object)dr[4]); U.mvarCreatedDate = Convert.ToDateTime((object)dr[5]); U.mvarLoginName = Convert.ToString((object)dr[6]); U.mvarPassword = Convert.ToString((object)dr[7]); U.mvarCanRecord = Convert.ToBoolean((object)dr[8]); U.mvarUniqueIdentifier = Convert.ToString((object)dr[9]); U.mvarCardNumber = Convert.ToString((object)dr[10]); } catch(Exception Err) { string Error = Err.Message; throw new ApplicationException(Err.Message); //return false; } return true; }
/// <summary> /// Returns the User object for the specified LoginName and Password /// </summary> /// <param name="LoginName"></param> /// <param name="Password"></param> /// <returns></returns> /// public User GetUser(string LoginName,string Password) { try { User U = new User(); string sSQL = "Select * FROM tblUser WHERE LoginName = '" + LoginName + "' AND Password = '******'"; DataTable DTUser = GetDataTable(sSQL); int icount = DTUser.Rows.Count; if(icount == 0)return null; // SqlCommand mc = new SqlCommand(sSQL,MC); // SqlDataReader mr = mc.ExecuteReader(); DataRow R = DTUser.Rows[0]; if(R != null) { FillUser(ref U,R); } DTUser.Dispose(); return U; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
public User Login(string CardNumber) { try { User TempUser = null; Functions F =new Functions(); //Check to see if Login is valid and Fill User try { TempUser = new User(); TempUser = F.GetUser(CardNumber); if(TempUser == null) throw new ApplicationException("Card not found in database!"); return Login(TempUser.LoginName,TempUser.Password); } catch(Exception Err) { throw new ApplicationException(Err.Message); } } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here InitializeEvents(); if(!this.IsPostBack) { Functions F = new Functions(); taNote.Visible = false; tbSync.Visible = false; //Session["IsRecording"] = "RecordingSession"; OSystem = (Oyster)Session["Oyster"]; LUser = (User)Session["LUser"]; HideButtons(false); int timestried = 0; txtEnableViewButton.Value = "true"; tryagain:{} try { User CurrentUser = (User)Session["User"]; if(CurrentUser == null) CurrentUser = LUser; int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10); switch(SelectedIndex) { case 0: Users MyMembers = LUser.AllMembersInHierarchy; MyMembers.SortAscending(); int NoID = OSystem.UnassignedIDs[0]; foreach(User NewUser in MyMembers) { if(NewUser.ID != NoID) { ListItem LI = new ListItem(NewUser.Description,NewUser.ID.ToString()); DDL.Items.Add(LI); } } bool NoNeed = false; foreach(ListItem LI in DDL.Items) { int MatchID = Convert.ToInt32(LI.Value); if(MatchID == LUser.ID) { NoNeed = true; if(CurrentUser.ID == LUser.ID) LI.Selected = true; } } if(NoNeed == false) { ListItem LIL = new ListItem(LUser.Description,LUser.ID.ToString()); if(CurrentUser.ID == LUser.ID) LIL.Selected = true; DDL.Items.Add(LIL); } if(CurrentUser.ID != LUser.ID) { foreach(ListItem LI in DDL.Items) { int MatchID = Convert.ToInt32(LI.Value); if(MatchID == CurrentUser.ID) { LI.Selected = true; } } } FillTree(CurrentUser.ID); SwitchButtons(1); System.GC.Collect(); break; case 1: if((txtNotes.Value != "")&&(txtNotes.Value != "Restricted")) { string[] NodeData = new string[0]; NodeData = txtNotes.Value.Split(' '); try { int id = Convert.ToInt32(NodeData[0]); F.GetNotes(id,ref DA,ref DS,ref SC); dgNotes.DataSource = DS.Tables[0]; dgNotes.DataBind(); dgNotes.AllowSorting = true; } catch(Exception Err) { txtAlert.Value = Err.Message; } } else { dgNotes = new DataGrid(); } SwitchButtons(2); break; case 2: SwitchButtons(4); break; } } catch(Exception Err) { if(timestried > 4) { txtAlert.Value = Err.Message; return; } timestried++; goto tryagain; } } else { if(Transitioning == true) { Transitioning = false; } txtRecording.Value = ""; int SelectedIndex = Convert.ToInt32(txtSelectedIndex.Value,10); if(SelectedIndex == 0) { dgNotes.Visible = false; TreeNode TN = tv.GetNodeFromIndex(tv.SelectedNodeIndex); if(TN != null) { if(TN.Type == "RecordingSession") SwitchButtons(2); else SwitchButtons(1); } else SwitchButtons(1); } else if(SelectedIndex == 1) { DS = (DataSet)Session["DS"]; DA = (SqlDataAdapter)Session["DA"]; SC = (SqlConnection)Session["SC"]; if(txtNotes.Value != txtLastNote.Value) { SwitchButtons(3); } else RefreshNoteButtons(); //dgNotes.DataSource = DS.Tables[0]; } else if(SelectedIndex == 2) { dgNotes.Visible = false; TreeNode CTVNode = (TreeNode)Session["CTVNode"]; if(CTVNode != null) { if(CTVNode.Type == "Scene") SwitchButtons(5); else SwitchButtons(4); } else { SwitchButtons(4); } } } txtWaitMessage.Value = "safetocontinue"; //Response.Write("<script> HideTable(WaitMessage); </script>"); // txtLastNote.Value = txtNotes.Value; }
public User Login(string LoginName, string Password) { try { if(IsLoggedOn == true) { //mvarLoggedOnUser = new User(); IsLoggedOn = false; } Functions F = new Functions(); //Check to see if Login is valid and Fill User try { mvarLoggedOnUser = new User(); mvarLoggedOnUser = F.GetUser(LoginName,Password); if(mvarLoggedOnUser == null) { throw new ApplicationException("Invalid Login Name or Password!"); } //myConnection.Close(); } catch(Exception Err) { throw new Exception(Err.Message,Err.InnerException); } //Check if SystemAdmin SectionType ST = mvarLoggedOnUser.HighestAuthorityLevel; if(ST.mvarPreviousSectionTypeID == -99) { //Check to see if SystemAdmin already logged in if(OysterTimer.Enabled == false) { SystemAdminAlreadyLoggedIn = F.IsSystemAdminLoggedIn(); if(SystemAdminAlreadyLoggedIn == false) { AcquireSystemLock(); OysterTimer.Enabled = true; } } } IsLoggedOn = true; return mvarLoggedOnUser; } catch(Exception Err) { throw new Exception(Err.Message,Err.InnerException); } }
/// <summary> /// Returns the User object for the specified ID /// </summary> /// <param name="ID"></param> /// <returns></returns> public User GetUser(int ID) { try { User U = new User(); string sSQL = "Select * FROM tblUser WHERE ID = " + ID; DataTable DTUser = GetDataTable(sSQL); int icount = DTUser.Rows.Count; if(icount == 0) return null; DataRow R = DTUser.Rows[0]; if(R != null) { FillUser(ref U,R); } DTUser.Dispose(); return U; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }