spc-kiosk-pb/Service/AsvMaster/PayDcMaster.cs
2019-06-16 14:12:09 +09:00

150 lines
6.6 KiB
C#

using System;
using System.Text;
using System.IO;
using System.Collections;
using System.Runtime.InteropServices;
using System.Data;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.ServiceProvider;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 결제, 할인 마스터
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
public class PayDcMaster : PosMaster, IMasterUs
{
public PayDcMaster()
{
}
/// <summary>
/// 조회
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public DataTable Select(string[] aParam)
{
try
{
string sQuery = string.Empty;
if (aParam[0] == PosMst.MST_PAY_DC.TABLE_NAME)
{
sQuery = " SELECT * ";
sQuery += " FROM POSMST..MST_PAY_DC WITH(NOLOCK) ";
sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "'";
if (aParam[1] != "")
{
sQuery += " AND PAY_DC_GRP_TYPE ='" + aParam[1] + "'";
}
if (aParam[2] != "")
{
sQuery += " AND PAY_DC_CD ='" + aParam[2] + "'";
}
sQuery += " AND USE_YN ='" + PosConst.MST_USE_YN.YES + "'";
}
else if (aParam[0] == PosMst.MST_TERM_COOP_CMP_PAY_DC.TABLE_NAME)
{
sQuery = " SELECT A.CMP_CD, A.STOR_CD, A.PAY_DC_GRP_TYPE, A.PAY_DC_CD, A.PAY_DC_NM";
sQuery += " ,A.ERP_CNNT_CD, A.PAY_DC_TYPE, A.APPR_VEND_CD, A.CASH_BILL_ISSUE_YN, A.BLNC_AMT_EXCHNG_CPN_PRT_YN";
sQuery += " ,A.CNNT_ITEM_CHECK_YN, A.COOP_CMP_CNNT_YN, A.ADMT_TRGT_YN, A.OWN_YN, A.PRFX_TRGT_YN";
sQuery += " ,A.HP_BASIC_ACCUM_YN, A.DC_TRGT_AMT_TYPE, A.CPI_DUP_YN, A.DC_TELECOM_DUP_YN, A.DC_POINT_DUP_YN";
sQuery += " ,A.DC_CPN_DUP_YN, A.DC_EMP_DC_DUP_YN, A.DC_GNRL_DUP_YN, A.PAY_GNRL_DUP_YN, A.PAY_MOBILE_DUP_YN";
sQuery += " ,A.PAY_POINT_DUP_YN, A.SALE_POS_PRT_QUE, A.USE_YN, B.COOP_CMP_GRADE_CD, B.START_DT, B.FNSH_DT";
sQuery += " ,B.DC_APPLY_TRGT, B.PAY_DC_METHD, B.PAY_DC_VAL, B.PAY_DC_AMT_STD_PAY_AMT,B.PAY_DC_DEC_PNT_CALC_METHD";
sQuery += " ,B.PAY_DC_CALC_DIGT_NO";
sQuery += " FROM POSMST.dbo.MST_PAY_DC A WITH(NOLOCK)";
sQuery += " INNER JOIN POSMST.dbo.MST_TERM_COOP_CMP_PAY_DC B WITH(NOLOCK)";
sQuery += " ON A.CMP_CD = B.CMP_CD";
sQuery += " AND A.STOR_CD = B.STOR_CD";
sQuery += " AND A.PAY_DC_GRP_TYPE = B.PAY_DC_GRP_TYPE";
sQuery += " AND A.PAY_DC_CD = B.PAY_DC_CD";
sQuery += " WHERE 1 = 1";
if (aParam[1] != "")
{
sQuery += " AND A.PAY_DC_GRP_TYPE ='" + aParam[1] + "'";
}
if (aParam[2] != "")
{
sQuery += " AND B.PAY_DC_CD ='" + aParam[2] + "'";
}
sQuery += " AND A.USE_YN ='" + PosConst.MST_USE_YN.YES + "'";
}
else if (aParam[0] == PosMst.MST_PAY_DC.TABLE_NAME_GROUPBY)
{
sQuery = " SELECT ";
sQuery += " CMP_CD, STOR_CD, ISNULL(MIN(CPI_DUP_YN),'1')CPI_DUP_YN ";
sQuery += " ,ISNULL(MIN(DC_TELECOM_DUP_YN),'1')DC_TELECOM_DUP_YN, ISNULL(MIN(DC_POINT_DUP_YN),'1')DC_POINT_DUP_YN ";
sQuery += " ,ISNULL(MIN(DC_CPN_DUP_YN),'1')DC_CPN_DUP_YN, ISNULL(MIN(DC_EMP_DC_DUP_YN),'1')DC_EMP_DC_DUP_YN ";
sQuery += " ,ISNULL(MIN(DC_GNRL_DUP_YN),'1')DC_GNRL_DUP_YN, ISNULL(MIN(PAY_GNRL_DUP_YN),'1')PAY_GNRL_DUP_YN ";
sQuery += " ,ISNULL(MIN(PAY_MOBILE_DUP_YN),'1')PAY_MOBILE_DUP_YN, ISNULL(MIN(PAY_POINT_DUP_YN),'1')PAY_POINT_DUP_YN ";
sQuery += " FROM POSMST..MST_PAY_DC WITH(NOLOCK) ";
sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "'";
sQuery += " AND PAY_DC_GRP_TYPE + PAY_DC_CD IN (" + aParam[1] + ")";
sQuery += " AND PAY_DC_TYPE ='" + aParam[2] + "'";
sQuery += " AND USE_YN ='" + PosConst.MST_USE_YN.YES + "'";
sQuery += " GROUP BY CMP_CD,STOR_CD";
}
else if (aParam[0] == PosMst.MST_CARD_PREFIX.TABLE_NAME)
{
sQuery = " SELECT * ";
sQuery += " FROM POSMST.dbo.MST_CARD_PREFIX WITH(NOLOCK) ";
sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
sQuery += " AND PRFX_CD IN ('" + aParam[1] + "',LEFT('" + aParam[1] + "',5)+'X',LEFT('" + aParam[1] + "',4)+'XX',LEFT('" + aParam[1] + "',3)+'XXX',LEFT('" + aParam[1] + "',2)+'XXXX',LEFT('" + aParam[1] + "',1)+'XXXXX') ";
if ( aParam.Length > 2)
sQuery += " AND CARD_DIV = '" + aParam[2] + "'";
}
else
{
return null;
}
return base.Select(new string[] { sQuery });
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return null;
}
public int Delete(string[] aParam)
{
int rows = 0;
return rows;
}
public int Update(string[] aParam)
{
int rows = 0;
return rows;
}
public int Insert(string[] aParam)
{
int rows = 0;
return rows;
}
}
}