73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using Ease.Core.Model;
|
|||
|
using Ease.Core.Utility;
|
|||
|
using HRM.BO;
|
|||
|
using HRM.BO.SearchTools;
|
|||
|
using HRM.DA.DA.SearchTools;
|
|||
|
|
|||
|
namespace HRM.DA.Service.SearchTools
|
|||
|
{
|
|||
|
public class QTSearchColumnService : ServiceTemplate, IQTSearchColumnService
|
|||
|
{
|
|||
|
public QTSearchColumnService()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
private void MapObject(QTSearchColumn item, DataReader dataReader)
|
|||
|
{
|
|||
|
base.SetObjectID(item, dataReader.GetInt32("QTSearchColumnID").Value);
|
|||
|
item.QueryToolID = dataReader.GetInt32("QueryToolID").Value;
|
|||
|
item.ColumnID = dataReader.GetInt32("ColumnID").Value;
|
|||
|
item.Caption = dataReader.GetString("Caption");
|
|||
|
|
|||
|
this.SetObjectState(item, Ease.Core.ObjectState.Saved);
|
|||
|
}
|
|||
|
|
|||
|
protected override T CreateObject<T>(DataReader dataReader)
|
|||
|
{
|
|||
|
QTSearchColumn item = new QTSearchColumn();
|
|||
|
MapObject(item, dataReader);
|
|||
|
return item as T;
|
|||
|
}
|
|||
|
|
|||
|
protected QTSearchColumn CreateObject(DataReader dataReader)
|
|||
|
{
|
|||
|
QTSearchColumn item = new QTSearchColumn();
|
|||
|
MapObject(item, dataReader);
|
|||
|
return item;
|
|||
|
}
|
|||
|
|
|||
|
public void SaveQtSearchColumn(QTSearchColumn item)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
if (item.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("QTSearchColumn", "QTSearchColumnID");
|
|||
|
base.SetObjectID(item, id);
|
|||
|
QTSearchColumnDA.Insert(tc, item);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QTSearchColumnDA.Update(tc, item);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|