238 lines
9.8 KiB
C#
238 lines
9.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using Cosmos.Common;
|
|
using Cosmos.ServiceProvider;
|
|
using Cosmos.CommonManager;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.BaseFrame;
|
|
|
|
namespace Cosmos.OLEDevice
|
|
{
|
|
public partial class frmDeviceOurHome : Form
|
|
{
|
|
#region 변수 선언
|
|
|
|
protected SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
|
protected StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
|
protected PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
|
|
|
/// <summary>
|
|
/// 빌딩코드
|
|
/// </summary>
|
|
///private string m_sRegStorCode = "";
|
|
/// <summary>
|
|
/// 서버 IP
|
|
/// </summary>
|
|
private string m_sServerIP = "";
|
|
/// <summary>
|
|
/// DB 스키마
|
|
/// </summary>
|
|
private string m_sDBChema = "";
|
|
/// <summary>
|
|
/// ID
|
|
/// </summary>
|
|
private string m_sID = "";
|
|
/// <summary>
|
|
/// Password
|
|
/// </summary>
|
|
private string m_sPassword = "";
|
|
#endregion
|
|
|
|
public frmDeviceOurHome()
|
|
{
|
|
InitializeComponent();
|
|
|
|
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
|
//this.UpdateStyles();
|
|
|
|
//m_sRegStorCode = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.EMP_PAY_ITEM, ItemConst.TR_ITEM_ID.EMP_PAY.OURHOME, PosMst.MST_VAN.DATA.CMP_APPR_ID);
|
|
m_sServerIP = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.EMP_PAY_ITEM, ItemConst.TR_ITEM_ID.EMP_PAY.OURHOME, PosMst.MST_VAN.DATA.IP);
|
|
|
|
// 접속정보
|
|
LoadPosConfig_OurHome();
|
|
if (m_sDBChema == null || m_sDBChema.Trim() == "") SavePosConfig_OurHome();
|
|
}
|
|
|
|
#region 접속/해제 처리 함수
|
|
/// <summary>
|
|
/// DB 접속
|
|
/// </summary>
|
|
/// <param name="sStorCode"></param>
|
|
/// <param name="sServerIP"></param>
|
|
/// <param name="sDBSchema"></param>
|
|
/// <param name="sID"></param>
|
|
/// <param name="sPassword"></param>
|
|
/// <returns></returns>
|
|
private string DBConnect(string sStorCode, string sServerIP, string sDBSchema, string sID, string sPassword)
|
|
{
|
|
string sResult = "9^Not Connect DataBase!!!";
|
|
try
|
|
{
|
|
sResult = axOUT_STORE_RF1.DbConnect(sStorCode, sServerIP, sDBSchema, sID, sPassword);
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
|
ex.Message);
|
|
}
|
|
|
|
return sResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// DB 접속 해제
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private void DBDisConnect()
|
|
{
|
|
try
|
|
{
|
|
axOUT_STORE_RF1.DbDisConnect();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
|
ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 고객정보 조회
|
|
/// <summary>
|
|
/// 고객정보 조회
|
|
/// </summary>
|
|
/// <param name="sStoreCD"></param>
|
|
/// <param name="sRFNo"></param>
|
|
/// <param name="sRFType"></param>
|
|
/// <returns></returns>
|
|
public string Rf_EmpInfo(string sStoreCD, string sRFNo, string sRFType)
|
|
{
|
|
string sResult = "9^Not Connect DataBase!!!";
|
|
string[] aRecvData = null;
|
|
try
|
|
{
|
|
sResult = DBConnect(sStoreCD, m_sServerIP, m_sDBChema, m_sID, m_sPassword);
|
|
aRecvData = sResult.Split(new string[] { "^" }, StringSplitOptions.None);
|
|
if (aRecvData[0] != "1") return sResult;
|
|
|
|
sResult = axOUT_STORE_RF1.Rf_EmpInfo(sStoreCD, sRFNo, sRFType);
|
|
DBDisConnect();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
|
ex.Message);
|
|
}
|
|
return sResult;
|
|
}
|
|
#endregion
|
|
|
|
#region 결제
|
|
/// <summary>
|
|
/// 결제
|
|
/// </summary>
|
|
/// <param name="sTranData"></param>
|
|
/// <param name="sRfType"></param>
|
|
/// <returns></returns>
|
|
public string Rf_TransData(string sStoreCD, string sTranData, string sRfType)
|
|
{
|
|
string sResult = "9^Not Connect DataBase!!!";
|
|
string[] aRecvData = null;
|
|
try
|
|
{
|
|
sResult = DBConnect(sStoreCD, m_sServerIP, m_sDBChema, m_sID, m_sPassword);
|
|
aRecvData = sResult.Split(new string[] { "^" }, StringSplitOptions.None);
|
|
if (aRecvData[0] != "1") return sResult;
|
|
|
|
sResult = axOUT_STORE_RF1.Rf_TransData(sTranData, sRfType);
|
|
DBDisConnect();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
|
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
|
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
|
ex.Message);
|
|
}
|
|
return sResult;
|
|
}
|
|
#endregion
|
|
|
|
#region SavePosConfig Pos 환경설정정보 저장 (PosConfig.INI)
|
|
/// <summary>
|
|
/// POS환경설정정보 파일저장 (PosConfig.INI)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string SavePosConfig_OurHome()
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
try
|
|
{
|
|
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
|
|
|
|
cmPosConfig.GetMessage("OURHOME".Trim()).MakeMessageOverWrite("DBChema".Trim(), "OURHOME");
|
|
cmPosConfig.GetMessage("OURHOME".Trim()).MakeMessageOverWrite("ID".Trim(), "OUT_STORE");
|
|
cmPosConfig.GetMessage("OURHOME".Trim()).MakeMessageOverWrite("Password".Trim(), "OUT_STORE");
|
|
|
|
// 파일저장
|
|
cmPosConfig.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
|
|
|
|
LoadPosConfig_OurHome();
|
|
|
|
sRet = UserCom.RST_OK;
|
|
}
|
|
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 sRet;
|
|
}
|
|
#endregion
|
|
|
|
#region LoadPosConfig Pos 환경설정정보 읽기(PosConfig.INI)
|
|
/// <summary>
|
|
/// POS환경설정정보 파일읽기 (PosConfig.INI)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string LoadPosConfig_OurHome()
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
try
|
|
{
|
|
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
|
|
|
|
m_sDBChema = cmPosConfig.GetMessage("OURHOME").GetMessageValue("DBChema");
|
|
m_sID = cmPosConfig.GetMessage("OURHOME").GetMessageValue("ID");
|
|
m_sPassword = cmPosConfig.GetMessage("OURHOME").GetMessageValue("Password");
|
|
|
|
sRet = UserCom.RST_OK;
|
|
}
|
|
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 sRet;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|