73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
|
|
|
|||
|
|
using Ease.Core.DataAccess;
|
|||
|
|
using HRM.BO;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
|
|||
|
|
namespace HRM.DA
|
|||
|
|
{
|
|||
|
|
public class EmployeeNotificationDA
|
|||
|
|
{
|
|||
|
|
public EmployeeNotificationDA()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static int GetNewID(TransactionContext tc)
|
|||
|
|
{
|
|||
|
|
return tc.GenerateID("EmployeeNotification", "ID");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static void Insert(TransactionContext tc, EmployeeNotification item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"INSERT INTO EmployeeNotification( EmployeeID, Header, Description, Link, CreatedDate, CreatedBy, ReferenceID, IsRead, ReadDate, ReadBy) " +
|
|||
|
|
"VALUES( %n, %s, %s, %s, %D, %n, %n, %n, %D, %n)",
|
|||
|
|
|
|||
|
|
item.EmployeeID,
|
|||
|
|
item.Header,
|
|||
|
|
item.Description,
|
|||
|
|
item.Link,
|
|||
|
|
item.CreatedDate,
|
|||
|
|
item.CreatedBy,
|
|||
|
|
item.ReferenceID,
|
|||
|
|
item.IsRead,
|
|||
|
|
item.ReadDate,
|
|||
|
|
item.ReadBy);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static void ReadUpdate(TransactionContext tc, EmployeeNotification item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE EmployeeNotification SET IsRead=%n, ReadDate=%D, ReadBy=%n WHERE ID=%n",
|
|||
|
|
item.IsRead,
|
|||
|
|
item.ReadDate,
|
|||
|
|
item.ReadBy,
|
|||
|
|
item.ID);
|
|||
|
|
}
|
|||
|
|
public static void MakeRead(TransactionContext tc, int employeeID, List<int> ids)
|
|||
|
|
{
|
|||
|
|
if (ids == null || ids.Count == 0)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
string idList = string.Join(",", ids);
|
|||
|
|
|
|||
|
|
tc.ExecuteNonQuery(
|
|||
|
|
"UPDATE EmployeeNotification " +
|
|||
|
|
"SET IsRead = 1, ReadDate = %D, ReadBy = %n " +
|
|||
|
|
"WHERE EmployeeID = %n AND ID IN (" + idList + ")",
|
|||
|
|
DateTime.Now,
|
|||
|
|
employeeID,
|
|||
|
|
employeeID
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
public static IDataReader Get(TransactionContext tc, int employeeID)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteReader(
|
|||
|
|
"SELECT * FROM EmployeeNotification WHERE EmployeeID=%n ORDER BY CreatedDate DESC, ID DESC",
|
|||
|
|
employeeID);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|