136 lines
5.4 KiB
C#
136 lines
5.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text;
|
|
using Ease.Core.DataAccess;
|
|
using HRM.BO.SearchTools;
|
|
|
|
namespace HRM.DA.DA.SearchTools
|
|
{
|
|
internal class QueryToolDA
|
|
{
|
|
public QueryToolDA()
|
|
{
|
|
}
|
|
|
|
public static int GetNewID(TransactionContext tc, string tableName, string columnName)
|
|
{
|
|
return tc.GenerateID(tableName, columnName);
|
|
}
|
|
|
|
// QueryTool
|
|
internal static void Insert(TransactionContext tc, QueryTool item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO QueryTool (QueryToolID, SearchString, Name, Description, SQL, QTModuleType)
|
|
VALUES(%n, %s, %s, %s, %s, %n)", item.ID, item.SearchString, item.Name, item.Description, item.SQL,
|
|
item.QTModuleType);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void Update(TransactionContext tc, QueryTool item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"UPDATE QueryTool
|
|
SET SearchString = %s,
|
|
Name = %s,
|
|
Description = %s,
|
|
SQL = %s,
|
|
QTModuleType = %n
|
|
where QueryToolID = %n", item.SearchString, item.Name, item.Description, item.SQL, item.QTModuleType,
|
|
item.ID);
|
|
}
|
|
|
|
internal static IDataReader GetAllQueryTool(TransactionContext tc)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT * FROM QueryTool");
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static IDataReader GetQTColumns(TransactionContext tc, int queryToolId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT * FROM QTColumn where QueryToolID=%n", queryToolId);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static IDataReader GetQTSearchColumn(TransactionContext tc, int queryToolId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT * FROM QTSearchColumn where QueryToolID=%n", queryToolId);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
internal static IDataReader GetQTAuthorization(TransactionContext tc, int queryToolId)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"SELECT * FROM QTAuthorization where QueryToolID=%n", queryToolId);
|
|
return tc.ExecuteReader(sql);
|
|
}
|
|
|
|
// QTColumn
|
|
internal static void Insert(TransactionContext tc, QTColumn item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO QTColumn (QTColumnID, QueryToolID, ColumnID, Alignment, Aggregate, Format, Caption)
|
|
VALUES (%n, %n, %n, %n, %s, %s, %s)", item.ID, item.QueryToolID, item.ColumnID, item.Alignment,
|
|
item.Aggregate, item.Format, item.Caption);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void Update(TransactionContext tc, QTColumn item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"UPDATE dbo.QTColumn
|
|
SET QueryToolID = %n,
|
|
ColumnID = %n,
|
|
Alignment = %n,
|
|
Aggregate = %s,
|
|
Format = %s,
|
|
Caption = %s
|
|
WHERE QTColumnID = %n", item.QueryToolID, item.ColumnID, item.Alignment,
|
|
item.Aggregate, item.Format, item.Caption, item.ID);
|
|
}
|
|
|
|
// QTSearchColumn
|
|
internal static void Insert(TransactionContext tc, QTSearchColumn item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO dbo.QTSearchColumn (QTSearchColumnID, QueryToolID, ColumnID, Caption)
|
|
VALUES (%n, %n, %n, %s)", item.ID, item.QueryToolID, item.ColumnID, item.Caption);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void Update(TransactionContext tc, QTSearchColumn item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"UPDATE dbo.QTSearchColumn
|
|
SET QueryToolID = %n,
|
|
ColumnID = %n,
|
|
Caption = %s
|
|
WHERE QTSearchColumnID = %n)", item.QueryToolID, item.ColumnID, item.Caption, item.ID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
// QTAuthorization
|
|
internal static void Insert(TransactionContext tc, QTAuthorization item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
@"INSERT INTO dbo.QTAuthorization (QTAuthorizationID, QueryToolID, AuthorizeDate, Count, EmployeeID)
|
|
VALUES (%n, %n, %d, %n, %n)", item.ID, item.QueryToolID, item.AuthorizeDate, item.Count,
|
|
item.EmployeeID);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
internal static void Update(TransactionContext tc, QTAuthorization item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"UPDATE dbo.QTAuthorization
|
|
SET QueryToolID = %n,
|
|
AuthorizeDate = %d,
|
|
Count = %n,
|
|
EmployeeID = %n
|
|
WHERE QTAuthorizationID = %n", item.QueryToolID, item.AuthorizeDate, item.Count,
|
|
item.EmployeeID, item.ID);
|
|
}
|
|
|
|
internal static void DeleteChildData(TransactionContext tc, int id, string TableName)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"Delete from " + TableName + " where QueryToolID=%n", id);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
}
|
|
} |