spc-kiosk-pb/Service/AsvMaster/PosMaster.cs

138 lines
4.9 KiB
C#
Raw Permalink Normal View History

2019-06-16 05:12:09 +00:00
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;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : POS 마스터
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
public class PosMaster : IMasterUs
{
protected SManager sManager = new SManager();
protected StateServer StateObject = (StateServer)StateServer.GetInstance();
protected PosStatus m_cPosStatus;
protected TranStatus m_cTrnStatus;
protected IDatabaseSQL m_cSqlDbService = null;
public PosMaster()
{
m_cPosStatus = (PosStatus)StateObject.POS;
m_cTrnStatus = (TranStatus)StateObject.TRAN;
m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);
}
/// <summary>
/// 조회
/// </summary>
/// <param name="aParam">0:SQL문</param>
/// <returns></returns>
public DataTable Select(string[] aParam)
{
try
{
string sQuery = aParam[0]; // SQL 문
sQuery = sQuery.Replace("\t", " ");
DataTable dtData = new DataTable();
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
m_cSqlDbService.DBSelect(sQuery, out dtData);
m_cSqlDbService.Close();
return dtData;
}
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 iReturn = UserCom.NG;
try
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
iReturn = m_cSqlDbService.DBExecuteNonQuery(aParam, true);
m_cSqlDbService.Close();
}
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 iReturn;
}
/// <summary>
/// Update
/// </summary>
/// <param name="aParam"></param>
/// <returns>UserCom.OK:Success, UserCom.NG:Fail</returns>
public int Update(string[] aParam)
{
int iReturn = UserCom.NG;
try
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
iReturn = m_cSqlDbService.DBExecuteNonQuery(aParam, true);
m_cSqlDbService.Close();
}
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 iReturn;
}
public int Insert(string[] aParam)
{
int iReturn = UserCom.NG;
try
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
iReturn = m_cSqlDbService.DBExecuteNonQuery(aParam, true);
m_cSqlDbService.Close();
}
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 iReturn;
}
}
}