Esempio n. 1
0
        /// <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;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }