private void RunSearch(OCL.OysterRecordingSessionSearchType RecordingSessionSearchType, string SearchCriteria) { lvSearchResults.Items.Clear(); OCL.RecordingSessions ARS = new OCL.RecordingSessions(); if(SearchCriteria != string.Empty) { ARS = LUser.AllVisibleRecordingSessions(LUser,RecordingSessionSearchType,SearchCriteria); } else { try { ARS = LUser.AllVisibleRecordingSessions(LUser); } catch(Exception Err) { MessageBox.Show(Err.Message,"Programmer Error:"); return; } } if(ARS.Count == 0) { lblInformation.Text = "No Recording Sessions found that match this search string"; lblInformation.ForeColor = Color.Red; return; } foreach(OCL.RecordingSession RS in ARS) { ListViewItem LVI = lvSearchResults.Items.Add(RS.Description); LVI.SubItems.Add(RS.CreatedDate.ToString()); OCL.User Owner = OSystem.GetUserById(RS.OwnerID); LVI.SubItems.Add(Owner.Description); LVI.SubItems.Add(RS.IsPresentation.ToString()); LVI.SubItems.Add(RS.CurrentRecordings(LUser).Count.ToString()); LVI.Tag = RS; } lblInformation.Text = "Search Results - Check recording sessions then click Add."; lblInformation.ForeColor = Color.Black; }
internal OCL.RecordingSessions GetAllVisibleSessions(OCL.User AccessingUser) { string sSQL = ""; bool GetOwned = false; if(AccessingUser.mvarIsSuperUser) { sSQL = "SELECT ID FROM tblSession WHERE ID <> " + ((OCL.Recording)(GetUnassignedObject(OCL.OysterUnassignedObjects.Recording))).ID + " AND IsOysterSession <> 0 " + "ORDER BY DisplayName"; } else { sSQL = "SELECT DISTINCT tblGroupTokens.ObjectId, tblSession.Description FROM tblGroupTokens LEFT OUTER JOIN tblSession ON tblGroupTokens.ObjectId = tblSession.Id WHERE UserId = " + AccessingUser.ID + " AND tblGroupTokens.ObjectTypeId = 7" + " AND tblGroupTokens.IsVisible <> 0" + " AND tblSession.IsOysterSession <> 0 " + " ORDER BY tblSession.Description"; GetOwned = true; } System.Data.DataSet DS = null; try { DS = RF.GetDataSet(sSQL); } catch(SqlException Err) { throw new Exception(Err.Message,Err.InnerException); } OCL.RecordingSessions AS = new OCL.RecordingSessions(); foreach(DataRow r in DS.Tables[0].Rows) { int SessionID = Convert.ToInt32(r[0]); OCL.RecordingSession S = GetSession(SessionID); AS.Add(S); } if(GetOwned == true) { sSQL = "SELECT ID FROM tblSession left outer join tblRecording " + "ON tblRecording.SessionId = tblSession.Id WHERE OwnerId = " + AccessingUser.ID + " AND tblSession.IsOysterSession <> 0 " + " ORDER BY tblSession.Description"; DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { int SessionID = Convert.ToInt32(r[0]); foreach(OCL.RecordingSession OS in AS) { if(OS.ID == SessionID) goto skipAdd; } AS.Add(GetSession(SessionID)); skipAdd:{} } OCL.User PAccess = GetPublicAccessUser(); if(AccessingUser.ID != PAccess.ID) { sSQL = "SELECT ID FROM tblSession WHERE OwnerId = " + PAccess.ID + " AND tblSession.IsDefault = 0 AND tblSession.IsOysterSession <> 0 ORDER BY Description"; DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { // foreach(OCL.RecordingSession OR in AR) // { // if(OR.ID == Convert.ToInt32(r[0])) // goto skipAdd; // } AS.Add(GetSession(Convert.ToInt32(r[0]))); // skipAdd:{} } } } return AS; }
/// <summary> /// Returns all recordings that are visible to the AccessingUser /// </summary> /// <param name="AccessingUser"></param> /// <param name="TargetUser"></param> /// <returns>OCL.Recordings</returns> internal RecordingSessions GetAllVisibleRecordingSessions(OCL.User AccessingUser,OysterRecordingSessionSearchType RecordingSessionSearchType,string SearchCriteria) { string sSQL = ""; bool GetOwned = false; string WhereClause = BuildWhereClauseString(RecordingSessionSearchType,SearchCriteria); if(((RecordingSessionSearchType != OysterRecordingSessionSearchType.TitleAndNotes)||(RecordingSessionSearchType != OysterRecordingSessionSearchType.Groups))&&(AccessingUser.mvarIsSuperUser)) { // sSQL = "SELECT DISTINCT tblSession.Id, tblSession.Description FROM tblSession " + WhereClause + " AND tblSession.IsDefault <> 1 ORDER BY tblSession.Description"; sSQL = "SELECT tblSession.Id, tblSession.Description FROM tblSession " + WhereClause + " AND tblSession.IsDefault = 0 AND tblSession.IsOysterSession <> 0 ORDER BY tblSession.Description"; } else if((RecordingSessionSearchType == OysterRecordingSessionSearchType.TitleAndNotes)&&(AccessingUser.mvarIsSuperUser)) { sSQL = "SELECT DISTINCT tblSession.Id, tblSession.Description FROM tblSession " + WhereClause + " AND tblSession.IsDefault <> 1 AND tblSession.IsOysterSession <> 0 ORDER BY tblSession.Description"; } else { sSQL = "SELECT DISTINCT tblGroupTokens.ObjectId, tblSession.Description FROM tblGroupTokens LEFT OUTER JOIN tblSession ON tblGroupTokens.ObjectId = tblSession.Id " + WhereClause+ " AND UserId = " + AccessingUser.ID + " AND tblGroupTokens.ObjectTypeId = 7" + " AND tblGroupTokens.IsVisible <> 0" + " AND tblSession.IsDefault = 0" + " AND tblSession.IsOysterSession <> 0 " + " ORDER BY tblSession.Description"; GetOwned = true; } System.Data.DataSet DS = null; try { DS = RF.GetDataSet(sSQL); } catch(SqlException Err) { throw new Exception(Err.Message,Err.InnerException); } OCL.RecordingSessions AR = new OCL.RecordingSessions(); foreach(DataRow r in DS.Tables[0].Rows) { AR.Add(GetSession(Convert.ToInt32(r[0]))); } if(GetOwned == true) { sSQL = "SELECT tblSession.ID FROM tblSession "+ WhereClause + " AND OwnerId = " + AccessingUser.ID + " AND tblSession.IsDefault = 0 AND tblSession.IsOysterSession <> 0 ORDER BY Description"; DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { foreach(OCL.RecordingSession OR in AR) { if(OR.ID == Convert.ToInt32(r[0])) goto skipAdd; } AR.Add(GetSession(Convert.ToInt32(r[0]))); skipAdd:{} } OCL.User PAccess = GetPublicAccessUser(); if(AccessingUser.ID != PAccess.ID) { sSQL = "SELECT tblSession.ID FROM tblSession "+ WhereClause + " AND OwnerId = " + PAccess.ID + " AND tblSession.IsDefault = 0 AND tblSession.IsOysterSession <> 0 ORDER BY Description"; DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { // foreach(OCL.RecordingSession OR in AR) // { // if(OR.ID == Convert.ToInt32(r[0])) // goto skipAdd; // } AR.Add(GetSession(Convert.ToInt32(r[0]))); // skipAdd:{} } } } return AR; }
internal OCL.RecordingSessions GetAllVisibleContent(OCL.User AccessingUser) { string sSQL = ""; bool GetOwned = false; if(AccessingUser.mvarIsSuperUser) { sSQL = "SELECT ID FROM tblSession WHERE IsDefault = 0 AND tblSession.IsOysterSession = 0 ORDER BY Description"; ; } else { sSQL = "SELECT DISTINCT tblGroupTokens.ObjectId, tblSession.Description FROM tblGroupTokens LEFT OUTER JOIN tblSession ON tblGroupTokens.ObjectId = tblSession.Id WHERE UserId = " + AccessingUser.ID + " AND tblGroupTokens.ObjectTypeId = 7" + " AND tblGroupTokens.IsVisible <> 0" + " AND tblSession.IsOysterSession = 0 " + " AND tblSession.IsDefault = 0" + " ORDER BY tblSession.Description"; GetOwned = true; } System.Data.DataSet DS = null; try { DS = RF.GetDataSet(sSQL); } catch(SqlException Err) { throw new Exception(Err.Message,Err.InnerException); } OCL.RecordingSessions AR = new OCL.RecordingSessions(); foreach(DataRow r in DS.Tables[0].Rows) { AR.Add(GetSession(Convert.ToInt32(r[0]))); } if(GetOwned == true) { sSQL = "SELECT ID FROM tblSession WHERE OwnerId = " + AccessingUser.ID + " AND IsDefault = 0 AND tblSession.IsOysterSession = 0 ORDER BY Description"; DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { foreach(OCL.RecordingSession OR in AR) { if(OR.ID == Convert.ToInt32(r[0])) goto skipAdd; } AR.Add(GetSession(Convert.ToInt32(r[0]))); skipAdd:{} } OCL.User PAccess = GetPublicAccessUser(); if(AccessingUser.ID != PAccess.ID) { sSQL = "SELECT ID FROM tblSession WHERE OwnerId = " + PAccess.ID + " AND tblSession.IsDefault = 0 AND tblSession.IsOysterSession = 0 ORDER BY Description"; DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { // foreach(OCL.RecordingSession OR in AR) // { // if(OR.ID == Convert.ToInt32(r[0])) // goto skipAdd; // } AR.Add(GetSession(Convert.ToInt32(r[0]))); // skipAdd:{} } } } return AR; }
private void RunSearch(OCL.OysterRecordingSessionSearchType RecordingSessionSearchType, string SearchCriteria) { lblInformation.Text = "Searching... Please wait."; lblInformation.ForeColor = Color.DarkBlue; lblInformation.Update(); lvSearchResults.Items.Clear(); int FoundCount = 0; //Oyster Recording Sessions OCL.RecordingSessions ARS = new OCL.RecordingSessions(); if(SearchCriteria != string.Empty) { ARS = LUser.AllVisibleRecordingSessions(LUser,RecordingSessionSearchType,SearchCriteria); } else { try { ARS = LUser.AllVisibleRecordingSessions(LUser); } catch(Exception Err) { MessageBox.Show(Err.Message,"Programmer Error:"); return; } } FoundCount += ARS.Count; //Content Session OCL.RecordingSessions ACS = new OCL.RecordingSessions(); if(SearchCriteria != string.Empty) { ACS = LUser.AllVisibleContent(LUser,RecordingSessionSearchType,SearchCriteria); } else { try { ACS = LUser.AllVisibleContent(LUser); } catch(Exception Err) { MessageBox.Show(Err.Message,"Programmer Error:"); return; } } FoundCount += ACS.Count; if(FoundCount == 0) { lblInformation.Text = "No media was found that match this search string."; lblInformation.ForeColor = Color.Red; lvSearchResults.ContextMenu = null; return; } lvSearchResults.BeginUpdate(); foreach(OCL.RecordingSession RS in ARS) { ListViewItem LVI = lvSearchResults.Items.Add(RS.Description); LVI.SubItems.Add(RS.CreatedDate.ToString()); // OCL.User Owner = OSystem.GetUserById(RS.OwnerID); // LVI.SubItems.Add(Owner.Description); // LVI.SubItems.Add(RS.IsPresentation.ToString()); // LVI.SubItems.Add(RS.CurrentRecordings(LUser).Count.ToString()); LVI.Tag = RS; foreach(OCL.Recording R in RS.CurrentRecordings(LUser)) { int retry = 2; RetryAttemp:{} try { if(R.PlayLength == 0) R.Update(true); } catch { if(--retry > 0) goto RetryAttemp; } } } foreach(OCL.RecordingSession RS in ACS) { ListViewItem LVI = lvSearchResults.Items.Add(RS.Description); LVI.SubItems.Add(RS.CreatedDate.ToString()); // OCL.User Owner = OSystem.GetUserById(RS.OwnerID); // LVI.SubItems.Add(Owner.Description); // LVI.SubItems.Add(RS.IsPresentation.ToString()); // LVI.SubItems.Add(RS.CurrentRecordings(LUser).Count.ToString()); LVI.Tag = RS; foreach(OCL.Recording R in RS.CurrentRecordings(LUser)) { int retry = 2; RetryAttemp2:{} try { if(R.PlayLength == 0) R.Update(true); } catch { if(--retry > 0) goto RetryAttemp2; } } } lvSearchResults.EndUpdate(); //////// lvSearchResults.Items.Clear(); //////// OCL.RecordingSessions ARS = new OCL.RecordingSessions(); //////// if(SearchCriteria != string.Empty) //////// { //////// ARS = LUser.AllVisibleRecordingSessions(LUser,RecordingSessionSearchType,SearchCriteria); //////// } //////// else //////// { //////// try //////// { //////// //////// ARS = LUser.AllVisibleRecordingSessions(LUser); //////// } //////// catch(Exception Err) //////// { //////// MessageBox.Show(Err.Message,"Programmer Error:"); //////// return; //////// } //////// } //////// //////// if(ARS.Count == 0) //////// { //////// lblInformation.Text = "No Recording Sessions found that match this search string"; //////// lblInformation.ForeColor = Color.Red; //////// return; //////// } //////// //////// //////// foreach(OCL.RecordingSession RS in ARS) //////// { //////// ListViewItem LVI = lvSearchResults.Items.Add(RS.Description); //////// LVI.SubItems.Add(RS.CreatedDate.ToString()); ////////// OCL.User Owner = OSystem.GetUserById(RS.OwnerID); ////////// LVI.SubItems.Add(Owner.Description); ////////// LVI.SubItems.Add(RS.IsPresentation.ToString()); ////////// LVI.SubItems.Add(RS.CurrentRecordings(LUser).Count.ToString()); //////// LVI.Tag = RS; //////// } lblInformation.Text = "Search Results - Double-click an item to go directly to View Mode."; lblInformation.ForeColor = Color.Black; }
public frmHardDisc() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this.SelectedRecordingSessions = new OCL.RecordingSessions(); frmShowProgress = new frmBurnOysterDisc(); OysterFTP = new OCL.FTPTransfer(); OysterFTP.On_TransferProgress +=new OCL.FTPTransfer.FTPTransferEventHandler(OysterFTP_On_TransferProgress); //OysterFTP.On_Download_Begin +=new OCL.FTPTransfer.FTPTransferEventHandler(OysterFTP_On_Download_Begin); //OysterFTP.On_Download_Complete +=new OCL.FTPTransfer.FTPTransferEventHandler(OysterFTP_On_Download_Complete); }