58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
|
|
using Ease.Core.DataAccess;
|
|||
|
|
using HRM.BO;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace HRM.DA
|
|||
|
|
{
|
|||
|
|
internal class LessonProgressDA
|
|||
|
|
{
|
|||
|
|
#region Constructor
|
|||
|
|
private LessonProgressDA()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Insert function
|
|||
|
|
internal static void Insert(TransactionContext tc, LessonProgress item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"INSERT INTO LMS_LessonProgress(LessonProgressID,UserID,CourseProgressID,LessonID,LessonContentID,IsLessonComplete,CompletionPercentage,StartDate,CompleteDate,TimeSpent,LastAccessed,RetryCount)" +
|
|||
|
|
" VALUES(%n,%n,%n,%n,%n,%b,%n,%D,%D,%s,%D,%n)", item.ID, item.UserID, item.CourseProgressID, item.LessonID,item.LessonContentID, item.IsLessonComplete, item.CompletionPercentage,
|
|||
|
|
item.StartDate, item.CompleteDate, item.TimeSpent, item.LastAccessed, item.RetryCount);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Update
|
|||
|
|
internal static void Update(TransactionContext tc, LessonProgress item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE LMS_LessonProgress set IsLessonComplete = %b, CompletionPercentage = %n , CompleteDate = %D, TimeSpent = %s, LastAccessed = %D," +
|
|||
|
|
" RetryCount = %n WHERE LessonProgressID=%n and CourseProgressID = %n",
|
|||
|
|
item.IsLessonComplete, item.CompletionPercentage, item.CompleteDate, item.TimeSpent,item.LastAccessed,item.RetryCount, item.ID, item.CourseProgressID);
|
|||
|
|
}
|
|||
|
|
internal static void UpdateCompletionRate(TransactionContext tc, CourseProgres item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE LMS_LessonProgress set CompletionPercentage = %n WHERE LessonProgressID=%n", item.CompletionPercentage, item.ID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Get Function
|
|||
|
|
internal static IDataReader GetAll(TransactionContext tc)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonProgress");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
internal static IDataReader GetByProgressID(TransactionContext tc, int CourseprogressID)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonProgress Where CourseProgressID=%n", CourseprogressID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|