128 lines
4.5 KiB
C#
128 lines
4.5 KiB
C#
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
using HRM.BO;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
#region SystemInformationDA
|
|||
|
|
|||
|
public class SystemInformationDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private SystemInformationDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, SystemInformation item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE SystemInformation SET name=%s, corporateAddress=%s, factoryAddress=%s, TELEPHONE=%s,email=%s, webAddress=%s, systemStartDate=%d, taxYearEndDate=%d, nextPayProcessDate=%d, maxYearOfService=%n, pFContriStaff=%n, pFContriCompany=%n, pFInterest=%n, PARAMID=%n, oTFilePath=%s, pFYearEndDate=%d" +
|
|||
|
" WHERE Code=%s", item.name, item.corporateAddress, item.factoryAddress, item.TelephoneNo, item.email,
|
|||
|
item.webAddress, item.systemStartDate, item.TaxYearEndDate, item.NextPayProcessDate,
|
|||
|
item.maxYearOfService, item.pFContriStaff, item.pFContriCompany, item.pFInterest, item.TaxParamID,
|
|||
|
item.oTFilePath, item.PFYearEndDate, item.Code);
|
|||
|
}
|
|||
|
|
|||
|
internal static void Save(TransactionContext tc, HardPasswordSetup item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Delete From HardPasswordSetup");
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO HardPasswordSetup(MaxLength, MinLength, ContainUppercase, ContainLowercase, ContainSpecialCharacter, ContainNumber, PasswordExpireNotificationDays, PasswordExpireDays,ContainLetter,UserPasswordSame) Values(%n,%n,%b,%b,%b,%b,%n,%n,%b,%b)",
|
|||
|
item.MaxLength, item.MinLength, item.ContainUppercase, item.ContainLowercase,
|
|||
|
item.ContainSpecialCharacter, item.ContainNumber, item.PasswordExpireNotificationDays,
|
|||
|
item.PasswordExpireDays, item.ContainLetter, item.UserPasswordSame);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static DataTable GetPasswordSetup(TransactionContext tc)
|
|||
|
{
|
|||
|
DataTable oPasswordSetup = null;
|
|||
|
try
|
|||
|
{
|
|||
|
string sSQL = SQLParser.MakeSQL(@"SELECT * from HardPasswordSetup");
|
|||
|
DataSet ods = tc.ExecuteDataSet(sSQL);
|
|||
|
if (ods != null)
|
|||
|
oPasswordSetup = ods.Tables[0];
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw new Exception(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return oPasswordSetup;
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetHardPasswordSetup(TransactionContext tc)
|
|||
|
{
|
|||
|
string sSQL = SQLParser.MakeSQL(@"SELECT * from HardPasswordSetup");
|
|||
|
return tc.ExecuteReader(sSQL);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM SystemInformation");
|
|||
|
}
|
|||
|
|
|||
|
internal static void UpdateTaxParamId(TransactionContext tc, int taxParameterID, int payrollTypeID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Update PayrollType set TaxParamID=%n where PayrollTypeID=%n", taxParameterID,
|
|||
|
payrollTypeID);
|
|||
|
}
|
|||
|
|
|||
|
public static void DoTaxYearEnd(TransactionContext tc, DateTime yearEndDate, int payrollTypeID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Update PayrollType set TaxParamID=null, TaxYearEndDate=%d where PayrollTypeID=%n",
|
|||
|
yearEndDate, payrollTypeID);
|
|||
|
}
|
|||
|
|
|||
|
public static DateTime GetServerDate(TransactionContext tc, string s)
|
|||
|
{
|
|||
|
DateTime ob;
|
|||
|
if (s == "System.Data.SqlClient.SqlConnection")
|
|||
|
{
|
|||
|
ob = Convert.ToDateTime(tc.ExecuteScalar("SELECT CONVERT (date, SYSDATETIME()) Date "));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ob = Convert.ToDateTime(tc.ExecuteScalar("SELECT CONVERT (date, SYSDATETIME()) Date"));
|
|||
|
}
|
|||
|
|
|||
|
return ob;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM SystemInformation WHERE =%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
internal static void BackupDatabase(TransactionContext tc, string sFilePath)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("BACKUP DATABASE SGS TO DISK=%s", sFilePath);
|
|||
|
}
|
|||
|
|
|||
|
internal static DataSet GetSystemInfo(TransactionContext tc)
|
|||
|
{
|
|||
|
string sSQL = SQLParser.MakeSQL(@"SELECT NAME, CORPORATEADDRESS FROM SYSTEMINFORMATION");
|
|||
|
return tc.ExecuteDataSet(sSQL);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|