90 lines
2.8 KiB
C#
90 lines
2.8 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 PFTransactionDA
|
|
|
|
internal class SAPDesignationCodeDA
|
|
{
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, SAPDesignationCode item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"INSERT INTO SAPDesignationCode
|
|
(SAPDesignationCodeID,DesignationID, SAPCode)
|
|
VALUES(%n, %n, %s)"
|
|
, item.ID.Integer, item.DesignationID.Integer, item.SAPCode.Trim());
|
|
tc.ExecuteNonQuery(sql);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, SAPDesignationCode item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"UPDATE SAPDesignationCode
|
|
SET DesignationID=%n, SAPCode=%n
|
|
Where SAPDesignationCodeID=%n"
|
|
, item.DesignationID.Integer, item.SAPCode.Trim(), item.ID.Integer);
|
|
tc.ExecuteNonQuery(sql);
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, ID designationID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM SAPDesignationCode Where DesignationID=%n",designationID.Integer);
|
|
}
|
|
|
|
internal static bool SapCodeExists(TransactionContext tc, string sapCode, out string sDesigName)
|
|
{
|
|
|
|
object obj = tc.ExecuteScalar("Select DesignationID from SAPDesignationCode where SAPCode=%s", sapCode.Trim());
|
|
if (obj != null && obj.ToString() != "")
|
|
{
|
|
obj = tc.ExecuteScalar("SELECT Name FROM DESIGNATION WHERE DESIGNATIONID = %n", Convert.ToInt32(obj.ToString()));
|
|
sDesigName = obj.ToString();
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
sDesigName = string.Empty;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, ID id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM SAPDesignationCode WHERE SAPDesignationCodeID=%n",id.Integer);
|
|
}
|
|
|
|
internal static void DeleteByDesignation(TransactionContext tc, ID designationID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM SAPDesignationCode WHERE DesignationID=%n", designationID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|