60 lines
2.1 KiB
C#
60 lines
2.1 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
|
|
{
|
|
public class CourseProgressDA
|
|
{
|
|
#region Constructor
|
|
private CourseProgressDA()
|
|
{
|
|
}
|
|
#endregion
|
|
|
|
#region Insert function
|
|
internal static void Insert(TransactionContext tc, CourseProgres item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO LMS_CourseProgress(CourseProgressID,userID,CourseID,EnrollmentID,CompletionPercentage,StartDate,EndDate,IsCourseComplete,LastActivityDate)" +
|
|
" VALUES(%n,%n,%n,%n,%n,%D,%D,%b,%D)", item.ID,item.UserID,item.CourseID, item.EnrollmentID, item.CompletionPercentage, item.StartDate,
|
|
DataReader.GetNullValue(item.EndDate), item.IsCourseComplete, item.LastActivityDate);
|
|
}
|
|
#endregion
|
|
|
|
#region Update
|
|
internal static void Update(TransactionContext tc, CourseProgres item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE LMS_CourseProgress set CompletionPercentage = %n, EndDate = %D , IsCourseComplete = %b, LastActivityDate = %D WHERE CourseProgressID=%n",
|
|
item.CompletionPercentage,item.EndDate, item.IsCourseComplete, item.LastActivityDate, item.ID);
|
|
}
|
|
internal static void UpdateCompletionRate(TransactionContext tc, CourseProgres item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE LMS_CourseProgress set CompletionPercentage = %n, IsCourseComplete = %b WHERE CourseProgressID=%n", item.CompletionPercentage,item.IsCourseComplete, item.ID);
|
|
}
|
|
#endregion
|
|
|
|
#region Get Function
|
|
internal static IDataReader Get(TransactionContext tc, int ID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM LMS_CourseProgress Where CourseProgressID=%n ", ID);
|
|
}
|
|
internal static IDataReader GetAll(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM LMS_CourseProgress");
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, int courseID, int enrollmentID, int UserID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM LMS_CourseProgress Where CourseID=%n and EnrollmentID=%n and UserID = %n", courseID, enrollmentID, UserID);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|