EchoTex_Payroll/HRM.DA/DA/Letter/OrganizationDA.cs

99 lines
3.1 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region LetterOrganization
public class OrganizationDA
{
#region Constructor
private OrganizationDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, Organization item)
{
string sql = SQLParser.MakeSQL(@"
INSERT INTO ORGANIZATION
(
ORGANIZATIONID,
NAME,
CODE,
ORGANIZATIONTYPE,
ADDRESS,
ADDRESSLINE2,
ADDRESSLINE3,
RECIPIENTDESIGNATION,COUNTRY
)
VALUES
(
%n,
%s,
%s,
%n,%s,%s,%s,%s,%n
)",
item.ID, item.Name, item.Code,
(int)item.OrganizationType, item.Address, item.AddressLine2, item.AddressLine3, item.RecipeintDesignation, item.CountryId == null ? 0 : item.CountryId);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, Organization item)
{
string sql = SQLParser.MakeSQL(@"UPDATE ORGANIZATION
SET
NAME = %s,
CODE = %s,
ORGANIZATIONTYPE = %n,
ADDRESS=%s,
ADDRESSLINE2=%s,
ADDRESSLINE3=%s,
RECIPIENTDESIGNATION=%s,
COUNTRY=%n
WHERE ORGANIZATIONID = %n",
item.Name, item.Code,
(int)item.OrganizationType, item.Address, item.AddressLine2,
item.AddressLine3, item.RecipeintDesignation, item.CountryId, item.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ORGANIZATION where ORGANIZATIONID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM ORGANIZATION");
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ORGANIZATION WHERE ORGANIZATIONID=%n", nID);
}
#endregion
}
#endregion
}