105 lines
3.6 KiB
C#
105 lines
3.6 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 LessonContentDA
|
|||
|
|
{
|
|||
|
|
#region Constructor
|
|||
|
|
private LessonContentDA()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Insert function
|
|||
|
|
internal static void Insert(TransactionContext tc, LessonContent item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"INSERT INTO LMS_LessonContent(LessonContentID,LessonID,ContentTitle,ContentType,Description,ContentUrl,Duration,IsMendatory," +
|
|||
|
|
"Status,AccessLevel,ContentSource,AccessCount,CreatedBy,CreationDate)" +
|
|||
|
|
" VALUES(%n,%n,%s,%n,%s,%s,%s,%b,%n,%n,%n,%n,%n,%D)", item.ID, item.LessonID, item.ContentTitle, item.ContentType, item.Description,
|
|||
|
|
item.ContentUrl, item.Duration,item.IsMendatory,item.Status, item.AccessLevel, item.ContentSource,item.AccessCount,
|
|||
|
|
item.CreatedBy, item.CreatedDate);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Update function
|
|||
|
|
internal static void Update(TransactionContext tc, LessonContent item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE LMS_LessonContent set ContentTitle=%s,ContentType=%n,Description=%s,ContentUrl=%s,Duration=%s,IsMendatory=%b,AccessLevel=%n," +
|
|||
|
|
"ContentSource=%n,ModifiedBy=%n,ModifiedDate=%D " +
|
|||
|
|
" WHERE LessonContentID=%n", item.ContentTitle, item.ContentType, item.Description, item.ContentUrl, item.Duration, item.IsMendatory,
|
|||
|
|
item.AccessLevel,item.ContentSource, item.ModifiedBy, item.ModifiedDate, item.ID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Update Status
|
|||
|
|
internal static void UpdateStatus(TransactionContext tc, LessonContent item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE LMS_LessonContent set Status=%n ,ModifiedBy=%n,ModifiedDate=%D " +
|
|||
|
|
" WHERE LessonContentID=%n", item.Status, item.ModifiedBy, item.ModifiedDate, item.ID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Update
|
|||
|
|
internal static void UpdateAccessCount(TransactionContext tc, int LessonContentID)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE LMS_LessonContent set AccessCount=(AccessCount+1) WHERE LessonContentID=%n", LessonContentID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Delete function
|
|||
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery("DELETE FROM LMS_LessonContent Where LessonContentID=%n", nID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Get Function
|
|||
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent Where LessonContentID=%n", nID);
|
|||
|
|
}
|
|||
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|||
|
|
{
|
|||
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent where Status=%n order by ContentTitle", status);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent order by ContentTitle");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status, int lessonID)
|
|||
|
|
{
|
|||
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent where Status=%n and LessonID=%n order by ContentTitle", lessonID, status);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent where LessonID=%n order by ContentTitle", lessonID);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
internal static IDataReader GetAll(TransactionContext tc)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent order by ContentTitle");
|
|||
|
|
}
|
|||
|
|
internal static IDataReader GetByLessonID(TransactionContext tc, int parentTypeID)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader("SELECT * FROM LMS_LessonContent where lessonID=%n order by LessonContentID", parentTypeID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|