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); } /// /// 조회 /// /// 0:SQL문 /// 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; } /// /// Update /// /// /// UserCom.OK:Success, UserCom.NG:Fail 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; } } }