114 lines
4.1 KiB
C#
114 lines
4.1 KiB
C#
using System;
|
|
using Payroll.BO;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Ease.CoreV35.Model;
|
|
using System.Data.SqlClient;
|
|
using Ease.CoreV35.DataAccess;
|
|
using System.Collections.Generic;
|
|
using Ease.CoreV35.DataAccess.SQL;
|
|
|
|
|
|
namespace Payroll.Service
|
|
{
|
|
#region SystemInformationDA
|
|
|
|
internal 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.Integer, item.oTFilePath, item.PFYearEndDate, item.Code);
|
|
|
|
|
|
|
|
}
|
|
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 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 IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SystemInformation");
|
|
|
|
}
|
|
|
|
internal static void UpdateTaxParamId(TransactionContext tc, ID taxParameterID, ID PayrollTypeID)
|
|
{
|
|
tc.ExecuteNonQuery("Update PayrollType set TaxParamID=%n where PayrollTypeID=%n",taxParameterID.Integer, PayrollTypeID.Integer);
|
|
}
|
|
|
|
internal 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 CAST(GetDate() AS smalldatetime)"));
|
|
}
|
|
else
|
|
{
|
|
ob = Convert.ToDateTime(tc.ExecuteScalar("Select SYSDATE from DUAL"));
|
|
}
|
|
return ob;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, ID 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);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|