98 lines
3.4 KiB
C#
98 lines
3.4 KiB
C#
using System;
|
|
using System.Data;
|
|
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region SchedularSetupDA
|
|
|
|
internal class SchedularSetupDA
|
|
{
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, SchedularSetup item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"
|
|
INSERT INTO SchedularSetup(TITLE, TYPE, STARTAT, STATUS, MAILBODY, MAILSUBJECT, ReportFormat)
|
|
VALUES(%s, %n, %D, %n, %u, %s, %n, %s)", item.Title, item.Type, item.StartAt, item.Status, item.ReportFormat);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, SchedularSetup item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"
|
|
UPDATE SCHEDULERSETUP
|
|
SET TITLE = %s,
|
|
TYPE = %n,
|
|
STARTAT = %D,
|
|
STATUS = %n,
|
|
MAILBODY = %u,
|
|
MAILSUBJECT = %s,
|
|
ReportFormat = %n,
|
|
LastExecuteDateTime = %D
|
|
WHERE SCHEDULERSETUPID = %n",
|
|
item.Title, item.Type, DataReader.GetNullValue(item.StartAt), item.Status, item.MailBody, item.MailSubject, item.ReportFormat, item.LastExecuteDateTime,
|
|
item.ID);
|
|
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void UpdateStatus(TransactionContext tc, int setupID, EnumCardStatus status)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE SCHEDULERSETUP SET STATUS=%n WHERE SCHEDULERSETUPID=%n", status, setupID);
|
|
}
|
|
//
|
|
internal static void UpdateStatusAndTime(TransactionContext tc, int setupID, EnumCardStatus status, DateTime updateTime)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE SCHEDULERSETUP SET STATUS=%n, LastExecuteDateTime=%D WHERE SCHEDULERSETUPID=%n", status, updateTime, setupID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SCHEDULERSETUP WHERE SCHEDULERSETUPID=%n", id);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status, EnumSchedularType Type, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return tc.ExecuteReader(@"SELECT * FROM SCHEDULERSETUP WHERE STATUS = %n
|
|
AND TYPE = %n AND STARTAT BETWEEN %d AND %d", status, Type, fromDate, toDate);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SCHEDULERSETUP WHERE STATUS=%n", (int)status);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SCHEDULERSETUP");
|
|
}
|
|
|
|
internal static int GetMailNotificationHistoryMaxId(TransactionContext tc)
|
|
{
|
|
object tempObj = tc.ExecuteScalar("SELECT ISNULL(MAX(MailNotificationHistoryID) + 1, 1) FROM MailNotificationHistory");
|
|
return tempObj != null ? Convert.ToInt32(tempObj) : 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM SCHEDULERSETUP WHERE SCHEDULERSETUPID=%n", id);
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
} |