77 lines
2.3 KiB
C#
77 lines
2.3 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Data.SqlClient;
|
|
using System.Collections.Generic;
|
|
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class BookmarkDA
|
|
{
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, Bookmark item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO Bookmark(BookmarkID,UserID, EmployeeId, MenuCode, Description, Link, CreatedBy, CreatedDate)" +
|
|
" VALUES(%n, %n, %n, %s, %s, %s, %n, %D)", item.ID, item.UserID,
|
|
item.EmployeeId, item.MenuCode, item.Description, item.Link, item.CreatedBy, item.CreatedDate);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, Bookmark item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE Bookmark SET UserID=%n, EmployeeId=%n, Description=%s, MenuCode=%s, Link=%s, ModifiedBy=%n, ModifiedDate=%d" +
|
|
"WHERE BookmarkID=%n", item.UserID, item.EmployeeId, item.Description, item.MenuCode, item.Link, item.ModifiedBy,
|
|
item.ModifiedDate, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int UserID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Bookmark Where UserID=%n", UserID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM Bookmark Where BookmarkID=%n", nID);
|
|
}
|
|
|
|
internal static void Delete(TransactionContext tc, int userid, string menukey)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM Bookmark Where UserID=%n AND MenuCode=%s", userid, menukey);
|
|
}
|
|
|
|
public static bool IsExist(TransactionContext tc, int userid, string menukey)
|
|
{
|
|
bool Exist = false;
|
|
Object obj =
|
|
tc.ExecuteScalar(
|
|
"Select Count(*) FROM Bookmark WHERE UserID=%n AND MenuCode=%s",
|
|
userid, menukey);
|
|
if (obj == DBNull.Value) return false;
|
|
Exist = Convert.ToInt32(obj) > 0 ? true : false;
|
|
return Exist;
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|
|
} |