Пример #1
0
        /// <summary>
        /// Get all Notes associated with CurrentRecording that AccessingUser can see, ordered by SyncTime
        /// </summary>
        /// <param name="RecordingId"></param>
        /// <returns></returns>
        internal Notes GetNotes(OCL.User AccessingUser, OCL.RecordingSession CurrentSession)
        {
            string sSQL = "";

            if(AccessingUser.mvarIsSuperUser)
            {
                sSQL = "Select Id,SyncTime,Description,SessionId,IsDefault,Created FROM tblNotes WHERE SessionId = " + CurrentSession.ID +
                    " ORDER BY SyncTime";
            }
            else
            {
                sSQL = "SELECT DISTINCT tblGroupTokens.ObjectId, tblNotes.SyncTime FROM tblGroupTokens LEFT OUTER JOIN tblNotes ON " +
                    " tblGroupTokens.ObjectId = tblNotes.Id WHERE " +
                    " tblGroupTokens.UserId = " + AccessingUser.ID +
                    " AND tblGroupTokens.ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.Note) +
                    " AND tblGroupTokens.IsVisible <> 0" +
                    " AND tblNotes.SessionId = " + CurrentSession.ID +
                    " ORDER BY tblNotes.SyncTime";
            }
            DataSet DS = RF.GetDataSet(sSQL);
            DataTable DT = DS.Tables[0];

            Notes TheseNotes = new Notes();

            if(DT.Rows.Count == 0)
                return TheseNotes;
            foreach(DataRow r in DT.Rows)
            {
                Note X = GetNote(Convert.ToInt32(r[0]));
                TheseNotes.Add(X);
            }
            return TheseNotes;
        }
Пример #2
0
        /// <summary>
        /// Get all Notes associated with this RecordingId ordered by SyncTime
        /// </summary>
        /// <param name="RecordingId"></param>
        /// <returns></returns>
        internal Notes GetNotes(int RecordingId)
        {
            string sSQL = "Select Id,SyncTime,Description,SessionId,UserId,IsDefault, Created FROM tblNotes WHERE RecordingId = " + RecordingId.ToString() +
                " ORDER BY SyncTime";

            DataSet DS = RF.GetDataSet(sSQL);
            DataTable DT = DS.Tables[0];

            Notes TheseNotes = new Notes();

            if(DT.Rows.Count == 0)
                return TheseNotes;
            foreach(DataRow r in DT.Rows)
            {
                Note X = new Note();
                X.mvarID = Convert.ToInt32(r[0]);
                X.mvarDescription = Convert.ToString(r[2]);
                X.mvarSyncTime = Convert.ToString(r[1]);
                X.mvarSessionID = Convert.ToInt32(r[3]);
                //X.mvarUserId = Convert.ToInt32(r[4]);
                X.mvarIsDefault = Convert.ToBoolean(r[4]);
                X.mvarCreated = Convert.ToDateTime(r[5]);

                TheseNotes.Add(X);
            }
            return TheseNotes;
        }