150 lines
4.4 KiB
C#
150 lines
4.4 KiB
C#
using System;
|
|
using Ease.Core.Model;
|
|
using Ease.Core.DataAccess;
|
|
using Ease.Core.Utility;
|
|
using System.Collections.Generic;
|
|
using HRM.BO;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region SystemParameterSetup Service
|
|
|
|
public class SystemParameterSetupService : ServiceTemplate, ISystemParameterSetupService
|
|
{
|
|
public SystemParameterSetupService()
|
|
{
|
|
}
|
|
|
|
private void MapObject(SystemParameterSetup oSystemParameterSetup, DataReader oReader)
|
|
{
|
|
base.SetObjectID(oSystemParameterSetup, (oReader.GetInt32("BADLOGINATTEMPTID").Value));
|
|
|
|
oSystemParameterSetup.BadloginAttempt = oReader.GetInt32("BADLOGINATTEMPT").Value;
|
|
|
|
oSystemParameterSetup.SystemIdealTime = oReader.GetInt32("SYSTEMIDEALTIME").Value;
|
|
this.SetObjectState(oSystemParameterSetup, Ease.Core.ObjectState.Saved);
|
|
}
|
|
|
|
protected override T CreateObject<T>(DataReader oReader)
|
|
{
|
|
SystemParameterSetup oSystemParameterSetup = new SystemParameterSetup();
|
|
MapObject(oSystemParameterSetup, oReader);
|
|
return oSystemParameterSetup as T;
|
|
}
|
|
|
|
protected SystemParameterSetup CreateObject(DataReader oReader)
|
|
{
|
|
SystemParameterSetup oSystemParameterSetup = new SystemParameterSetup();
|
|
MapObject(oSystemParameterSetup, oReader);
|
|
return oSystemParameterSetup;
|
|
}
|
|
|
|
#region Service implementation
|
|
|
|
public int Save(SystemParameterSetup oSysPrmSetup)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin(true);
|
|
|
|
if (oSysPrmSetup.IsNew)
|
|
{
|
|
int id = tc.GenerateID("SYSTEMPARAMETERSETUP", "BADLOGINATTEMPTID");
|
|
base.SetObjectID(oSysPrmSetup, (id));
|
|
SystemParameterSetupDA.Insert(tc, oSysPrmSetup);
|
|
}
|
|
else
|
|
{
|
|
SystemParameterSetupDA.Update(tc, oSysPrmSetup);
|
|
}
|
|
|
|
tc.End();
|
|
return oSysPrmSetup.ID;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
public SystemParameterSetup Get()
|
|
{
|
|
SystemParameterSetup oSystemParameterSetup = new SystemParameterSetup();
|
|
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
DataReader oreader = new DataReader(SystemParameterSetupDA.Get(tc));
|
|
if (oreader.Read())
|
|
{
|
|
oSystemParameterSetup = this.CreateObject<SystemParameterSetup>(oreader);
|
|
}
|
|
|
|
oreader.Close();
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
|
|
return oSystemParameterSetup;
|
|
}
|
|
|
|
public void Get(out SystemParameterSetup sysParamSetup, out HardPasswordSetup hardPasswordRule)
|
|
{
|
|
TransactionContext tc = null;
|
|
try
|
|
{
|
|
tc = TransactionContext.Begin();
|
|
sysParamSetup = new SystemParameterSetup();
|
|
SystemInformationService sysInfo = new SystemInformationService();
|
|
|
|
DataReader oreader = new DataReader(SystemParameterSetupDA.Get(tc));
|
|
if (oreader.Read())
|
|
sysParamSetup = this.CreateObject<SystemParameterSetup>(oreader);
|
|
|
|
oreader.Close();
|
|
|
|
sysInfo.GetHardPasswordSetup(tc, out hardPasswordRule);
|
|
|
|
tc.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
#region Handle Exception
|
|
|
|
if (tc != null)
|
|
tc.HandleError();
|
|
ExceptionLog.Write(e);
|
|
throw new ServiceException(e.Message, e);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
//For excel Upload
|
|
}
|
|
|
|
#endregion
|
|
} |