protected void Page_Load(object sender, EventArgs e)
        {
            pagTitle.InnerText = ResourceManager.GetString("pagTitle");
            if (!Page.IsPostBack)
            {
                if (UserContext.UserData.UserType == UserType.SaltAdmin || UserContext.UserData.UserType == UserType.OrgAdmin)
                {
                    Int32.TryParse(Request.QueryString["timezone"], out this.tzId);

                    using (StoredProcedure sp = new StoredProcedure("prcTimeZone_GetTimeZoneWrittenName",
                                                                    StoredProcedure.CreateInputParam("@TimeZoneID", SqlDbType.Int, this.tzId)))
                    {
                        this.tzWrittenName = sp.ExecuteScalar().ToString();
                    }

                    ViewState.Add("WrittenName", this.tzWrittenName);

                    this.isNew = false;
                    if (Request.QueryString["ruleid"].ToString().ToUpper() == "NEW")
                    {
                        this.isNew            = true;
                        this.txtTimezone.Text = this.tzWrittenName;
                    }
                    else
                    {
                        Int32.TryParse(Request.QueryString["ruleid"], out this.ruleId);
                        this.LoadData();
                    }

                    ViewState.Add("RuleID", this.ruleId);
                    ViewState.Add("TimezoneID", this.tzId);
                    ViewState.Add("IsNew", this.isNew);
                }
            }
        }
Exemplo n.º 2
0
 public void UpdateEvent(Event pro)
 {
     using (StoredProcedure spUpdateProfile = new StoredProcedure("prcEvent_Update",
                                                                  StoredProcedure.CreateInputParam("@EventID", SqlDbType.Int, pro.EventID),
                                                                  StoredProcedure.CreateInputParam("@EventPeriodID", SqlDbType.Int, pro.EventPeriodID),
                                                                  StoredProcedure.CreateInputParam("@EventName", SqlDbType.NVarChar, pro.EventName),
                                                                  StoredProcedure.CreateInputParam("@OrganisationID", SqlDbType.Int, pro.OrganisationID),
                                                                  StoredProcedure.CreateInputParam("@DateStart", SqlDbType.DateTime, ((pro.DateStart == DateTime.Parse("1/1/1900")) ? (object)System.DBNull.Value : pro.DateStart)),
                                                                  StoredProcedure.CreateInputParam("@DateEnd", SqlDbType.DateTime, ((pro.DateEnd == DateTime.Parse("1/1/1900")) ? (object)System.DBNull.Value : pro.DateEnd)),
                                                                  StoredProcedure.CreateInputParam("@Points", SqlDbType.Float, ((pro.Points == 0.0 ? (object)System.DBNull.Value : pro.Points))),
                                                                  StoredProcedure.CreateInputParam("@EndOfPeriodAction", SqlDbType.Char, pro.EndOfPeriodAction),
                                                                  StoredProcedure.CreateInputParam("@MonthIncrement", SqlDbType.Int, ((pro.MonthIncrement == 0 ? (object)System.DBNull.Value : pro.MonthIncrement))),
                                                                  StoredProcedure.CreateInputParam("@FutureDateStart", SqlDbType.DateTime, ((pro.FutureDateStart == DateTime.Parse("1/1/1900")) ? (object)System.DBNull.Value : pro.FutureDateStart)),
                                                                  StoredProcedure.CreateInputParam("@FutureDateEnd", SqlDbType.DateTime, ((pro.FutureDateEnd == DateTime.Parse("1/1/1900")) ? (object)System.DBNull.Value : pro.FutureDateEnd)),
                                                                  StoredProcedure.CreateInputParam("@ProfileID", SqlDbType.Int, pro.ProfileID),
                                                                  StoredProcedure.CreateInputParam("@EventProvider", SqlDbType.NVarChar, pro.EventProvider),
                                                                  StoredProcedure.CreateInputParam("@EventType", SqlDbType.Int, pro.EventType),
                                                                  StoredProcedure.CreateInputParam("@EventLocation", SqlDbType.NVarChar, pro.EventLocation),
                                                                  StoredProcedure.CreateInputParam("@RegisterPoint", SqlDbType.Bit, pro.RegisterPoint),
                                                                  StoredProcedure.CreateInputParam("@AllowUser", SqlDbType.Bit, pro.AllowUser),
                                                                  StoredProcedure.CreateInputParam("@FuturePoints", SqlDbType.Float, ((pro.FuturePoints == 0.0 ? (object)System.DBNull.Value : pro.FuturePoints)))))
     {
         spUpdateProfile.ExecuteNonQuery();
     }
 }
Exemplo n.º 3
0
        public void UpdateTimeZoneRule(int ruleID, SqlString WrittenName, int offsetmins, int year_start, int year_end,

                                       int StartTimeOfDay, int StartDayOfWeek, int StartWeek, int StartMonth,
                                       int EndTimeOfDay, int EndDayOfWeek, int EndWeek, int EndMonth, out bool error

                                       )
        {
            error = false;

            SqlParameter prmError = StoredProcedure.CreateOutputParam("@Error", SqlDbType.Bit);

            prmError.Direction = ParameterDirection.Output;

            using (StoredProcedure sp = new StoredProcedure("prcTimeZoneRule_update",
                                                            StoredProcedure.CreateInputParam("@RuleID", SqlDbType.Int, ruleID),
                                                            StoredProcedure.CreateInputParam("@WrittenName", SqlDbType.NVarChar, 60, WrittenName),
                                                            StoredProcedure.CreateInputParam("@OffsetDaylight", SqlDbType.Int, offsetmins),
                                                            StoredProcedure.CreateInputParam("@year_start", SqlDbType.Int, year_start),
                                                            StoredProcedure.CreateInputParam("@year_end", SqlDbType.Int, year_end),
                                                            StoredProcedure.CreateInputParam("@StartTimeOfDay", SqlDbType.Int, StartTimeOfDay),
                                                            StoredProcedure.CreateInputParam("@day_start", SqlDbType.Int, StartDayOfWeek),
                                                            StoredProcedure.CreateInputParam("@week_start", SqlDbType.Int, StartWeek),
                                                            StoredProcedure.CreateInputParam("@StartMonth", SqlDbType.Int, StartMonth),
                                                            StoredProcedure.CreateInputParam("@EndTimeOfDay", SqlDbType.Int, EndTimeOfDay),
                                                            StoredProcedure.CreateInputParam("@EndDayOfWeek", SqlDbType.Int, EndDayOfWeek),
                                                            StoredProcedure.CreateInputParam("@EndWeek", SqlDbType.Int, EndWeek),
                                                            StoredProcedure.CreateInputParam("@EndMonth", SqlDbType.Int, EndMonth),
                                                            prmError
                                                            )
                   )
            {
                sp.ExecuteNonQuery();
                error = (bool)prmError.Value;
            }
        }
Exemplo n.º 4
0
        }         // GetModule

        /// <summary>
        /// Create a new module.
        /// </summary>
        /// <returns>Module ID for the created module.</returns>
        /// <param name="courseID">Parent Course ID</param>
        /// <param name="name">name of the module</param>
        /// <param name="description">Description of the module</param>
        /// <param name="active">Active flag for the new module</param>
        /// <param name="createdByUserID">Currently logged on user creating the module</param>
        public int Create(int courseID, string name, string description, bool active, int createdByUserID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcModule_Create",
                                                            StoredProcedure.CreateInputParam("@courseID", SqlDbType.Int, courseID),
                                                            StoredProcedure.CreateInputParam("@name", SqlDbType.NVarChar, 100, name),
                                                            StoredProcedure.CreateInputParam("@description", SqlDbType.NVarChar, 1000, description),
                                                            StoredProcedure.CreateInputParam("@active", SqlDbType.Bit, active),
                                                            StoredProcedure.CreateInputParam("@userID", SqlDbType.Int, createdByUserID)
                                                            ))
            {
                SqlDataReader rdr = sp.ExecuteReader();
                int           intError;
                string        strMessage;
                rdr.Read();
                intError   = rdr.GetInt32(0);
                strMessage = rdr.GetString(1);
                rdr.Close();
                if (intError == 4)
                {
                    throw new BusinessServiceException(ResourceManager.GetString("prcModule_Create.4"));
                }
                else
                {
                    return(int.Parse(strMessage));
                }
            }
        } // Create
Exemplo n.º 5
0
        public int AddUserEvent(Event pro)
        {
            int intProfileID = 0;

            using (StoredProcedure spAddProfile = new StoredProcedure("prcEvent_AddUserEvent",
                                                                      StoredProcedure.CreateInputParam("@EventID", SqlDbType.Int, pro.EventID),
                                                                      StoredProcedure.CreateInputParam("@EventName", SqlDbType.NVarChar, pro.EventName),
                                                                      StoredProcedure.CreateInputParam("@OrganisationID", SqlDbType.Int, pro.OrganisationID),
                                                                      StoredProcedure.CreateInputParam("@ProfileID", SqlDbType.Int, pro.ProfileID),
                                                                      StoredProcedure.CreateInputParam("@DateStart", SqlDbType.DateTime, ((pro.DateStart == DateTime.Parse("1/1/1900")) ? (object)System.DBNull.Value : pro.DateStart)),
                                                                      StoredProcedure.CreateInputParam("@DateEnd", SqlDbType.DateTime, ((pro.DateEnd == DateTime.Parse("1/1/1900")) ? (object)System.DBNull.Value : pro.DateEnd)),
                                                                      StoredProcedure.CreateInputParam("@Points", SqlDbType.Float, ((pro.Points == 0.0 ? (object)System.DBNull.Value : pro.Points))),
                                                                      StoredProcedure.CreateInputParam("@EndOfPeriodAction", SqlDbType.Char, pro.EndOfPeriodAction),
                                                                      StoredProcedure.CreateInputParam("@EventProvider", SqlDbType.NVarChar, pro.EventProvider),
                                                                      StoredProcedure.CreateInputParam("@EventType", SqlDbType.Int, pro.EventType),
                                                                      StoredProcedure.CreateInputParam("@EventLocation", SqlDbType.NVarChar, pro.EventLocation),
                                                                      StoredProcedure.CreateInputParam("@EventItem", SqlDbType.NVarChar, pro.EventItem),
                                                                      StoredProcedure.CreateInputParam("@UserType", SqlDbType.NVarChar, pro.UserType),

                                                                      StoredProcedure.CreateInputParam("@UserId", SqlDbType.Int, pro.UserID)))
            {
                spAddProfile.Parameters.Add("@EventPeriodID", SqlDbType.Int);
                spAddProfile.Parameters["@EventPeriodID"].Direction = ParameterDirection.Output;
                spAddProfile.ExecuteNonQuery();
                intProfileID       = Int32.Parse(spAddProfile.Parameters["@EventID"].Value.ToString());
                this.EventPeriodID = Int32.Parse(spAddProfile.Parameters["@EventPeriodID"].Value.ToString());
                return(intProfileID);
            }
        }
Exemplo n.º 6
0
        public bool CheckFileAccepted(int FileID, int UserID)
        {
            //string connectionString = ConfigurationSettings.AppSettings["ConnectionString"] + "password="******"password"] + ";";
            //string strSQL = @"select * from tblUserEventFilesAccepted ";
            //strSQL = strSQL + @"where UserID = " + UserID + " ";
            //strSQL = strSQL + @"and FileID = " + FileID + " ";
            //strSQL = strSQL + @" and Accepted = 1";

            using (StoredProcedure spGetProfile = new StoredProcedure("prcEventFile_CheckFileAccepted",

                                                                      StoredProcedure.CreateInputParam("@FileID", SqlDbType.Int, FileID),
                                                                      StoredProcedure.CreateInputParam("@UserID", SqlDbType.Int, UserID)
                                                                      ))
            {
                DataTable dtCheckPolicy = spGetProfile.ExecuteTable();

                if (dtCheckPolicy.Rows.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// This report returns a table of users that have completed testing requrements or alternatly, thoes who have not.
 /// </summary>
 /// <remarks>
 /// Assumptions: If a user has access to a module then thay have to complete that module
 /// Notes:
 /// Author: Stephen Kennedy-Clark 19/02/2004
 /// Changes:
 /// </remarks>
 /// <returns>
 /// DataTable containg the completed users report data
 /// </returns>
 /// <param name="organisationID">Organisation to search if no units were specified</param>
 /// <param name="unitIDs">Comma seperated list of unit id's</param>
 /// <param name="courseID">Integer Course ID</param>
 /// <param name="completed">Boolean - Show Completed (true) or incomplete (false) users</param>
 /// <param name="effectiveDate">Nullable date at which the report is accurate</param>
 public DataTable GetCompletedUsersReport(int organisationID, string unitIDs, int courseID, DateTime effectiveDate, bool completed)
 {
     if (effectiveDate != DateTime.MinValue)
     {
         using (StoredProcedure sp = new StoredProcedure("prcReport_CompletedUsers",
                                                         StoredProcedure.CreateInputParam("@organisationID", SqlDbType.Int, organisationID),
                                                         StoredProcedure.CreateInputParam("@unitIDs", SqlDbType.VarChar, -1, unitIDs),
                                                         StoredProcedure.CreateInputParam("@courseID", SqlDbType.Int, courseID),
                                                         StoredProcedure.CreateInputParam("@effectiveDate", SqlDbType.DateTime, effectiveDate),
                                                         StoredProcedure.CreateInputParam("@completed", SqlDbType.Bit, completed)
                                                         ))
         {
             return(sp.ExecuteTable());
         }
     }
     else
     {
         using (StoredProcedure sp = new StoredProcedure("prcReport_CompletedUsers",
                                                         StoredProcedure.CreateInputParam("@organisationID", SqlDbType.Int, organisationID),
                                                         StoredProcedure.CreateInputParam("@unitIDs", SqlDbType.VarChar, -1, unitIDs),
                                                         StoredProcedure.CreateInputParam("@courseID", SqlDbType.Int, courseID),
                                                         StoredProcedure.CreateInputParam("@completed", SqlDbType.Bit, completed)
                                                         ))
         {
             return(sp.ExecuteTable());
         }
     }
 } //GetCompletedUsersReport
Exemplo n.º 8
0
        /// <summary>
        /// This method creates a new QuizAnswer audit entry that indicates a person has answered a question.
        /// </summary>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        /// Author: Li Zhang 17/10/2006
        /// Changes:
        /// </remarks>
        /// <param name="quizSessionID">The session id of the Quiz Session, unique GUID that identifies this toolbook quiz session</param>
        /// <param name="duration">The duration in seconds of the quiz as messured by toolbook</param>
        /// <param name="score">The score as mesured by toolbook</param>
        /// <param name="userID">The user who took the quiz</param>
        /// <param name="quizID">The quiz ID</param>
        /// <param name="passMark">The quiz pass mark</param>
        /// <param name="unitID">The user's unit ID</param>
        /// <param name="moduleID">The module ID</param>
        /// <param name="courseID">The course ID</param>
        /// <param name="oldCourseStatus">The old course ID</param>
        /// <param name="newQuizStatus">The new quiz status ID</param>
        /// <param name="newCourseStatus">The new course status ID</param>
        /// <param name="quizFrequency">The quiz frequency </param>
        public DataTable EndQuizSession_UpdateTables(string quizSessionID, int duration, int score, int userID, int quizID, int passMark, int unitID, int moduleID, int courseID, int oldCourseStatus, int newQuizStatus, int newCourseStatus, int quizFrequency, DateTime quizCompletionDate)
        {
            System.Data.SqlClient.SqlParameter paramQuizDate = StoredProcedure.CreateInputParam("@QuizCompletionDate", SqlDbType.DateTime);

            if (quizCompletionDate == DateTime.Parse("1/1/1900"))
            {
                paramQuizDate.Value = System.DBNull.Value;
            }
            else
            {
                paramQuizDate.Value = quizCompletionDate;
            }



            using (StoredProcedure sp = new StoredProcedure("prcQuizSession_UpdateEndQuizInfo",
                                                            StoredProcedure.CreateInputParam("@QuizSessionID", SqlDbType.VarChar, 50, quizSessionID),
                                                            StoredProcedure.CreateInputParam("@Duration", SqlDbType.Int, duration),
                                                            StoredProcedure.CreateInputParam("@Score", SqlDbType.Int, score),
                                                            StoredProcedure.CreateInputParam("@UserID", SqlDbType.Int, userID),
                                                            StoredProcedure.CreateInputParam("@quizID", SqlDbType.Int, quizID),
                                                            StoredProcedure.CreateInputParam("@PassMark", SqlDbType.Int, passMark),
                                                            StoredProcedure.CreateInputParam("@UnitID", SqlDbType.Int, unitID),
                                                            StoredProcedure.CreateInputParam("@ModuleID", SqlDbType.Int, moduleID),
                                                            StoredProcedure.CreateInputParam("@CourseID", SqlDbType.Int, courseID),
                                                            StoredProcedure.CreateInputParam("@OldCourseStatus", SqlDbType.Int, oldCourseStatus),
                                                            StoredProcedure.CreateInputParam("@NewQuizStatus", SqlDbType.Int, newQuizStatus),
                                                            StoredProcedure.CreateInputParam("@NewCourseStatus", SqlDbType.Int, newCourseStatus),
                                                            StoredProcedure.CreateInputParam("@QuizFrequency", SqlDbType.Int, quizFrequency),
                                                            paramQuizDate
                                                            ))
            {
                return(sp.ExecuteTable());
            }
        }
Exemplo n.º 9
0
 public DataTable GetOrganisationEvents(int OrganisationID)
 {
     using (StoredProcedure sp = new StoredProcedure("prcEvent_OrganisationEvents",
                                                     StoredProcedure.CreateInputParam("@OrganisationID", SqlDbType.Int, OrganisationID)))
     {
         return(sp.ExecuteTable());
     }
 }
Exemplo n.º 10
0
 public void ResetPolicyUnitAccess(int PolicyID)
 {
     using (StoredProcedure spResetPolicyUnitAccess = new StoredProcedure("prcPolicy_ResetUnitAccess",
                                                                          StoredProcedure.CreateInputParam("@PolicyID", SqlDbType.Int, PolicyID)))
     {
         spResetPolicyUnitAccess.ExecuteNonQuery();
     }
 }
Exemplo n.º 11
0
        }         //SessionIsUnique

        /// <summary>
        /// GetPagesVisited
        /// </summary>
        /// <returns>Returns a data table of pages that the user has visited in this toolbook</returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        ///  this function is to ensure that the lesson onload event only fires once
        ///  for each toolbook - and that no attempt is made (ie hitting the
        ///  back / forward button) to restart a lesson
        /// Author: Stephen Kennedy-Clark, 03/02/0/2004
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">String containg the session GUID</param>
        public DataTable GetPagesVisited(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcLessonPageAudit_GetPagesVisitedBySessionID",
                                                            StoredProcedure.CreateInputParam("@lessonSessionID", SqlDbType.VarChar, 50, sessionID)))
            {
                return(sp.ExecuteTable());
            }
        }         //GetPagesVisited
Exemplo n.º 12
0
        }         //BeforeLessonStart

        /// <summary>
        /// StartLesson - updates a prepared lesson, starts it if it has not already been started and return true, else return false
        /// </summary>
        /// <returns>Returns true if a session has not been strated before</returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        ///  this function is to ensure that the lesson onload event only fires once
        ///  for each toolbook - and that no attempt is made (ie hitting the
        ///  back / forward button) to restart a lesson
        /// Author: Stephen Kennedy-Clark, 03/02/0/2004
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">String containg the session GUID</param>
        public bool StartLesson(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcLessonSession_StartLesson",
                                                            StoredProcedure.CreateInputParam("@lessonSessionID", SqlDbType.VarChar, 50, sessionID)))
            {
                return(Convert.ToBoolean(sp.ExecuteScalar()));
            }
        }         //StartLesson
Exemplo n.º 13
0
        }         //StartLesson

        /// <summary>
        /// SessionIsUnique
        /// </summary>
        /// <returns>Returns true if a session has not been used before</returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        ///  this function is to ensure that the lesson onload event only fires once
        ///  for each toolbook - and that no attempt is made (ie hitting the
        ///  back / forward button) to restart a lesson
        /// Author: Stephen Kennedy-Clark, 03/02/0/2004
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">String containg the session GUID</param>
        public bool SessionIsUnique(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcLessonQuizSession_CheckSessionUnique",
                                                            StoredProcedure.CreateInputParam("@sessionID", SqlDbType.VarChar, 50, sessionID)))
            {
                return(Convert.ToBoolean(sp.ExecuteScalar()));
            }
        }         //SessionIsUnique
Exemplo n.º 14
0
        }         //GetUser

        /// <summary>
        /// prcQuiz_GetScore
        /// </summary>
        /// <returns>
        /// Returns the user score based on their session id
        /// </returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        /// Author: Peter Kneale, 24 / 2 / 05
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">String containg the session GUID</param>
        public int GetQuizScore(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcQuiz_GetScore",
                                                            StoredProcedure.CreateInputParam("@QuizSessionID", SqlDbType.VarChar, 50, sessionID)))
            {
                return((int)sp.ExecuteScalar());
            }
        } //GetUser
Exemplo n.º 15
0
 /// <summary>
 /// Gets a list of Courses.
 /// </summary>
 /// <returns>Returns a DataTable with the details of all courses.</returns>
 /// <remarks>
 /// Assumptions: None
 /// Notes:
 /// Author: Stephen K-Clark, 9/02/04
 /// Changes:
 /// </remarks>
 public DataTable GetCourseList(int organisationID)
 {
     using (StoredProcedure sp = new StoredProcedure("prcCourse_GetList",
                                                     StoredProcedure.CreateInputParam("@OrgID", SqlDbType.Int, 8000, organisationID)))
     {
         return(sp.ExecuteTable());
     }
 }         // GetSelectedCourses
Exemplo n.º 16
0
 /// <summary>
 /// Gets the datatable containing the report of the latest errors. This report
 /// shows the most recently occuring errors.
 /// </summary>
 /// <remarks>
 /// Assumptions:None
 /// Notes:
 /// Author: Peter Kneale, 05/02/2004
 /// Changes:
 /// </remarks>
 /// <returns>DataTable: Contains an error listing of the most recent errors</returns>
 public DataTable GetReport(int organisationID)
 {
     using (StoredProcedure sp = new StoredProcedure("prcErrorLog_GetReport",
                                                     StoredProcedure.CreateInputParam("@OrgID", SqlDbType.Int, 8000, organisationID)))
     {
         return(sp.ExecuteTable());
     }
 }         // GetReportService
Exemplo n.º 17
0
        }         //RecordPageVisited

        /// <summary>
        /// GetBookmark
        /// </summary>
        /// <returns>Returns the ToolBookPageID for the page in the current toolbook that a user has set</returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        /// Author: Stephen Kennedy-Clark, 03/02/0/2004
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">String containg the session GUID</param>
        public string GetBookmark(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcBookMark_GetBookMarkBySessionID",
                                                            StoredProcedure.CreateInputParam("@lessonSessionID", SqlDbType.VarChar, 50, sessionID)))
            {
                return((string)sp.ExecuteScalar());
            }
        }         //GetBookmark
Exemplo n.º 18
0
        }         //EndLessonSession

        /// <summary>
        /// GetUser
        /// </summary>
        /// <returns>
        /// Returns the user's first and last names concatenated with a space
        /// </returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        /// Author: Stephen Kennedy-Clark, 03/02/0/2004
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">String containg the session GUID</param>
        public string GetUser(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcUser_GetNameBySessionID",
                                                            StoredProcedure.CreateInputParam("@sessionID", SqlDbType.VarChar, 50, sessionID)))
            {
                return((string)sp.ExecuteScalar());
            }
        }         //GetUser
Exemplo n.º 19
0
        }         //GetQuizPassMark

        /// <summary>
        /// This method returns the number of questions in a particular quiz.
        /// </summary>
        /// <remarks>
        /// Assumptions:None
        /// Notes:
        /// Author: Peter Kneale, 05/02/2004
        /// Changes:
        /// </remarks>
        /// <param name="QuizID">QuizID of the Quiz that we wish to could the questions in.</param>
        /// <returns>The number of questions.</returns>
        public int GetQuizQuestionsCountByQuizID(int QuizID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcQuiz_CountQuestions",
                                                            StoredProcedure.CreateInputParam("@QuizID", SqlDbType.Int, QuizID)
                                                            ))
            {
                return(Convert.ToInt32(sp.ExecuteScalar()));
            }
        }               //GetQuizQuestionsCountByQuizID
Exemplo n.º 20
0
        }               //GetUserIDBySessionID

        /// <summary>
        /// This method returns a users Unit ID based on their UserID
        /// </summary>
        /// <remarks>
        /// Assumptions:None
        /// Notes:
        /// Author: Peter Kneale, 05/02/2004
        /// Changes:
        /// </remarks>
        /// <param name="UserID">UserID of desired user.</param>
        /// <returns>UnitID of the Unit that the user belongs to.</returns>
        public int GetUnitIDByUserID(int UserID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcUser_GetUnitIDByUserID",
                                                            StoredProcedure.CreateInputParam("@UserId", SqlDbType.Int, UserID)
                                                            ))
            {
                return(Convert.ToInt32(sp.ExecuteScalar()));
            }
        }               //GetUnitIDByUserID
Exemplo n.º 21
0
        }         //BeforeQuizStart

        /// <summary>
        /// BeforeQuizStart - Check if this is adaptive course
        /// </remarks>
        /// <param name="userID">The User attempting the Quiz.</param>
        /// <param name="moduleID">The module the User is attempting.</param>
        public DataTable CheckAdaptiveCourse(int moduleID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcUser_AdaptiveAccess",
                                                            StoredProcedure.CreateInputParam("@moduleID", SqlDbType.Int, moduleID)
                                                            ))
            {
                return(sp.ExecuteTable());
            }
        } //BeforeQuizStart
Exemplo n.º 22
0
 public string GetTypeFromID(int reportId)
 {
     using (StoredProcedure sp = new StoredProcedure("prcReport_GetTypeFromID",
                                                     StoredProcedure.CreateInputParam("@ReportId", SqlDbType.Int, reportId)
                                                     ))
     {
         return(sp.ExecuteScalar().ToString());
     }
 }
Exemplo n.º 23
0
 public Boolean RequiresDateFromDateTo(int reportId)
 {
     using (StoredProcedure sp = new StoredProcedure("prcRequiresDateFromDateTo",
                                                     StoredProcedure.CreateInputParam("@ReportId", SqlDbType.Int, reportId)
                                                     ))
     {
         return(Convert.ToBoolean(sp.ExecuteScalar()));
     }
 }
Exemplo n.º 24
0
 public void DeleteEbook(int courseID)
 {
     using (StoredProcedure sp = new StoredProcedure("prcCourse_EbookDelete",
                                                     StoredProcedure.CreateInputParam("@courseid", SqlDbType.Int, courseID)
                                                     ))
     {
         sp.ExecuteNonQuery();
     }
 }
Exemplo n.º 25
0
 public DataTable GetCCList(int scheduleId)
 {
     using (StoredProcedure sp = new StoredProcedure("prcGetCCList",
                                                     StoredProcedure.CreateInputParam("@ScheduleId", SqlDbType.Int, scheduleId)
                                                     ))
     {
         return(sp.ExecuteTable());
     }
 }
Exemplo n.º 26
0
        }         // GetCourse

        /// <summary>
        /// Gets the course ID given the session ID
        /// </summary>
        /// <returns>Returns the ID of the Course as an int, -1 if no session was found matching this session id</returns>
        /// <remarks>
        /// Assumptions: None
        /// Notes:
        /// Author: Stephen K-Clark, 9/02/04
        /// Changes:
        /// </remarks>
        /// <param name="sessionID">ID of the session to get the course id for</param>
        public int GetCourseBySessionID(SqlString sessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcCourse_GetOneBySessionID",
                                                            StoredProcedure.CreateInputParam("@sessionID", SqlDbType.VarChar, 50, sessionID)
                                                            ))
            {
                return(Convert.ToInt32(sp.ExecuteScalar()));
            }
        }         // GetCourse
Exemplo n.º 27
0
        } //BeforeQuizStart

        /// <summary>
        /// Starts a quiz session for a particular user attempting a particular quiz.
        /// </summary>
        /// <returns> A boolean value indicating whether the session started successfully or not.
        /// </returns>
        /// <remarks>
        /// Assumptions:None
        /// Notes:
        /// Author: Peter Kneale, 05/02/2004
        /// Changes:
        /// </remarks>
        /// <param name="QuizSessionID">User ID of the user starting the quiz.</param>
        public bool StartQuiz(string QuizSessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcQuizSession_StartQuiz",
                                                            StoredProcedure.CreateInputParam("@QuizSessionID", SqlDbType.VarChar, 50, QuizSessionID)
                                                            ))
            {
                return(Convert.ToBoolean(sp.ExecuteScalar()));
            }
        }         //StartQuiz
Exemplo n.º 28
0
        }         //GetQuizIDBySessionID

        /// <summary>
        /// This method returns a users User ID based on a current Sesion Id.
        /// </summary>
        /// <remarks>
        /// Assumptions:None
        /// Notes:
        /// Author: Peter Kneale, 05/02/2004
        /// Changes:
        /// </remarks>
        /// <param name="SessionID">The session ID from which to get the User ID</param>
        /// <returns>UserID of the user matching the sessionid </returns>
        public int GetUserIDBySessionID(string SessionID)
        {
            using (StoredProcedure sp = new StoredProcedure("prcUser_GetUserIDBySessionID",
                                                            StoredProcedure.CreateInputParam("@SessionID", SqlDbType.VarChar, 50, SessionID)
                                                            ))
            {
                return(Convert.ToInt32(sp.ExecuteScalar()));
            }
        }               //GetUserIDBySessionID
Exemplo n.º 29
0
 public void DeleteReport(int scheduleId)
 {
     using (StoredProcedure sp = new StoredProcedure("prcDeleteReport",
                                                     StoredProcedure.CreateInputParam("@ScheduleId", SqlDbType.Int, scheduleId)
                                                     ))
     {
         sp.ExecuteNonQuery();
     }
 }
Exemplo n.º 30
0
 /// <summary>
 /// Gets a list of Courses and their details available to a user
 /// </summary>
 /// <returns>Returns a DataTable with the details of Accessable Courses in the SALT database.</returns>
 /// <remarks>
 /// Assumptions: None
 /// Notes:
 /// Author: Stephen Kennedy-Clark
 /// Date: 09/02/2004
 /// Changes:
 /// </remarks>
 /// <param name="userID"> ID of the user for which to get the details</param>
 public DataTable GetCourseListAccessableToUser(int userID)
 {
     using (StoredProcedure sp = new StoredProcedure("prcCourse_GetListByUser",
                                                     StoredProcedure.CreateInputParam("@userID", SqlDbType.Int, userID)
                                                     ))
     {
         return(sp.ExecuteTable());
     }
 }// GetCourseListAccessableToUser