74 lines
2.5 KiB
C#
74 lines
2.5 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
|
|
{
|
|
internal class GlobalFunctionDA
|
|
{
|
|
internal static DateTime GetOperationDate(TransactionContext tc)
|
|
{
|
|
DateTime opDate = DateTime.MinValue;
|
|
SqlParameter[] p = new SqlParameter[1];
|
|
p[0] = new SqlParameter("@OperationDate", SqlDbType.DateTime);
|
|
p[0].Direction = ParameterDirection.Output;
|
|
p[0].Value = DateTime.MinValue;
|
|
|
|
tc.ExecuteNonQuery(CommandType.StoredProcedure, "[dbo].[GetOperationDate]", p);
|
|
|
|
if (p[0].Value != null && p[0].Value != DBNull.Value)
|
|
opDate = Convert.ToDateTime(p[0].Value);
|
|
|
|
return opDate;
|
|
}
|
|
|
|
internal static DataSet GetSalarySummary(TransactionContext tc, DateTime fromDate, DateTime toDate)
|
|
{
|
|
DateTime opDate = DateTime.MinValue;
|
|
SqlParameter[] p = new SqlParameter[2];
|
|
p[0] = new SqlParameter("@SalaryMonth", SqlDbType.DateTime);
|
|
p[0].Direction = ParameterDirection.Input;
|
|
p[0].Value = GlobalExtensions.FirstDateOfMonth(fromDate);
|
|
p[1] = new SqlParameter("@SalaryMonthTO", SqlDbType.DateTime);
|
|
p[1].Direction = ParameterDirection.Input;
|
|
p[1].Value = GlobalExtensions.LastDateOfMonth(toDate);
|
|
|
|
DataSet summary = tc.ExecuteDataSet(CommandType.StoredProcedure, "[dbo].[SP_SalarySheet]", p);
|
|
|
|
|
|
return summary;
|
|
}
|
|
|
|
|
|
internal static string GetMaxCode(TransactionContext tc, string sTableName, string ColumnName)
|
|
{
|
|
object sCode = tc.ExecuteScalar("SELECT MAX(%q) FROM %q", ColumnName, sTableName);
|
|
if (sCode == DBNull.Value)
|
|
return "";
|
|
return sCode.ToString();
|
|
}
|
|
|
|
internal static string GetMaxCode(TransactionContext tc, string sTableName, string ColumnName, int tier)
|
|
{
|
|
object sCode = tc.ExecuteScalar("SELECT MAX(%q) FROM %q where tire=%n ", ColumnName, sTableName, tier);
|
|
if (sCode == DBNull.Value)
|
|
return "";
|
|
return sCode.ToString();
|
|
}
|
|
|
|
internal static void BackupDatabase(TransactionContext tc, string sPath)
|
|
{
|
|
tc.ExecuteNonQuery("BACKUP DATABASE %q TO DISK=%s", tc.Connection.Database, sPath);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|