using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
#region 사인패드/CAT단말기 검색 추가 시작 - 문성진D(20170331)
using System.Threading;
using System.IO.Ports;
#endregion 사인패드/CAT단말기 검색 추가 끝 - 문성진D(20170331)

using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using System.IO;

namespace Cosmos.Win
{
    public partial class frmPosConfiguration : Form
    {        
        private static Cosmos.ServiceProvider.Activator m_ServiceProvider = new Cosmos.ServiceProvider.Activator();

        private SManager sManager = new SManager();                                 // 이 객체를 통해 업무 Service 호출
        private StateServer StateObject = (StateServer)StateServer.GetInstance();   // StateObject : StateServer Object (객체)
        private PosStatus m_cPosStatus = new PosStatus();                           // 기본정보 참조
        private IServiceUs m_cPosConfig = null;                                     // 환경설정 정보 송/수신

        SETUP_INFO m_cSetupInfo;

        private IServiceUs m_cReadConfigInfo = null;
        private IServiceUs m_cLoadMstSrv = null;

        private string m_sPosMenuKeyIn;
        public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }

        private string m_sExecutionMode = "";
        public string ExeMode { set { m_sExecutionMode = value; } get { return m_sExecutionMode; } }

        private readonly Color m_clrSelectFont = Color.FromArgb(255, 255, 255);
        private readonly Color m_clrSelectback = Color.FromArgb(109, 110, 113);

        private readonly Color m_clrNonSelectFont = Color.FromArgb(109, 110, 113);
        private readonly Color m_clrNonSelectback = Color.FromArgb(255, 255, 255);

        private DataTable m_dtBrandList;

        private Point MouseDownLocation;

        //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
        private TextBox txtNewPrdUpYYYY, txtNewPrdUpMM, txtNewPrdUpDD, txtNewPrdUpHH, txtNewPrdUpMI, txtNewPrdUpSS;

        private enum CompanyList
        {
            PC,
            BRK,
            SL
        };

        /// <summary>
        /// PC 브랜드 리스트 정의
        /// </summary>
        private Hashtable m_htPCBrand = new Hashtable {
            {1, new BrandInfo("001", "파리크라상", "PC")},
            {2, new BrandInfo("002", "파리바게뜨", "PB")},
            {3, new BrandInfo("003", "르노뜨르", "")},
            {4, new BrandInfo("004", "리나스", "LN")},
            {5, new BrandInfo("005", "파스쿠찌", "PS")},
            {6, new BrandInfo("006", "파리스키친", "")},
            {7, new BrandInfo("007", "타마티", "TM")},
            {8, new BrandInfo("008", "아멜리", "")},
            {9, new BrandInfo("009", "Passion5", "P5")},
            {10, new BrandInfo("010", "퀸스파크", "QP")},
            {11, new BrandInfo("012", "라그릴리아", "LG")},
            {12, new BrandInfo("013", "월드바인", "WB")},
            {13, new BrandInfo("014", "잠바주스", "JJ")},
            {14, new BrandInfo("016", "팔러", "")},
            {15, new BrandInfo("017", "라브리", "LB")},
            {16, new BrandInfo("018", "베라피자나폴리", "VP")},
            {17, new BrandInfo("019", "쁘띠5", "PP")},
            {18, new BrandInfo("020", "strEAT", "ST")},
            {19, new BrandInfo("021", "라뜰리에", "L2")},
            {20, new BrandInfo("022", "한상차림", "HC")},
            {21, new BrandInfo("023", "Coffee@Works", "CW")},
            {22, new BrandInfo("026", "그릭슈바인", "")},
            {23, new BrandInfo("029", "쉐이크쉑", "SS")},
            //#20180508 피그인더가든 브랜드 추가 start
            {24, new BrandInfo("092", "피그인더가든", "PG")},
            //#20180508 피그인더가든 브랜드 추가 end
            //#20171019 피자업 브랜드 추가 start
            {25, new BrandInfo("093", "피자업", "PU")}
            //#20171019 피자업 브랜드 추가 end
        };

        /// <summary>
        /// BR 브랜드 리스트 정의
        /// </summary>
        private Hashtable m_htBRBrand = new Hashtable {
            {1, new BrandInfo("3000", "배스킨라빈스", "BR")},
            {2, new BrandInfo("5000", "던킨도너츠", "DD")}
        };

        /// <summary>
        /// SL 브랜드 리스트 정의
        /// </summary>
        private Hashtable m_htSLBrand = new Hashtable {
            {1, new BrandInfo("7000", "사누끼보레", "")},
            {2, new BrandInfo("8000", "빚은", "")},
            {3, new BrandInfo("1000", "르뽀미에", "")},
            {4, new BrandInfo("2000", "그릭슈바인", "")},
            {5, new BrandInfo("9000", "델리가든", "")},
            {6, new BrandInfo("3100", "삼립GFS", "")},
            {7, new BrandInfo("8100", "BZ+LP", "")},
            {8, new BrandInfo("8200", "BZ+차오름", "")},
            {9, new BrandInfo("6000", "str)EAT", "")},
            {10, new BrandInfo("1100", "eat2go", "")},
            {11, new BrandInfo("8300", "하이면", "")}
        };

        // 현재 선택된 회사
        private CompanyList m_SeletedCompany;

        private bool bSaveEvent = false;        // 저장 여부(서버전송용)

        #region 사인패드/CAT단말기 검색 추가 시작 - 문성진D(20170331)
        EventWaitHandle waitHandle = null;
        byte[] TransBuf = new byte[50];
        byte[] RcvBuf = new byte[1023];
        int RcvBufIdex = 0;

        SerialPort sPort = null;

        const byte STX = 0x02;
        const byte ETX = 0x03;
        const byte EOT = 0x04;
        const byte ENQ = 0x05;
        const byte ACK = 0x06;
        const byte NAK = 0x15;
        const byte FS = 0x1C;

        const byte NUL = 0x00;

        const byte CI_INIT = 0xA0;
        const byte CI_VER = 0xAA;
        const byte CI_VER_RES = 0xBB;

        const string SIGNPAD = "SIGNPAD";
        const string CATDIV = "CATDIV";
        const int BUFFER_SIZE = 1024;

        bool FSTX = false;
        bool FETX = false;
        bool FLRC = false;

        int iPortidx = 0;

        string FComport = string.Empty;
        string FModelType = string.Empty;
        string FKernel = string.Empty;
        string FRFVersion = string.Empty;
        string FAppVersion = string.Empty;
        string FSerial = string.Empty;

        string FModelName = string.Empty;
        string FCatVersion = string.Empty;
        string FTerminalID = string.Empty;
        string FSerialNo = string.Empty;
        string FConnType = string.Empty;
        string catResultstr = string.Empty;

        string ReadType = string.Empty;

        private bool m_bIsRunning = false;
        #endregion 사인패드/CAT단말기 검색 추가 끝 - 문성진D(20170331)

        public frmPosConfiguration()
        {
            InitializeComponent();

            base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
            //this.UpdateStyles();

            m_cPosStatus = (PosStatus)StateObject.POS;      // POS 기본정보

            m_cReadConfigInfo = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.READ_CONFIGINFO);
            m_cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);

            m_cPosConfig = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.POS_CONFIG);

            PosMenuKeyIn = "01";

            //InitControl();
            //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
            txtNewPrdUpYYYY = new TextBox();
            txtNewPrdUpMM = new TextBox();
            txtNewPrdUpDD = new TextBox();
            txtNewPrdUpHH = new TextBox();
            txtNewPrdUpMI = new TextBox();
            txtNewPrdUpSS = new TextBox();
        }



        private void frmPosConfiguration_Load(object sender, EventArgs e)
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                ExeMode = args[1];
            }

            frmPosConfigurationSecu frmPassword = new frmPosConfigurationSecu();

            frmPassword.Owner = this;
            if (ExeMode.Equals("POS") == true)
            {
                frmPassword.TopLevel = true;
                frmPassword.TopMost = true;
            }
            DialogResult drRtn = frmPassword.ShowDialog();

            // 비밀번호 입력에 실패했을 경우엔 종료
            if (drRtn != DialogResult.OK)
            {
                this.Close();

                return;
            }

            InitControl();

            InitGrid();

            TitleDisplay();
            MenuDisplay();

            GetSetupInfo();

            CheckDisabledDevices();

            //if (ExeMode.Equals("POS") == true)
            //{
            //    this.TopLevel = true;
            //    this.TopMost = true;
            //}
        }

        private void frmPosConfiguration_FormClosing(object sender, FormClosingEventArgs e)
        {

        }

        private void SetControlFont()
        {
            try
            {
                FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);

                #region 01.점포환경 GroupBox 폰트 설정
                // 계열사 정보
                foreach (Control control in gbCompany.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // POS 정보
                foreach (Control control in gbPosInfo.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // DB 정보
                foreach (Control control in gbDbInfo.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 글로벌
                foreach (Control control in gbGlobal.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 명판 텍스트 등록
                foreach (Control control in gbPrint.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                #endregion

                #region 02.거래정보 GroupBox 폰트 설정
                // 영업정보
                foreach (Control control in gbSaleInfo.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 메시지 번호
                foreach (Control control in gbMsgNo.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // TRAN 테이블
                foreach(Control control in gbTranTable.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 데이터 수신 정보
                foreach (Control control in gbCheckOver.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                #endregion

                #region 03.포스장비 GroupBox 폰트 설정
                // 영수증 프린터
                foreach (Control control in gbPrinter.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 사인패드
                foreach (Control control in gbSignPad.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // IC Reader
                foreach (Control control in gbICReader.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 돈통
                foreach (Control control in gbCashDrawer.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // CAT 단말기
                foreach (Control control in gbCATTerminal.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // CDP
                foreach (Control control in gbCdp.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 라벨프린터
                foreach (Control control in gbLabelPrinter.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 저울
                foreach (Control control in gbScale.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 저울(POLE Display)
                foreach (Control control in gbScalewPole.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                #endregion

                #region 04.통신 설정 GroupBox 폰트 설정
                // 마스터 수신
                foreach (Control control in gbMasterDown.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 서버 환경
                foreach (Control control in gbServerType.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // FTP 접속 방식
                foreach(Control control in gbFtpConType.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                // 서버 설정
                foreach (Control control in gbServerInfo.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                #endregion

                #region 05.MSR에뮬 GroupBox 폰트 설정
                // MSR-에뮬
                foreach(Control control in gbMSREmul.Controls)
                {
                    control.Font = new Font(m_cPosStatus.Base.FONT, control.Font.Size, control.Font.Style);
                }
                #endregion
            }
            catch (Exception ex) { }
        }

        private void InitControl()
        {
            try
            {
                // INI File Loading
                LoadIniInfo();
                // Message Master Loading
                //LoadMessageMaster();

                // 이미지 로딩 처리
                picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
                this.Size = new Size(800, 600);

                // 화면 초기 위치
                int x = Screen.PrimaryScreen.WorkingArea.Size.Width;
                int y = Screen.PrimaryScreen.WorkingArea.Size.Height;
                this.Location = new Point((x - 800) / 2, (y - 600) / 2);

                btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
                if (btnExit.Image != null) btnExit.Text = "";

                FormManager.SetFormAllControlFont(this, CmUtil.IsNull(m_cPosStatus.Base.FONT, "맑은 고딕"));

                SetControlFont();

                //lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0317);

                //btnTitle01.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0635) + "-1";
                btnTitle01.Tag = "01";
                //btnTitle02.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0635) + "-2";
                btnTitle02.Tag = "02";
                //btnTitle03.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0719);
                btnTitle03.Tag = "03";
                //btnTitle04.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0720) + "-1";
                btnTitle04.Tag = "04";

                btnTitle05.Tag = "05";

                btnTitle06.Tag = "06";

                this.panel1.Controls.Add(pn02);
                this.panel1.Controls.Add(pn03);
                this.panel1.Controls.Add(pn04);
                this.panel1.Controls.Add(pn05);
                this.panel1.Controls.Add(pn06);

                this.pn01.Location = new Point(0, 49);
                this.pn02.Location = new Point(0, 49);
                this.pn03.Location = new Point(0, 49);
                this.pn04.Location = new Point(0, 49);
                this.pn05.Location = new Point(0, 49);
                this.pn06.Location = new Point(0, 49);

                #region 사인패드/CAT단말기 검색 추가 시작 - 문성진D(20170331)
                this.pn90.Location = new Point(pn03.Left + (pn03.Width / 2) - 150 , this.pn03.Top + (pn03.Height / 2) -30);
                #endregion 사인패드/CAT단말기 검색 추가 끝 - 문성진D(20170331)
                txtTextLogoMsg1.Text = "";
                txtTextLogoMsg2.Text = "";

                // POS 프로그램에서 호출되었을 경우에 아래 항목들은 Disabled.
                if (ExeMode.Equals("POS") == true)
                {
                    rbPc.Enabled = false;
                    rbBrk.Enabled = false;
                    rbSl.Enabled = false;
                    txtCmpCd.Enabled = false;
                    txtBrandDiv.Enabled = false;
                    txtBrandCd.Enabled = false;
                    txtStorCd.Enabled = false;
                    txtPosNo.Enabled = false;
                    //#20171227 인천공항 포스연동 start, phj
                    csmAirportIP.Enabled = false;
                    csmAirportUser.Enabled = false;
                    csmAirportPass.Enabled = false;
                    csmAirportComp.Enabled = false;
                    csmAirportStore.Enabled = false;
                    csmAirportPosNo.Enabled = false;
                    //#20171227 인천공항 포스연동 end, phj

                    //#20180322 휴게소pos매출연동 start,phj
                    Edt_RestAreaDir.Enabled = false;
                    Edt_RestAreaGroupCd.Enabled = false;
                    Edt_RestAreaPosGroupCd.Enabled = false;
                    Edt_RestAreaPosCd.Enabled = false;
                    Edt_RestAreaPosPosNo.Enabled = false;
                    //#20180322 휴게소pos매출연동 end,phj
                }

                //// PosConfig.INI
                //gbPosInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0636);
                //lblCmpCd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0638);
                //lblBrandDiv.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0904);
                //lblBrandCd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0793);                
                //lblStorCd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0639);
                //lblPosNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0370);
                //lblLogLevel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0642);

                //gbGlobal.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0643);
                //lblCountryCd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0644);
                //lblCultureId.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0645);
                //lblFont.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0646);
                //lblFontFix.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0879);

                //gbServerInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0647);
                //lblCommSvrIp.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0648);
                //lblExTranUrl.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0649);
                //lblExCalcUrl.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0650);

                //gbDbInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0651);
                //lblLocalSource.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0652);
                //lblLocalCatalog.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0653);
                //lblLocalUserId.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0654);
                //lblPassword.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0655);

                //gbKacInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0656);
                //lblKacUseYn.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0657);
                //lblKacConNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0658);

                //gbExInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0659);
                //lblExUseYn.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0657);
                //lblExStorCd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0660);
                //lblExCornerCd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0661);

                //gbPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0903);
                //txtTextLogoMsg1.Text = "";
                //txtTextLogoMsg2.Text = "";

                //btnSave.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0225);


                //// PosSaleInfo.INI
                //gbSaleInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0898);
                //lblOpenClose.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0675);
                //lblSaleDt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242);
                //lblOpenDt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0676);
                //lblCloseDt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0677);
                //lblPgmVer.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0678);
                //lblPgmVerSeq.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0679);

                //gbMsgNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0685);
                //lblTradeNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0686);
                //lblRegNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0687);
                //lblStartTradeNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0688);
                //lblMsgSeqNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0689);

                //gbCheckOver.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0680);
                //lblMstDownDt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0469);
                //lblMstBatchDownDt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0899);
                //lblRegular.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0681);
                //lblEmergency.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0682);
                //lblSale1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0683);
                //lblSale2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0684);

                //// PosDevice.INI
                //gbPrinter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0690);
                //lblPrinterUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblPrinterController.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0699);
                //lblPrinterPortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblPrinterBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);
                //lblPrinterModel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0705);

                //gbSignPad.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0696);
                //lblSignPadUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblSignPadPortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblSignPadBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);
                //lblSignPadModel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0705);
                //lblSignPadAutoFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0703);
                //lblMinCnt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0704);
                //lblSignPadTimeout.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0702);

                //gbCashDrawer.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0693);
                //lblCDUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblCDController.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0699);

                //gbScale.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0694);
                //lblScaleUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblScalePortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblScaleBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);

                //gbWScale.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0695);
                //lblWScaleUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblWScalePortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblWScaleBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);

                //gbICReader.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0691);
                //lblIcReaderUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblIcReaderPortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblIcReaderBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);

                //gbCATTerminal.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0692);
                //lblCatPortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblCatBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);
                //lblCatTimeout.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0702);

                //gbLabelPrinter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0697);
                //lblLabelPrtUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblLabelPrtPortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblLabelPrtBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);
                //lblLabelPrtModel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0705);

                //gbCdp.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0939);
                //lblCdpUseFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0698);
                //lblCdpController.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0699);
                //lblCdpPortNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0700);
                //lblCdpBaudRate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0701);
                //lblCdpModel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0705);

                //// CommPort.INI
                ////gbServerPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0900);
                //lblSignLogPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0706);
                //lblSysInfoPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0707);
                //lblTranPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0708);
                //lblJrnlPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0709);
                //lblTranInqPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0710);
                //lblMissChkPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0711);
                //lblPayInqPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0712);
                //lblBizInqPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0713);
                //lblMstPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0714);
                //lblPayLogPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0715);
                //lblAppLogPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0716);
                //lblEtcTranPort.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0717);

                // 프린터 모델 ComboBox List
                cbPrinterModel.Items.Clear();
                for (int nLoop = 0; nLoop < ComboBoxConst.POSPrinter_Model.CB_LIST_PrinterModel.Length; nLoop++)
                {
                    cbPrinterModel.Items.Add(ComboBoxConst.POSPrinter_Model.CB_LIST_PrinterModel[nLoop]);
                }

                // 사인패드 모델 ComboBox List
                cbSignPadModel.Items.Clear();
                for (int nLoop = 0; nLoop < ComboBoxConst.Signpad_Model.CB_LIST_SignpadModel.Length;nLoop++)
                {
                    cbSignPadModel.Items.Add(ComboBoxConst.Signpad_Model.CB_LIST_SignpadModel[nLoop]);
                }

                // CAT단말기 모델 ComboBox List
                cbCatModel.Items.Clear();
                for (int nLoop = 0; nLoop < ComboBoxConst.CATTerminal_Model.CB_LIST_CATTerminalModel.Length;nLoop++)
                {
                    cbCatModel.Items.Add(ComboBoxConst.CATTerminal_Model.CB_LIST_CATTerminalModel[nLoop]);
                }

                // MSR 에뮬 ComboBox List
                cbMSREmulModel.Items.Clear();
                for (int nLoop = 0; nLoop < ComboBoxConst.MSREmul_Model.CB_LIST_MSREmulModel.Length;nLoop++)
                {
                    cbMSREmulModel.Items.Add(ComboBoxConst.MSREmul_Model.CB_LIST_MSREmulModel[nLoop]);
                }

                bSaveEvent = false;

            }
            catch (Exception ex) { }
        }

        private void InitGrid()
        {
            dgvBrandList.TopLeftHeaderCell.Value = "No.";

            // 사용자가 Row 추가할 수 없도록 함
            dgvBrandList.AllowUserToAddRows = false;

            m_dtBrandList = new DataTable();
            m_dtBrandList.Columns.Add(new DataColumn("BrandCd", typeof(string)));
            m_dtBrandList.Columns.Add(new DataColumn("BrandNm", typeof(string)));
            m_dtBrandList.Columns.Add(new DataColumn("BrandDiv", typeof(string)));
            m_dtBrandList.Clear();

            dgvBrandList.DataSource = m_dtBrandList;

            dgvBrandList.Columns[0].HeaderText = "Code";
            dgvBrandList.Columns[1].HeaderText = "Name";
            dgvBrandList.Columns[2].HeaderText = "Div";

            dgvBrandList.Columns[0].Width = 50;// .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvBrandList.Columns[1].Width = 150;//  AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvBrandList.Columns[2].Width = 60;// .AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

            dgvBrandList.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvBrandList.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvBrandList.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;

            dgvBrandList.RowHeadersWidth = 50;

            dgvBrandList.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            dgvBrandList.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            dgvBrandList.AllowUserToResizeColumns = false;
            dgvBrandList.AllowUserToResizeRows = false;
        }

        /// <summary>
        /// INI 파일 정보를 읽어 온다.
        /// </summary>
        private void LoadIniInfo()
        {
            try
            {
                m_cReadConfigInfo.Execute(null);
            }
            catch (Exception ex) { }
        }

        /// <summary>
        /// 메시지 마스터를 Load 한다.
        /// </summary>
        private void LoadMessageMaster()
        {
            try
            {
                m_cLoadMstSrv.Execute(new string[] { MasterLists.MST_MSG.ID });
            }
            catch (Exception ex) { }
        }

        /// <summary>
        /// 타이틀 색상 전환 표시
        /// </summary>
        private void TitleDisplay()
        {
            try
            {
                foreach (Control control in pnlTitle.Controls)
                {
                    if (control is UI.CsmButton)
                    {
                        if (control.Tag.ToString() == PosMenuKeyIn)
                        {
                            //글자색변경
                            //배경색변경
                            control.ForeColor = m_clrSelectFont;
                            control.BackColor = m_clrSelectback;
                        }
                        else
                        {
                            control.ForeColor = m_clrNonSelectFont;
                            control.BackColor = m_clrNonSelectback;
                        }
                    }
                }
            }
            catch (Exception ex) { }
        }

        /// <summary>
        /// 화면에 btnTitle 관련 Panel 표시
        /// </summary>
        private void MenuDisplay()
        {
            try
            {
                if (PosMenuKeyIn == "01")        // 점포환경
                {
                    pn01.Visible = true;
                    pn02.Visible = false;
                    pn03.Visible = false;
                    pn04.Visible = false;
                    pn05.Visible = false;
                    btnDefault.Visible = true;
                }
                else if (PosMenuKeyIn == "02")  // 거래정보
                {
                    pn01.Visible = false;
                    pn02.Visible = true;
                    pn03.Visible = false;
                    pn04.Visible = false;
                    pn05.Visible = false;
                    btnDefault.Visible = true;
                }
                else if (PosMenuKeyIn == "03")   // 포스장비
                {
                    pn01.Visible = false;
                    pn02.Visible = false;
                    pn03.Visible = true;
                    pn04.Visible = false;
                    pn05.Visible = false;
                    btnDefault.Visible = true;
                }
                else if (PosMenuKeyIn == "04")   // 통신설정
                {
                    pn01.Visible = false;
                    pn02.Visible = false;
                    pn03.Visible = false;
                    pn04.Visible = true;
                    pn05.Visible = false;
                    btnDefault.Visible = true;

                    rbRealServer.Checked = false;
                    rbDevServer.Checked = false;
                }
                else if (PosMenuKeyIn == "05")   // MSR에뮬
                {
                    pn01.Visible = false;
                    pn02.Visible = false;
                    pn03.Visible = false;
                    pn04.Visible = false;
                    pn05.Visible = true;
                    btnDefault.Visible = true;
                }
                else if (PosMenuKeyIn == "06")  // 메모
                {
                    pn01.Visible = false;
                    pn02.Visible = false;
                    pn03.Visible = false;
                    pn04.Visible = false;
                    pn05.Visible = false;
                    pn06.Visible = true;
                    btnDefault.Visible = false;

                    tbMemo.Select(tbMemo.Text.Length, 1);
                }
            }
            catch (Exception ex) { }
        }

        /// <summary>
        /// 설정 파일 읽기
        /// </summary>
        /// <param name="cCfgInfo"></param>
        /// <param name="sGroup"></param>
        /// <param name="sValueName"></param>
        /// <returns></returns>
        private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName)
        {
            return GetConfigInfo(cCfgInfo, sGroup, sValueName, "");
        }
        private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName, string sDefault)
        {
            try
            {
                string sValue = cCfgInfo.GetMessage(sGroup).GetMessageValue(sValueName);
                if (sValue == null)
                    return sDefault;
                else
                    return sValue;
            }
            catch { }

            return sDefault;
        }

        /// <summary>
        /// 사용안함으로 되어있는 주변기기 선택 제한
        /// </summary>
        private void CheckDisabledDevices()
        {
            try
            {
                // 영수증프린터 사용유무가 사용 안 함
                if (cbPrinterUseFlag.SelectedIndex == 0)
                {
                    cbPrinterBaudRate.Enabled = false;
                    cbPrinterController.Enabled = false;
                    cbPrinterModel.Enabled = false;
                    cbPrinterPortNo.Enabled = false;
                }
                else
                {
                    // 영수증프린터 연결유형이 RS232
                    if (cbPrinterController.SelectedIndex == 0)
                    {
                        cbPrinterPortNo.Enabled = true;
                        cbPrinterBaudRate.Enabled = true;
                    }
                    else
                    {
                        cbPrinterPortNo.Enabled = false;
                        cbPrinterBaudRate.Enabled = false;
                    }
                    cbPrinterController.Enabled = true;
                    cbPrinterModel.Enabled = true;
                }
                // 사인패드 사용유무가 사용 안 함
                if (cbSignPadUseFlag.SelectedIndex == 0)
                {
                    cbSignPadBaudRate.Enabled = false;
                    cbSignPadPortNo.Enabled = false;
                    cbSignPadModel.Enabled = false;
                    txtSignPadAutoFlag.Enabled = false;
                    txtSignPadMinCnt.Enabled = false;
                    txtSignPadTimeout.Enabled = false;
                }
                else
                {
                    cbSignPadBaudRate.Enabled = true;
                    cbSignPadPortNo.Enabled = true;
                    cbSignPadModel.Enabled = true;
                    txtSignPadAutoFlag.Enabled = true;
                    txtSignPadMinCnt.Enabled = true;
                    txtSignPadTimeout.Enabled = true;
                }
                // 돈통 사용유무가 사용 안 함
                if (cbCDUseFlag.SelectedIndex == 0)
                {
                    cbCDController.Enabled = false;
                    cbCDPortNo.Enabled = false;
                    cbCDBaudRate.Enabled = false;
                }
                else
                {
                    cbCDController.Enabled = true;
                    // 연결유형이 IBM 본체 일 경우에만 포트설정을 enable 한다.
                    if (cbCDController.SelectedIndex == 4)
                    {
                        cbCDPortNo.Enabled = true;
                        cbCDBaudRate.Enabled = true;
                    }
                    else
                    {
                        cbCDPortNo.Enabled = false;
                        cbCDBaudRate.Enabled = false;
                    }
                }
                // 저울 사용유무가 사용 안 함
                if (cbScaleUseFlag.SelectedIndex == 0)
                {
                    cbScaleBaudRate.Enabled = false;
                    cbScalePortNo.Enabled = false;
                }
                else
                {
                    cbScaleBaudRate.Enabled = true;
                    cbScalePortNo.Enabled = true;
                }
                // 저울(POLE Device)가 사용 안 함
                if (cbScalewPoleUseFlag.SelectedIndex == 0)
                {
                    cbScalewPolePortNo.Enabled = false;
                    cbScalewPoleBaudRate.Enabled = false;
                }
                else
                {
                    cbScalewPolePortNo.Enabled = true;
                    cbScalewPoleBaudRate.Enabled = true;
                }
                // IC Reader 사용유무가 사용 안 함
                if (cbIcReaderUseFlag.SelectedIndex == 0)
                {
                    cbIcReaderBaudRate.Enabled = false;
                    cbIcReaderPortNo.Enabled = false;
                }
                else
                {
                    cbIcReaderBaudRate.Enabled = true;
                    cbIcReaderPortNo.Enabled = true;
                }
                // CAT단말기 사용유무가 사용 안 함
                if (cbCatUseFlag.SelectedIndex == 0)
                {
                    cbCatBaudRate.Enabled = false;
                    cbCatPortNo.Enabled = false;
                    cbCatModel.Enabled = false;
                    cbCatTimeout.Enabled = false;
                }
                else
                {
                    cbCatBaudRate.Enabled = true;
                    cbCatPortNo.Enabled = true;
                    cbCatModel.Enabled = true;
                    cbCatTimeout.Enabled = true;
                }
                // 라벨프린터 사용유무가 사용 안 함
                if (cbLabelPrtUseFlag.SelectedIndex == 0)
                {
                    cbLabelPrtBaudRate.Enabled = false;
                    cbLabelPrtPortNo.Enabled = false;
                }
                else
                {
                    cbLabelPrtBaudRate.Enabled = true;
                    cbLabelPrtPortNo.Enabled = true;
                }
                // CDP 사용유무가 사용 안 함
                if (cbCdpUseFlag.SelectedIndex == 0)
                {
                    cbCdpController.Enabled = false;
                    cbCdpPortNo.Enabled = false;
                    cbCdpBaudRate.Enabled = false;
                    cbCdpModel.Enabled = false;
                }
                else
                {
                    cbCdpController.Enabled = true;
                    cbCdpPortNo.Enabled = true;
                    cbCdpBaudRate.Enabled = true;
                    cbCdpModel.Enabled = true;
                }
                // MSR에뮬 사용유무가 사용 안 함
                if(cbMSREmulUseFlag.SelectedIndex == 0)
                {
                    cbMSREmulController.Enabled = false;
                    cbMSREmulPortNo.Enabled = false;
                    cbMSREmulBaudRate.Enabled = false;
                    cbMSREmulPrefix.Enabled = false;
                    cbMSREmulModel.Enabled = false;
                }
                else
                {
                    cbMSREmulController.Enabled = true;
                    if (cbMSREmulController.SelectedIndex == 0)
                    {
                        cbMSREmulPortNo.Enabled = false;
                        cbMSREmulBaudRate.Enabled = false;
                    }
                    else
                    {
                        cbMSREmulPortNo.Enabled = true;
                        cbMSREmulBaudRate.Enabled = true;
                    }
                    cbMSREmulPrefix.Enabled = true;
                    cbMSREmulModel.Enabled = true;
                }

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                // DMB IF 사용유무가 사용 안 함
                if (cbDmbIfUseFlag.SelectedIndex == 0)
                {
                    txtDmbIfIp.Enabled = false;
                    txtDmbIfPort.Enabled = false;
                }
                else
                {
                    txtDmbIfIp.Enabled = true;
                    txtDmbIfPort.Enabled = true;
                }
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end
            }
            catch (Exception ex) { }
        }

        private void GetSetupInfo()
        {
            CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
            CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
            CmMessage m_PosDevice = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosDevice);
            CmMessage m_CommPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort);
            //#20171227 인천공항 포스연동 start, phj
            CmMessage m_IncheonAirPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.IncheonAirPort);
            //#20171227 인천공항 포스연동 end, phj

            //#20180322 휴게소pos매출연동 start,phj
            CmMessage m_RestAreaPos = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.RestAreaPos);
            //#20180322 휴게소pos매출연동 end,phj

            try
            {
                m_cSetupInfo = new SETUP_INFO();

                // PosConfig.INI
                m_cSetupInfo.sCmpCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "CmpCd"));
                m_cSetupInfo.sBrandDiv = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "BrandDiv"));
                m_cSetupInfo.sBrandCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "BrandCd"));
                m_cSetupInfo.sStorCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "StoreNo"));
                m_cSetupInfo.sPosNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "PosNo"));
                m_cSetupInfo.sLogLevel = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "LogLevel"));

                //m_cSetupInfo.sKacUseYn = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "KacPos"));
                //m_cSetupInfo.sKacConNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "KacConNo"));

                //m_cSetupInfo.sExUseYn = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "ExPos"));
                //m_cSetupInfo.sExStorCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "ExStoreCd"));
                //m_cSetupInfo.sExCornerCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "ExCornerCd"));

                m_cSetupInfo.sLogoUpload = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "LogoUpload"));
                m_cSetupInfo.sMasterDown = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "MasterDown"));

                m_cSetupInfo.sSource = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "DATABASE", "LocalSource"));
                m_cSetupInfo.sCatalog = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "DATABASE", "LocalCatalog"));
                m_cSetupInfo.sId = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "DATABASE", "LocalUserID"));
                m_cSetupInfo.sPassword = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "DATABASE", "LocalPassword"));

                m_cSetupInfo.sCultureCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "GLOBAL", "CultureID"));
                m_cSetupInfo.sCountryCd = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "GLOBAL", "Country"));
                m_cSetupInfo.sFont = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "GLOBAL", "Font"));
                m_cSetupInfo.sFontFix = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "GLOBAL", "FontFix"));

                m_cSetupInfo.sCommSvrIp = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "SERVER", "CommSvrIp"));
                m_cSetupInfo.sFtpConnType = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "SERVER", "FtpConnType"));

                m_cSetupInfo.sTextLogoMsg1 = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "PRINT", "TextLogoMsg1"));
                m_cSetupInfo.sTextLogoMsg2 = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "PRINT", "TextLogoMsg2"));

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                m_cSetupInfo.sDmbIf = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "POS", "DmbIf"));
                cbDmbIfUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sDmbIf, "0"));

                m_cSetupInfo.sDmbSvrIp = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "SERVER", "DmbSvrIp"));
                txtDmbIfIp.Text = m_cSetupInfo.sDmbSvrIp;
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                txtCmpCd.Text = m_cSetupInfo.sCmpCd;
                txtBrandDiv.Text = m_cSetupInfo.sBrandDiv;
                txtBrandCd.Text = m_cSetupInfo.sBrandCd;
                txtStorCd.Text = m_cSetupInfo.sStorCd;
                txtPosNo.Text = m_cSetupInfo.sPosNo;
                cbLogLevel.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sLogLevel, "3")) - 1;

                txtCountryCd.Text = m_cSetupInfo.sCountryCd;
                txtCultureId.Text = m_cSetupInfo.sCultureCd;
                txtFont.Text = m_cSetupInfo.sFont;
                txtFontFix.Text = m_cSetupInfo.sFontFix;

                txtCommSvrIp.Text = m_cSetupInfo.sCommSvrIp;
                if (m_cSetupInfo.sFtpConnType == "0")
                {
                    rbActiveMode.Checked = true;
                    rbPassiveMode.Checked = false;
                }
                else
                {
                    rbActiveMode.Checked = false;
                    rbPassiveMode.Checked = true;
                }

                txtLocalSource.Text = UserLog.UserAES.StaticKeyDecrypt(m_cSetupInfo.sSource);
                txtLocalCatalog.Text = UserLog.UserAES.StaticKeyDecrypt(m_cSetupInfo.sCatalog);
                txtLocalUserId.Text = UserLog.UserAES.StaticKeyDecrypt(m_cSetupInfo.sId);
                txtPassword.Text = UserLog.UserAES.StaticKeyDecrypt(m_cSetupInfo.sPassword);

                txtTextLogoMsg1.Text = m_cSetupInfo.sTextLogoMsg1;
                txtTextLogoMsg2.Text = m_cSetupInfo.sTextLogoMsg2;

                cbLogoUpload.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sLogoUpload, "0"));
                if (m_cSetupInfo.sMasterDown == "0")
                {
                    rbMstDownYes.Checked = false;
                    rbMstDownNo.Checked = true;
                }
                else
                {
                    rbMstDownYes.Checked = true;
                    rbMstDownNo.Checked = false;
                }

                // PosSaleInfo.INI
                m_cSetupInfo.sSaleOpenClose = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "OpenClose"));
                m_cSetupInfo.sSaleDt = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "SaleDate"));
                m_cSetupInfo.sOpenDT = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "OpenDateTime"));
                m_cSetupInfo.sCloseDT = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "CloseDateTime"));
                m_cSetupInfo.sPgmVer = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "PGMVER", "ProgramVer10"));
                m_cSetupInfo.sPgmVerSeq = CmUtil.StringNullEmpty(GetConfigInfo(m_PosConfig, "PGMVER", "ProgramVerSeq10"));
                m_cSetupInfo.sMstDownDT = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "MstDownDate"));

                m_cSetupInfo.sTradeNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "MSGNO", "TradeNo"));
                m_cSetupInfo.sRegNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "MSGNO", "RegNo"));
                m_cSetupInfo.sMsgSeqNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "MSGNO", "MsgSeqNo"));

                m_cSetupInfo.sMstBatchDownDT = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "CHECKOVER", "MstBatchDownDate"), PosConst.BEGINNING_MST_DOWN_DATE);
                m_cSetupInfo.sRegularNotice = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "CHECKOVER", "RegularNoticeUpdDate"), PosConst.BEGINNING_MST_DOWN_DATE);
                m_cSetupInfo.sEmergencyNotice = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "CHECKOVER", "EmergencyNoticeUpdDate"), PosConst.BEGINNING_MST_DOWN_DATE);
                m_cSetupInfo.sSaleNotice1 = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "CHECKOVER", "SaleNoticeUpdDate1"), PosConst.BEGINNING_MST_DOWN_DATE);
                m_cSetupInfo.sSaleNotice2 = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "CHECKOVER", "SaleNoticeUpdDate2"), PosConst.BEGINNING_MST_DOWN_DATE);
                //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
                m_cSetupInfo.sNewProductUpdateDate = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "CHECKOVER", "NewProductUpdDate"), PosConst.BEGINNING_MST_DOWN_DATE);    

                m_cSetupInfo.sIMAGE_ALL_REDOWN_YN = CmUtil.IsNull(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "IMAGE_ALL_REDOWN_YN"), "1");

                cbOpenClose.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sSaleOpenClose, "0"));
                txtSaleDt.Text = m_cSetupInfo.sSaleDt;
                txtOpenDt.Text = m_cSetupInfo.sOpenDT;
                txtCloseDt.Text = m_cSetupInfo.sCloseDT;
                txtPgmVer.Text = m_cSetupInfo.sPgmVer;
                txtPgmVerSeq.Text = m_cSetupInfo.sPgmVerSeq;


                #region Substring 처리 주석
                //txtMstDownYYYY.Text = m_cSetupInfo.sMstDownDT.Substring(0, 4);
                //txtMstDownMM.Text = m_cSetupInfo.sMstDownDT.Substring(4, 2);
                //txtMstDownDD.Text = m_cSetupInfo.sMstDownDT.Substring(6, 2);
                //txtMstDownHH.Text = m_cSetupInfo.sMstDownDT.Substring(8, 2);
                //txtMstDownMI.Text = m_cSetupInfo.sMstDownDT.Substring(10, 2);
                //txtMstDownSS.Text = m_cSetupInfo.sMstDownDT.Substring(12, 2);

                //txtMstBatchDownYYYY.Text = m_cSetupInfo.sMstBatchDownDT.Substring(0, 4);
                //txtMstBatchDownMM.Text = m_cSetupInfo.sMstBatchDownDT.Substring(4, 2);
                //txtMstBatchDownDD.Text = m_cSetupInfo.sMstBatchDownDT.Substring(6, 2);
                //txtMstBatchDownHH.Text = m_cSetupInfo.sMstBatchDownDT.Substring(8, 2);
                //txtMstBatchDownMI.Text = m_cSetupInfo.sMstBatchDownDT.Substring(10, 2);
                //txtMstBatchDownSS.Text = m_cSetupInfo.sMstBatchDownDT.Substring(12, 2);

                //txtRegularYYYY.Text = m_cSetupInfo.sRegularNotice.Substring(0, 4);
                //txtRegularMM.Text = m_cSetupInfo.sRegularNotice.Substring(4, 2);
                //txtRegularDD.Text = m_cSetupInfo.sRegularNotice.Substring(6, 2);
                //txtRegularHH.Text = m_cSetupInfo.sRegularNotice.Substring(8, 2);
                //txtRegularMI.Text = m_cSetupInfo.sRegularNotice.Substring(10, 2);
                //txtRegularSS.Text = m_cSetupInfo.sRegularNotice.Substring(12, 2);

                //txtEmergencyYYYY.Text = m_cSetupInfo.sEmergencyNotice.Substring(0, 4);
                //txtEmergencyMM.Text = m_cSetupInfo.sEmergencyNotice.Substring(4, 2);
                //txtEmergencyDD.Text = m_cSetupInfo.sEmergencyNotice.Substring(6, 2);
                //txtEmergencyHH.Text = m_cSetupInfo.sEmergencyNotice.Substring(8, 2);
                //txtEmergencyMI.Text = m_cSetupInfo.sEmergencyNotice.Substring(10, 2);
                //txtEmergencySS.Text = m_cSetupInfo.sEmergencyNotice.Substring(12, 2);

                //txtSale1YYYY.Text = m_cSetupInfo.sSaleNotice1.Substring(0, 4);
                //txtSale1MM.Text = m_cSetupInfo.sSaleNotice1.Substring(4, 2);
                //txtSale1DD.Text = m_cSetupInfo.sSaleNotice1.Substring(6, 2);
                //txtSale1HH.Text = m_cSetupInfo.sSaleNotice1.Substring(8, 2);
                //txtSale1MI.Text = m_cSetupInfo.sSaleNotice1.Substring(10, 2);
                //txtSale1SS.Text = m_cSetupInfo.sSaleNotice1.Substring(12, 2);

                //txtSale2YYYY.Text = m_cSetupInfo.sSaleNotice2.Substring(0, 4);
                //txtSale2MM.Text = m_cSetupInfo.sSaleNotice2.Substring(4, 2);
                //txtSale2DD.Text = m_cSetupInfo.sSaleNotice2.Substring(6, 2);
                //txtSale2HH.Text = m_cSetupInfo.sSaleNotice2.Substring(8, 2);
                //txtSale2MI.Text = m_cSetupInfo.sSaleNotice2.Substring(10, 2);
                //txtSale2SS.Text = m_cSetupInfo.sSaleNotice2.Substring(12, 2);
                #endregion

                txtMstDownYYYY.Text = CmUtil.MidH(m_cSetupInfo.sMstDownDT, 0, 4);
                txtMstDownMM.Text = CmUtil.MidH(m_cSetupInfo.sMstDownDT, 4, 2);
                txtMstDownDD.Text = CmUtil.MidH(m_cSetupInfo.sMstDownDT, 6, 2);
                txtMstDownHH.Text = CmUtil.MidH(m_cSetupInfo.sMstDownDT, 8, 2);
                txtMstDownMI.Text = CmUtil.MidH(m_cSetupInfo.sMstDownDT, 10, 2);
                txtMstDownSS.Text = CmUtil.MidH(m_cSetupInfo.sMstDownDT, 12, 2);

                txtMstBatchDownYYYY.Text = CmUtil.MidH(m_cSetupInfo.sMstBatchDownDT, 0, 4);
                txtMstBatchDownMM.Text = CmUtil.MidH(m_cSetupInfo.sMstBatchDownDT, 4, 2);
                txtMstBatchDownDD.Text = CmUtil.MidH(m_cSetupInfo.sMstBatchDownDT, 6, 2);
                txtMstBatchDownHH.Text = CmUtil.MidH(m_cSetupInfo.sMstBatchDownDT, 8, 2);
                txtMstBatchDownMI.Text = CmUtil.MidH(m_cSetupInfo.sMstBatchDownDT, 10, 2);
                txtMstBatchDownSS.Text = CmUtil.MidH(m_cSetupInfo.sMstBatchDownDT, 12, 2);

                txtRegularYYYY.Text = CmUtil.MidH(m_cSetupInfo.sRegularNotice, 0, 4);
                txtRegularMM.Text = CmUtil.MidH(m_cSetupInfo.sRegularNotice, 4, 2);
                txtRegularDD.Text = CmUtil.MidH(m_cSetupInfo.sRegularNotice, 6, 2);
                txtRegularHH.Text = CmUtil.MidH(m_cSetupInfo.sRegularNotice, 8, 2);
                txtRegularMI.Text = CmUtil.MidH(m_cSetupInfo.sRegularNotice, 10, 2);
                txtRegularSS.Text = CmUtil.MidH(m_cSetupInfo.sRegularNotice, 12, 2);

                txtEmergencyYYYY.Text = CmUtil.MidH(m_cSetupInfo.sEmergencyNotice, 0, 4);
                txtEmergencyMM.Text = CmUtil.MidH(m_cSetupInfo.sEmergencyNotice, 4, 2);
                txtEmergencyDD.Text = CmUtil.MidH(m_cSetupInfo.sEmergencyNotice, 6, 2);
                txtEmergencyHH.Text = CmUtil.MidH(m_cSetupInfo.sEmergencyNotice, 8, 2);
                txtEmergencyMI.Text = CmUtil.MidH(m_cSetupInfo.sEmergencyNotice, 10, 2);
                txtEmergencySS.Text = CmUtil.MidH(m_cSetupInfo.sEmergencyNotice, 12, 2);

                txtSale1YYYY.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice1, 0, 4);
                txtSale1MM.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice1, 4, 2);
                txtSale1DD.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice1, 6, 2);
                txtSale1HH.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice1, 8, 2);
                txtSale1MI.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice1, 10, 2);
                txtSale1SS.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice1, 12, 2);

                txtSale2YYYY.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice2, 0, 4);
                txtSale2MM.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice2, 4, 2);
                txtSale2DD.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice2, 6, 2);
                txtSale2HH.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice2, 8, 2);
                txtSale2MI.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice2, 10, 2);
                txtSale2SS.Text = CmUtil.MidH(m_cSetupInfo.sSaleNotice2, 12, 2);

                //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
                txtNewPrdUpYYYY.Text = CmUtil.MidH(m_cSetupInfo.sNewProductUpdateDate, 0, 4);
                txtNewPrdUpMM.Text = CmUtil.MidH(m_cSetupInfo.sNewProductUpdateDate, 4, 2);
                txtNewPrdUpDD.Text = CmUtil.MidH(m_cSetupInfo.sNewProductUpdateDate, 6, 2);
                txtNewPrdUpHH.Text = CmUtil.MidH(m_cSetupInfo.sNewProductUpdateDate, 8, 2);
                txtNewPrdUpMI.Text = CmUtil.MidH(m_cSetupInfo.sNewProductUpdateDate, 10, 2);
                txtNewPrdUpSS.Text = CmUtil.MidH(m_cSetupInfo.sNewProductUpdateDate, 12, 2);

                if (CmUtil.MidH(m_cSetupInfo.sIMAGE_ALL_REDOWN_YN, 0, 1) == "1")
                    chkImageAllReDownload.Checked = true;
                else
                    chkImageAllReDownload.Checked = false;

                txtTradeNo.Text = m_cSetupInfo.sTradeNo;
                txtRegNo.Text = m_cSetupInfo.sRegNo;
                txtMsgSeqNo.Text = m_cSetupInfo.sMsgSeqNo;

                // PosDevice.INI
                m_cSetupInfo.sPrtUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "POSPRINTER", "UseFlag"), "0");
                m_cSetupInfo.sPrtController = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "POSPRINTER", "Controller"));
                m_cSetupInfo.sPrtPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "POSPRINTER", "SerialPortNumber"));
                m_cSetupInfo.sPrtBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "POSPRINTER", "SerialBaudRate"));
                string sPrinterModel = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "POSPRINTER", "Model"));
                m_cSetupInfo.sPrtModel = ComboBoxConst.GetIndexOf(ComboBoxConst.POSPrinter_Model.ID, CmUtil.IsNull(sPrinterModel, "1"));

                //#20171212 프린터 상태 체크 여부 추가 start
                //0: 체크, 1: 체크안함
                m_cSetupInfo.sPrtChk = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "POSPRINTER", "CheckPrinter"), "0");
                //#20171212 프린터 상태 체크 여부 추가 end

                m_cSetupInfo.sSignPadUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "SIGNPAD", "UseFlag"), "0");
                m_cSetupInfo.sSignPadPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "SerialPortNumber"));
                m_cSetupInfo.sSignPadBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "SerialBaudRate"));
                string sSignpadModel = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "Model"));
                m_cSetupInfo.sSignPadModel = ComboBoxConst.GetIndexOf(ComboBoxConst.Signpad_Model.ID, CmUtil.IsNull(sSignpadModel, "1"));
                m_cSetupInfo.sSignPadAutoflag = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "AutoFlag"));
                m_cSetupInfo.sSignPadMinCnt = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "MinCnt"));
                m_cSetupInfo.sSignPadTimeout = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SIGNPAD", "TimeOut"));

                m_cSetupInfo.sCDUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "CASHDRAWER", "UseFlag"), "0");
                m_cSetupInfo.sCDController = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CASHDRAWER", "CashDrawerType"));
                m_cSetupInfo.sCDPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CASHDRAWER", "SerialPortNumber"));
                m_cSetupInfo.sCDBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CASHDRAWER", "SerialBaudRate"));

                m_cSetupInfo.sScaleUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "SCALE", "UseFlag"), "0");
                m_cSetupInfo.sScalePortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SCALE", "SerialPortNumber"));
                m_cSetupInfo.sScaleBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SCALE", "SerialBaudRate"));

                m_cSetupInfo.sScalewPoleUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "SCALEPOLEDISP", "UseFlag"), "0");
                m_cSetupInfo.sScalewPolePortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SCALEPOLEDISP", "SerialPortNumber"));
                m_cSetupInfo.sScalewPoleBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "SCALEPOLEDISP", "SerialBaudRate"));

                m_cSetupInfo.sIcReaderUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "ICREADER", "UseFlag"), "0");
                m_cSetupInfo.sIcReaderPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "ICREADER", "SerialPortNumber"));
                m_cSetupInfo.sIcReaderBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "ICREADER", "SerialBaudRate"));

                m_cSetupInfo.sCatUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "CATTERMINAL", "UseFlag"), "0");
                m_cSetupInfo.sCatPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CATTERMINAL", "SerialPortNumber"));
                m_cSetupInfo.sCatBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CATTERMINAL", "SerialBaudRate"));
                string sCATModel = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CATTERMINAL", "Model"));
                m_cSetupInfo.sCatModel = ComboBoxConst.GetIndexOf(ComboBoxConst.CATTerminal_Model.ID, CmUtil.IsNull(sCATModel, "11"));
                m_cSetupInfo.sCatTimeout = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CATTERMINAL", "TimeOut"));

                m_cSetupInfo.sLabelPrtUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "LABELPRINTER", "UseFlag"), "0");
                m_cSetupInfo.sLabelPrtPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "LABELPRINTER", "SerialPortNumber"));
                m_cSetupInfo.sLabelPrtBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "LABELPRINTER", "SerialBaudRate"));

                m_cSetupInfo.sCdpUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "CDP", "UseFlag"), "0");
                m_cSetupInfo.sCdpController = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CDP", "Controller"));
                m_cSetupInfo.sCdpPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CDP", "SerialPortNumber"));
                m_cSetupInfo.sCdpBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CDP", "SerialBaudRate"));
                m_cSetupInfo.sCdpModel = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "CDP", "Model"));

                m_cSetupInfo.sMSREmulUseFlag = CmUtil.IsNull(GetConfigInfo(m_PosDevice, "MSR", "UseFlag"), "0");
                m_cSetupInfo.sMSREmulController = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "MSR", "Controller"));
                m_cSetupInfo.sMSREmulPortNo = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "MSR", "SerialPortNumber"));
                m_cSetupInfo.sMSREmulBaudrate = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "MSR", "SerialBaudRate"));
                m_cSetupInfo.sMSREmulStx = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "MSR", "STX"));
                m_cSetupInfo.sMSREmulEtx = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "MSR", "ETX"));
                string sMSREmulModel = CmUtil.StringNullEmpty(GetConfigInfo(m_PosDevice, "MSR", "Model"));
                m_cSetupInfo.sMSREmulModel = CmUtil.IsNull(sMSREmulModel, "ETC");

                cbPrinterUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sPrtUseFlag, "0"));
                cbPrinterController.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sPrtController, "1")) - 1;
                cbPrinterPortNo.Text = m_cSetupInfo.sPrtPortNo;
                cbPrinterBaudRate.Text = m_cSetupInfo.sPrtBaudrate;
                cbPrinterModel.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sPrtModel, "1"));

                //#20171212 프린터 상태 체크 여부 추가 start
                //0: 체크, 1: 체크안함
                if (CmUtil.MidH(m_cSetupInfo.sPrtChk, 0, 1) == "1")
                    CheckPrinter.Checked = true;
                else
                    CheckPrinter.Checked = false;
                //#20171212 프린터 상태 체크 여부 추가 end

                cbSignPadUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sSignPadUseFlag, "0"));
                cbSignPadPortNo.Text = m_cSetupInfo.sSignPadPortNo;
                cbSignPadBaudRate.Text = m_cSetupInfo.sSignPadBaudrate;
                //cbSignPadModel.SelectedIndex = int.Parse(m_cSetupInfo.sSignPadModel.Split(new string[] {":"}, StringSplitOptions.RemoveEmptyEntries)[0]) - 1;
                cbSignPadModel.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sSignPadModel, "1"));
                txtSignPadAutoFlag.Text = m_cSetupInfo.sSignPadAutoflag;
                txtSignPadMinCnt.Text = m_cSetupInfo.sSignPadMinCnt;
                txtSignPadTimeout.Text = m_cSetupInfo.sSignPadTimeout;

                cbCDUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCDUseFlag, "0"));
                cbCDController.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCDController, "1")) - 1;
                cbCDPortNo.Text = m_cSetupInfo.sCDPortNo;
                cbCDBaudRate.Text = m_cSetupInfo.sCDBaudrate;

                cbScaleUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sScaleUseFlag, "0"));
                cbScalePortNo.Text = m_cSetupInfo.sScalePortNo;
                cbScaleBaudRate.Text = m_cSetupInfo.sScaleBaudrate;

                cbScalewPoleUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sScalewPoleUseFlag, "0"));
                cbScalewPolePortNo.Text = m_cSetupInfo.sScalewPolePortNo;
                cbScalewPoleBaudRate.Text = m_cSetupInfo.sScalewPoleBaudrate;

                cbIcReaderUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sIcReaderUseFlag, "0"));
                cbIcReaderPortNo.Text = m_cSetupInfo.sIcReaderPortNo;
                cbIcReaderBaudRate.Text = m_cSetupInfo.sIcReaderBaudrate;

                cbCatUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCatUseFlag, "0"));
                cbCatPortNo.Text = m_cSetupInfo.sCatPortNo;
                cbCatBaudRate.Text = m_cSetupInfo.sCatBaudrate;
                cbCatModel.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCatModel, "11"));
                cbCatTimeout.Text = m_cSetupInfo.sCatTimeout;

                cbLabelPrtUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sLabelPrtUseFlag, "0"));
                cbLabelPrtPortNo.Text = m_cSetupInfo.sLabelPrtPortNo;
                cbLabelPrtBaudRate.Text = m_cSetupInfo.sLabelPrtBaudrate;

                cbCdpUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCdpUseFlag, "0"));
                cbCdpController.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCdpController, "1")) - 1;
                cbCdpPortNo.Text = m_cSetupInfo.sCdpPortNo;
                cbCdpBaudRate.Text = m_cSetupInfo.sCdpBaudrate;
                cbCdpModel.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sCdpModel, "0"));

                cbMSREmulUseFlag.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sMSREmulUseFlag, "0"));
                cbMSREmulController.SelectedIndex = int.Parse(CmUtil.IsNull(m_cSetupInfo.sMSREmulController, "1")) - 1;
                cbMSREmulPortNo.Text = m_cSetupInfo.sMSREmulPortNo;
                cbMSREmulBaudRate.Text = m_cSetupInfo.sMSREmulBaudrate;
                if(m_cSetupInfo.sMSREmulStx.Equals("?") == true)
                {
                    cbMSREmulPrefix.SelectedIndex = 1;
                }
                else
                {
                    cbMSREmulPrefix.SelectedIndex = 0;
                }
                cbMSREmulModel.Text = CmUtil.IsNull(m_cSetupInfo.sMSREmulModel, "0");

                // CommPort.INI
                m_cSetupInfo.sSignLogPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "SignLogPort"));
                m_cSetupInfo.sSysInfoPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "SysInfoPort"));
                m_cSetupInfo.sTranPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "TranPort"));
                m_cSetupInfo.sJrnlPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "JrnlPort"));
                m_cSetupInfo.sTranInqPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "TranInqPort"));
                m_cSetupInfo.sMissChkPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "MissChkPort"));
                m_cSetupInfo.sPayInqPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "PayInqPort"));
                m_cSetupInfo.sBizInqPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "BizInqPort"));
                m_cSetupInfo.sMstPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "MstPort"));
                m_cSetupInfo.sPayLogPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "PayLogPort"));
                m_cSetupInfo.sAppLogPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "AppLogPort"));
                m_cSetupInfo.sEtcTranPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "EtcTranPort"));
                m_cSetupInfo.sScaleLogPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "ScaleLogPort"));

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                m_cSetupInfo.sDmbIfPort = CmUtil.StringNullEmpty(GetConfigInfo(m_CommPort, "SERVER", "DmbIfPort"));
                txtDmbIfPort.Text = m_cSetupInfo.sDmbIfPort;
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                txtSignLogPort.Text = m_cSetupInfo.sSignLogPort;
                txtSysInfoPort.Text = m_cSetupInfo.sSysInfoPort;
                txtTranPort.Text = m_cSetupInfo.sTranPort;
                txtJrnlPort.Text = m_cSetupInfo.sJrnlPort;
                txtTranInqPort.Text = m_cSetupInfo.sTranInqPort;
                txtMissChkPort.Text = m_cSetupInfo.sMissChkPort;
                txtPayInqPort.Text = m_cSetupInfo.sPayInqPort;
                txtBizInqPort.Text = m_cSetupInfo.sBizInqPort;
                txtMstPort.Text = m_cSetupInfo.sMstPort;
                txtPayLogPort.Text = m_cSetupInfo.sPayLogPort;
                txtAppLogPort.Text = m_cSetupInfo.sAppLogPort;
                txtEtcTranPort.Text = m_cSetupInfo.sEtcTranPort;
                txtScaleLogPort.Text = m_cSetupInfo.sScaleLogPort;

                // Memo.txt
                using (StreamReader sr = new StreamReader(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.Memo, Encoding.UTF8))
                {
                    m_cSetupInfo.sMemo = sr.ReadToEnd();
                }

                tbMemo.Text = m_cSetupInfo.sMemo;

                //#20171227 인천공항 포스연동 start, phj
                m_cSetupInfo.IncheonAirportIP = CmUtil.StringNullEmpty(GetConfigInfo(m_IncheonAirPort, "INCHEONAIRPORT", "AirportIP"));
                m_cSetupInfo.IncheonAirportUser = CmUtil.StringNullEmpty(GetConfigInfo(m_IncheonAirPort, "INCHEONAIRPORT", "AirportUser"));
                m_cSetupInfo.IncheonAirportPass = CmUtil.StringNullEmpty(GetConfigInfo(m_IncheonAirPort, "INCHEONAIRPORT", "AirportPass"));
                m_cSetupInfo.IncheonAirportComp = CmUtil.StringNullEmpty(GetConfigInfo(m_IncheonAirPort, "INCHEONAIRPORT", "AirportComp"));
                m_cSetupInfo.IncheonAirportStore = CmUtil.StringNullEmpty(GetConfigInfo(m_IncheonAirPort, "INCHEONAIRPORT", "AirportStore"));
                m_cSetupInfo.IncheonAirportPosNo = CmUtil.StringNullEmpty(GetConfigInfo(m_IncheonAirPort, "INCHEONAIRPORT", "AirportPosNo"));

                csmAirportIP.Text = m_cSetupInfo.IncheonAirportIP;
                csmAirportUser.Text = m_cSetupInfo.IncheonAirportUser;
                csmAirportPass.Text = m_cSetupInfo.IncheonAirportPass;
                csmAirportComp.Text = m_cSetupInfo.IncheonAirportComp;
                csmAirportStore.Text = m_cSetupInfo.IncheonAirportStore;
                csmAirportPosNo.Text = m_cSetupInfo.IncheonAirportPosNo;
                //#20171227 인천공항 포스연동 end, phj


                //#20180322 휴게소pos매출연동 start,phj

                m_cSetupInfo.RestAreaPosDir = CmUtil.StringNullEmpty(GetConfigInfo(m_RestAreaPos, "RESTAREAPOS", "RestAreaPosDir"));
                m_cSetupInfo.RestAreaPosGroupCd = CmUtil.StringNullEmpty(GetConfigInfo(m_RestAreaPos, "RESTAREAPOS", "RestAreaPosGroupCd"));
                m_cSetupInfo.RestAreaPosPosGroupCd = CmUtil.StringNullEmpty(GetConfigInfo(m_RestAreaPos, "RESTAREAPOS", "RestAreaPosPosGroupCd"));
                m_cSetupInfo.RestAreaPosCd = CmUtil.StringNullEmpty(GetConfigInfo(m_RestAreaPos, "RESTAREAPOS", "RestAreaPosCd"));
                m_cSetupInfo.RestAreaPosPosNo = CmUtil.StringNullEmpty(GetConfigInfo(m_RestAreaPos, "RESTAREAPOS", "RestAreaPosPosNo"));

                
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                //기존
                //if (m_cSetupInfo.RestAreaPosDir == "" || m_cSetupInfo.RestAreaPosGroupCd == "" || m_cSetupInfo.RestAreaPosPosGroupCd == "" ||
                //변경
                if (m_cSetupInfo.RestAreaPosGroupCd == "" || m_cSetupInfo.RestAreaPosPosGroupCd == "" ||
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj
                    m_cSetupInfo.RestAreaPosCd == "" || m_cSetupInfo.RestAreaPosPosNo == "")
                {
                    FileCheck(BaseCom.NxIniPath, PosConst.INI_FILE_NAME.RestAreaPos);

                    m_RestAreaPos = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.RestAreaPos);

                    //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                    //if (m_cSetupInfo.RestAreaPosDir.Trim() == "")
                    //{
                    //    m_cSetupInfo.RestAreaPosDir = @"C:\eRest_SPC\Sals\";
                    //    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosDir", m_cSetupInfo.RestAreaPosDir.Trim());
                    //}
                    //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj

                    if (m_cSetupInfo.RestAreaPosGroupCd.Trim() == "")
                    {
                        m_cSetupInfo.RestAreaPosGroupCd = "000";
                        m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosGroupCd", m_cSetupInfo.RestAreaPosGroupCd.PadLeft(3, '0').Trim());
                    }

                    if (m_cSetupInfo.RestAreaPosPosGroupCd.Trim() == "")
                    {
                        m_cSetupInfo.RestAreaPosPosGroupCd = "00";
                        m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosPosGroupCd", m_cSetupInfo.RestAreaPosPosGroupCd.PadLeft(2, '0').Trim());
                    }

                    //
                    if (m_cSetupInfo.RestAreaPosCd.Trim() == "")
                    {
                        //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                        m_cSetupInfo.RestAreaPosCd = m_cSetupInfo.sStorCd;
                        //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj
                        m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosCd", m_cSetupInfo.RestAreaPosCd.PadLeft(7, '0').Trim());
                    }

                    if (m_cSetupInfo.RestAreaPosPosNo.Trim() == "")
                    {
                        //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                        m_cSetupInfo.RestAreaPosPosNo = m_cSetupInfo.sPosNo;
                        //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj
                        m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosPosNo", m_cSetupInfo.RestAreaPosPosNo.PadLeft(4, '0').Trim());
                    }

                    //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                    //기존
                    //DirectoryCreate(m_cSetupInfo.RestAreaPosDir);
                    //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj

                    m_RestAreaPos.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.RestAreaPos);
                }

                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                if (m_cSetupInfo.RestAreaPosDir.Trim() != "")
                {
                    DirectoryCreate(m_cSetupInfo.RestAreaPosDir.Trim());
                }
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj


                Edt_RestAreaDir.Text = m_cSetupInfo.RestAreaPosDir.Trim();
                Edt_RestAreaGroupCd.Text = m_cSetupInfo.RestAreaPosGroupCd.Trim();
                Edt_RestAreaPosGroupCd.Text = m_cSetupInfo.RestAreaPosPosGroupCd.Trim();
                Edt_RestAreaPosCd.Text = m_cSetupInfo.RestAreaPosCd.Trim();
                Edt_RestAreaPosPosNo.Text = m_cSetupInfo.RestAreaPosPosNo.Trim();

                //#20180322 휴게소pos매출연동 end,phj
            }
            catch (Exception ex) { }
        }

        //#20180322 휴게소pos매출연동 start,phj
        private bool FileCheck(string pDir, string pFileName)
        {
            bool bRet = true;

            try
            {
                if (System.IO.File.Exists(pDir + pFileName) == false)
                {
                    // 파일 존재 안함
                    FileInfo file = new FileInfo(pDir + pFileName);
                    if (!file.Exists)
                    {
                        FileStream fs = file.Create();
                        TextWriter tw = new StreamWriter(fs);
                        tw.WriteLine("<MESSAGE>");
                        tw.WriteLine("</MESSAGE>");
                        tw.Close();
                        fs.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                bRet = false;
            }

            return bRet;
        }
        //#20180322 휴게소pos매출연동 end,phj


        //#20180322 휴게소pos매출연동 start,phj
        private void DirectoryCreate(string pDir)
        {
            try
            {
                // 해당 경로에 해당 하는 폴더가 없으면 만들어 줌 
                if (Directory.Exists(pDir) == false)
                {
                    //DirectoryInfo di = new DirectoryInfo(pDir);
                    //if (!di.Exists)
                    //{
                    //    di.Create();
                    //}
                    Directory.CreateDirectory(pDir);
                }
            }
            catch (Exception ex) { }
        }
        //#20180322 휴게소pos매출연동 end,phj

        private string SaveSetupInfo()
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                //#20180322 휴게소pos매출연동 start,phj
                
                //기존
                /*
                //#20171227 인천공항 포스연동 start, phj
                //파일 체크. 없으면 빈파일 생성. 
                //빈파일이라도 없으면 쓸 때 에러남. 
                if (!System.IO.File.Exists(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.IncheonAirPort))
                {
                    // 파일 존재 안함
                    FileInfo file = new FileInfo(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.IncheonAirPort);
                    if (!file.Exists)
                    {
                        FileStream fs = file.Create();
                        TextWriter tw = new StreamWriter(fs);
                        tw.WriteLine("<MESSAGE>");
                        tw.WriteLine("</MESSAGE>");
                        tw.Close();
                        fs.Close();
                    }
                }
                //#20171227 인천공항 포스연동 end, phj
                */
                //변경
                FileCheck(BaseCom.NxIniPath, PosConst.INI_FILE_NAME.IncheonAirPort);

                //#20180322 휴게소pos매출연동 end,phj


                //#20180322 휴게소pos매출연동 start,phj
                FileCheck(BaseCom.NxIniPath, PosConst.INI_FILE_NAME.RestAreaPos);
                //#20180322 휴게소pos매출연동 end,phj



                CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
                CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                CmMessage m_PosDevice = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosDevice);
                CmMessage m_CommPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort);
                //#20171227 인천공항 포스연동 start, phj
                CmMessage m_IncheonAirPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.IncheonAirPort);
                //#20171227 인천공항 포스연동 end, phj

                //#20180322 휴게소pos매출연동 start,phj
                CmMessage m_RestAreaPos = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.RestAreaPos);
                //#20180322 휴게소pos매출연동 end,phj

                // PosConfig.INI
                m_cSetupInfo.sCmpCd = txtCmpCd.Text.Trim();
                m_cSetupInfo.sBrandDiv = txtBrandDiv.Text.Trim();
                m_cSetupInfo.sBrandCd = txtBrandCd.Text.Trim();
                m_cSetupInfo.sStorCd = txtStorCd.Text.Trim();
                m_cSetupInfo.sPosNo = txtPosNo.Text.Trim();
                if (cbLogLevel.Text.Trim() != "")
                    m_cSetupInfo.sLogLevel = (cbLogLevel.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sMasterDown = rbMstDownYes.Checked ? "1" : "0";

                m_cSetupInfo.sCountryCd = txtCountryCd.Text.Trim();
                m_cSetupInfo.sCultureCd = txtCultureId.Text.Trim();
                m_cSetupInfo.sFont = txtFont.Text.Trim();
                m_cSetupInfo.sFontFix = txtFontFix.Text.Trim();

                m_cSetupInfo.sCommSvrIp = txtCommSvrIp.Text.Trim();
                m_cSetupInfo.sFtpConnType = rbActiveMode.Checked ? "0" : "1";

                m_cSetupInfo.sSource = UserLog.UserAES.StaticKeyEncrypt(txtLocalSource.Text.Trim());
                m_cSetupInfo.sCatalog = UserLog.UserAES.StaticKeyEncrypt(txtLocalCatalog.Text.Trim());
                m_cSetupInfo.sId = UserLog.UserAES.StaticKeyEncrypt(txtLocalUserId.Text.Trim());
                m_cSetupInfo.sPassword = UserLog.UserAES.StaticKeyEncrypt(txtPassword.Text.Trim());

                m_cSetupInfo.sTextLogoMsg1 = txtTextLogoMsg1.Text.Trim();
                m_cSetupInfo.sTextLogoMsg2 = txtTextLogoMsg2.Text.Trim();

                if (CmUtil.LenH(m_cSetupInfo.sTextLogoMsg1) > 42 || CmUtil.LenH(m_cSetupInfo.sTextLogoMsg2) > 42)
                {
                    return sRet;
                }

                m_cSetupInfo.sLogoUpload = cbLogoUpload.Text.Substring(0, 1);

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                m_cSetupInfo.sDmbIf = cbDmbIfUseFlag.Text.Substring(0, 1);
                m_cSetupInfo.sDmbSvrIp = txtDmbIfIp.Text.Trim();

                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("DmbIf", m_cSetupInfo.sDmbIf);
                m_PosConfig.GetMessage("SERVER").MakeMessageOverWrite("DmbSvrIp", m_cSetupInfo.sDmbSvrIp);
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("CmpCd", m_cSetupInfo.sCmpCd);
                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("BrandDiv", m_cSetupInfo.sBrandDiv);
                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("BrandCd", m_cSetupInfo.sBrandCd);
                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("StoreNo", m_cSetupInfo.sStorCd);
                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("PosNo", m_cSetupInfo.sPosNo);
                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("LogLevel", m_cSetupInfo.sLogLevel);
                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("MasterDown", m_cSetupInfo.sMasterDown);

                m_PosConfig.GetMessage("POS").MakeMessageOverWrite("LogoUpload", m_cSetupInfo.sLogoUpload);

                m_PosConfig.GetMessage("DATABASE").MakeMessageOverWrite("LocalSource", m_cSetupInfo.sSource);
                m_PosConfig.GetMessage("DATABASE").MakeMessageOverWrite("LocalCatalog", m_cSetupInfo.sCatalog);
                m_PosConfig.GetMessage("DATABASE").MakeMessageOverWrite("LocalUserID", m_cSetupInfo.sId);
                m_PosConfig.GetMessage("DATABASE").MakeMessageOverWrite("LocalPassword", m_cSetupInfo.sPassword);

                m_PosConfig.GetMessage("GLOBAL").MakeMessageOverWrite("CultureID", m_cSetupInfo.sCultureCd);
                m_PosConfig.GetMessage("GLOBAL").MakeMessageOverWrite("Country", m_cSetupInfo.sCountryCd);
                m_PosConfig.GetMessage("GLOBAL").MakeMessageOverWrite("Font", m_cSetupInfo.sFont);
                m_PosConfig.GetMessage("GLOBAL").MakeMessageOverWrite("FontFix", m_cSetupInfo.sFontFix);

                m_PosConfig.GetMessage("SERVER").MakeMessageOverWrite("CommSvrIp", m_cSetupInfo.sCommSvrIp);
                m_PosConfig.GetMessage("SERVER").MakeMessageOverWrite("FtpConnType", m_cSetupInfo.sFtpConnType);

                m_PosConfig.GetMessage("PRINT").MakeMessageOverWrite("TextLogoMsg1", m_cSetupInfo.sTextLogoMsg1);
                m_PosConfig.GetMessage("PRINT").MakeMessageOverWrite("TextLogoMsg2", m_cSetupInfo.sTextLogoMsg2);

                // PosSaleInfo.INI
                if (cbOpenClose.Text.Trim() != "")
                    m_cSetupInfo.sSaleOpenClose = (cbOpenClose.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sSaleDt = txtSaleDt.Text.Trim();
                m_cSetupInfo.sOpenDT = txtOpenDt.Text.Trim();
                m_cSetupInfo.sCloseDT = txtCloseDt.Text.Trim();
                m_cSetupInfo.sPgmVer = txtPgmVer.Text.Trim();
                m_cSetupInfo.sPgmVerSeq = txtPgmVerSeq.Text.Trim();
                m_cSetupInfo.sMstDownDT = txtMstDownYYYY.Text.Trim() + txtMstDownMM.Text.Trim() + txtMstDownDD.Text.Trim()
                                          + txtMstDownHH.Text.Trim() + txtMstDownMI.Text.Trim() + txtMstDownSS.Text.Trim();

                m_cSetupInfo.sMstBatchDownDT = txtMstBatchDownYYYY.Text.Trim() + txtMstBatchDownMM.Text.Trim() + txtMstBatchDownDD.Text.Trim()
                                               + txtMstBatchDownHH.Text.Trim() + txtMstBatchDownMI.Text.Trim() + txtMstBatchDownSS.Text.Trim();
                m_cSetupInfo.sRegularNotice = txtRegularYYYY.Text.Trim() + txtRegularMM.Text.Trim() + txtRegularDD.Text.Trim()
                                              + txtRegularHH.Text.Trim() + txtRegularMI.Text.Trim() + txtRegularSS.Text.Trim();
                m_cSetupInfo.sEmergencyNotice = txtEmergencyYYYY.Text.Trim() + txtEmergencyMM.Text.Trim() + txtEmergencyDD.Text.Trim()
                                              + txtEmergencyHH.Text.Trim() + txtEmergencyMI.Text.Trim() + txtEmergencySS.Text.Trim();
                m_cSetupInfo.sSaleNotice1 = txtSale1YYYY.Text.Trim() + txtSale1MM.Text.Trim() + txtSale1DD.Text.Trim()
                                            + txtSale1HH.Text.Trim() + txtSale1MI.Text.Trim() + txtSale1SS.Text.Trim();
                m_cSetupInfo.sSaleNotice2 = txtSale2YYYY.Text.Trim() + txtSale2MM.Text.Trim() + txtSale2DD.Text.Trim()
                                            + txtSale2HH.Text.Trim() + txtSale2MI.Text.Trim() + txtSale2SS.Text.Trim();
                //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
                m_cSetupInfo.sNewProductUpdateDate = txtNewPrdUpYYYY.Text.Trim() + txtNewPrdUpMM.Text.Trim() + txtNewPrdUpDD.Text.Trim()
                                            + txtNewPrdUpHH.Text.Trim() + txtNewPrdUpMI.Text.Trim() + txtNewPrdUpSS.Text.Trim();

                if (chkImageAllReDownload.Checked == true)
                    m_cSetupInfo.sIMAGE_ALL_REDOWN_YN = "1";
                else
                    m_cSetupInfo.sIMAGE_ALL_REDOWN_YN = "0";

                m_cSetupInfo.sTradeNo = txtTradeNo.Text.Trim();
                m_cSetupInfo.sRegNo = txtRegNo.Text.Trim();
                m_cSetupInfo.sMsgSeqNo = txtMsgSeqNo.Text.Trim();

                m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("OpenClose", m_cSetupInfo.sSaleOpenClose);
                m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("SaleDate", m_cSetupInfo.sSaleDt);
                m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("OpenDateTime", m_cSetupInfo.sOpenDT);
                m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("CloseDateTime", m_cSetupInfo.sCloseDT);
                m_PosConfig.GetMessage("PGMVER").MakeMessageOverWrite("ProgramVer10", m_cSetupInfo.sPgmVer);
                m_PosConfig.GetMessage("PGMVER").MakeMessageOverWrite("ProgramVerSeq10", m_cSetupInfo.sPgmVerSeq);
                m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("MstDownDate", m_cSetupInfo.sMstDownDT);

                m_PosSaleInfo.GetMessage("POSOPEN").MakeMessageOverWrite("IMAGE_ALL_REDOWN_YN", m_cSetupInfo.sIMAGE_ALL_REDOWN_YN);

                m_PosSaleInfo.GetMessage("MSGNO").MakeMessageOverWrite("TradeNo", m_cSetupInfo.sTradeNo);
                m_PosSaleInfo.GetMessage("MSGNO").MakeMessageOverWrite("RegNo", m_cSetupInfo.sRegNo);
                m_PosSaleInfo.GetMessage("MSGNO").MakeMessageOverWrite("MsgSeqNo", m_cSetupInfo.sMsgSeqNo);

                m_PosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("MstBatchDownDate", m_cSetupInfo.sMstBatchDownDT);
                m_PosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("RegularNoticeUpdDate", m_cSetupInfo.sRegularNotice);
                m_PosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("EmergencyNoticeUpdDate", m_cSetupInfo.sEmergencyNotice);
                m_PosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("SaleNoticeUpdDate1", m_cSetupInfo.sSaleNotice1);
                m_PosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("SaleNoticeUpdDate2", m_cSetupInfo.sSaleNotice2);
                //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
                m_PosSaleInfo.GetMessage("CHECKOVER").MakeMessageOverWrite("NewProductUpdDate", m_cSetupInfo.sNewProductUpdateDate);

                // PosDevice.INI
                if (cbPrinterUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sPrtUseFlag = (cbPrinterUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                if (cbPrinterController.Text.Trim() != "")
                    m_cSetupInfo.sPrtController = (cbPrinterController.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sPrtPortNo = cbPrinterPortNo.Text.Trim();
                m_cSetupInfo.sPrtBaudrate = cbPrinterBaudRate.Text.Trim();
                if (cbPrinterModel.Text.Trim() != "")
                    m_cSetupInfo.sPrtModel = (cbPrinterModel.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];

                //#20171212 프린터 상태 체크 여부 추가 start
                //0: 체크, 1: 체크안함
                if (CheckPrinter.Checked == true)
                    m_cSetupInfo.sPrtChk = "1";
                else
                    m_cSetupInfo.sPrtChk = "0";
                //#20171212 프린터 상태 체크 여부 추가 end

                if (cbSignPadUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sSignPadUseFlag = (cbSignPadUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sSignPadPortNo = cbSignPadPortNo.Text.Trim();
                m_cSetupInfo.sSignPadBaudrate = cbSignPadBaudRate.Text.Trim();
                if (cbSignPadModel.Text.Trim() != "")
                    m_cSetupInfo.sSignPadModel = (cbSignPadModel.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sSignPadAutoflag = txtSignPadAutoFlag.Text.Trim();
                m_cSetupInfo.sSignPadMinCnt = txtSignPadMinCnt.Text.Trim();
                m_cSetupInfo.sSignPadTimeout = txtSignPadTimeout.Text.Trim();

                if (cbCDUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sCDUseFlag = (cbCDUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                if (cbCDController.Text.Trim() != "")
                    m_cSetupInfo.sCDController = (cbCDController.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sCDPortNo = cbCDPortNo.Text.Trim();
                m_cSetupInfo.sCDBaudrate = cbCDBaudRate.Text.Trim();

                if (cbScaleUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sScaleUseFlag = (cbScaleUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sScalePortNo = cbScalePortNo.Text.Trim();
                m_cSetupInfo.sScaleBaudrate = cbScaleBaudRate.Text.Trim();

                if (cbScalewPoleUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sScalewPoleUseFlag = (cbScalewPoleUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sScalewPolePortNo = cbScalewPolePortNo.Text.Trim();
                m_cSetupInfo.sScalewPoleBaudrate = cbScalewPoleBaudRate.Text.Trim();

                if (cbIcReaderUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sIcReaderUseFlag = (cbIcReaderUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sIcReaderPortNo = cbIcReaderPortNo.Text.Trim();
                m_cSetupInfo.sIcReaderBaudrate = cbIcReaderBaudRate.Text.Trim();

                if (cbCatUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sCatUseFlag = (cbCatUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sCatPortNo = cbCatPortNo.Text.Trim();
                m_cSetupInfo.sCatBaudrate = cbCatBaudRate.Text.Trim();
                if (cbCatModel.Text.Trim() != "")
                    m_cSetupInfo.sCatModel = (cbCatModel.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sCatTimeout = cbCatTimeout.Text.Trim();

                if (cbLabelPrtUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sLabelPrtUseFlag = (cbLabelPrtUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sLabelPrtPortNo = cbLabelPrtPortNo.Text.Trim();
                m_cSetupInfo.sLabelPrtBaudrate = cbLabelPrtBaudRate.Text.Trim();

                if (cbCdpUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sCdpUseFlag = (cbCdpUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                if (cbCdpController.Text.Trim() != "")
                    m_cSetupInfo.sCdpController = (cbCdpController.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sCdpPortNo = cbCdpPortNo.Text.Trim();
                m_cSetupInfo.sCdpBaudrate = cbCdpBaudRate.Text.Trim();
                if (cbCdpModel.Text.Trim() != "")
                    m_cSetupInfo.sCdpModel = (cbCdpModel.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];

                if(cbMSREmulUseFlag.Text.Trim() != "")
                    m_cSetupInfo.sMSREmulUseFlag = (cbMSREmulUseFlag.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                if(cbMSREmulController.Text.Trim() != "")
                    m_cSetupInfo.sMSREmulController = (cbMSREmulController.Text.Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))[0];
                m_cSetupInfo.sMSREmulPortNo = cbMSREmulPortNo.Text.Trim();
                m_cSetupInfo.sMSREmulBaudrate = cbMSREmulBaudRate.Text.Trim();
                m_cSetupInfo.sMSREmulModel = cbMSREmulModel.Text.Trim();
                if(cbMSREmulPrefix.SelectedIndex == 0)
                {
                    m_cSetupInfo.sMSREmulStx = ";";
                    m_cSetupInfo.sMSREmulEtx = "?";
                }
                else
                {
                    m_cSetupInfo.sMSREmulStx = "?";
                    m_cSetupInfo.sMSREmulEtx = "";
                }

                m_PosDevice.GetMessage("POSPRINTER").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sPrtUseFlag);
                m_PosDevice.GetMessage("POSPRINTER").MakeMessageOverWrite("Controller", m_cSetupInfo.sPrtController);
                m_PosDevice.GetMessage("POSPRINTER").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sPrtPortNo);
                m_PosDevice.GetMessage("POSPRINTER").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sPrtBaudrate);
                m_PosDevice.GetMessage("POSPRINTER").MakeMessageOverWrite("Model", m_cSetupInfo.sPrtModel);

                //#20171212 프린터 상태 체크 여부 추가 start
                //0: 체크, 1: 체크안함
                m_PosDevice.GetMessage("POSPRINTER").MakeMessageOverWrite("CheckPrinter", m_cSetupInfo.sPrtChk);
                //#20171212 프린터 상태 체크 여부 추가 end

                #region MSR에뮬 O2MSR.Conf 파일 Write
                bool bRtn = false;

                // MSR에뮬 O2MSR.Conf 파일 존재 유무 체크
                //if (File.Exists(BaseCom.NxBinPath + PosConst.INI_FILE_NAME.O2MSRConfig) == true)
                //{
                    bRtn = WinAPI.WritePrivateProfileString(PosConst.O2MSR_CONFIG.APPNAME,
                                                            PosConst.O2MSR_CONFIG.COMPORT,
                                                            m_cSetupInfo.sMSREmulPortNo,
                                                            BaseCom.NxBinPath + PosConst.INI_FILE_NAME.O2MSRConfig);

                    if (bRtn == false)
                    {
                        UserLog.WriteLogFile(UserCom.LOG_ERROR,
                                             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 (함수명))
                                             PosConst.INI_FILE_NAME.O2MSRConfig + "/" + PosConst.O2MSR_CONFIG.COMPORT + " 쓰기 실패");
                    }

                    bRtn = WinAPI.WritePrivateProfileString(PosConst.O2MSR_CONFIG.APPNAME,
                                                            PosConst.O2MSR_CONFIG.BAUDRATE,
                                                            m_cSetupInfo.sMSREmulBaudrate,
                                                            BaseCom.NxBinPath + PosConst.INI_FILE_NAME.O2MSRConfig);

                    if (bRtn == false)
                    {
                        UserLog.WriteLogFile(UserCom.LOG_ERROR,
                                             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 (함수명))
                                             PosConst.INI_FILE_NAME.O2MSRConfig + "/" + PosConst.O2MSR_CONFIG.BAUDRATE + " 쓰기 실패");
                    }

                    bRtn = WinAPI.WritePrivateProfileString(PosConst.O2MSR_CONFIG.APPNAME,
                                                            PosConst.O2MSR_CONFIG.MODEL,
                                                            m_cSetupInfo.sMSREmulModel,
                                                            BaseCom.NxBinPath + PosConst.INI_FILE_NAME.O2MSRConfig);

                    if (bRtn == false)
                    {
                        UserLog.WriteLogFile(UserCom.LOG_ERROR,
                                             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 (함수명))
                                             PosConst.INI_FILE_NAME.O2MSRConfig + "/" + PosConst.O2MSR_CONFIG.MODEL + " 쓰기 실패");
                    }
                //}
                #endregion MSR에뮬 O2MSR.Conf 파일 Write

                // Printer 연결유형이 OPOS 라면
                //if (m_cSetupInfo.sPrtController == "2")
                //{
                //    string defaultPosPrinter = "";

                //    foreach (var key in PosConst.POS_DEVICE_LIST.POS_PRINTER.htSvcOPOS.Keys)
                //    {
                //        if (key.ToString() == m_cSetupInfo.sPrtModel)
                //        {
                //            defaultPosPrinter = PosConst.POS_DEVICE_LIST.POS_PRINTER.htSvcOPOS[key].ToString();
                //            break;
                //        }
                //    }

                //    bool bRet = CmUtil.SetRegistryString("HKEY_LOCAL_MACHINE", @"\SOFTWARE\OLEforRetail\ServiceOPOS\POSPRINTER", "DefaultPosPrinter", defaultPosPrinter);
                //    if (bRet == false)
                //    {
                //        return sRet;
                //    }
                //}
                //// Cashdrawer 연결유형이 OPOS 라면
                //if (m_cSetupInfo.sCDController == "2")
                //{
                //    string defaultCashDrawer = "";

                //    defaultCashDrawer = PosConst.POS_DEVICE_LIST.CASHDRAWER.SvcOPOS;

                //    bool bRet = CmUtil.SetRegistryString("HKEY_LOCAL_MACHINE", @"\SOFTWARE\OLEforRetail\ServiceOPOS\CashDrawer", "DefaultCashDrawer", defaultCashDrawer);
                //    if (bRet == false)
                //    {
                //        return sRet;
                //    }
                //}

                m_PosDevice.GetMessage("ICREADER").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sIcReaderUseFlag);
                m_PosDevice.GetMessage("ICREADER").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sIcReaderPortNo);
                m_PosDevice.GetMessage("ICREADER").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sIcReaderBaudrate);

                m_PosDevice.GetMessage("CATTERMINAL").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sCatUseFlag);
                m_PosDevice.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sCatPortNo);
                m_PosDevice.GetMessage("CATTERMINAL").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sCatBaudrate);
                m_PosDevice.GetMessage("CATTERMINAL").MakeMessageOverWrite("Model", m_cSetupInfo.sCatModel);
                m_PosDevice.GetMessage("CATTERMINAL").MakeMessageOverWrite("TimeOut", m_cSetupInfo.sCatTimeout);

                m_PosDevice.GetMessage("CASHDRAWER").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sCDUseFlag);
                m_PosDevice.GetMessage("CASHDRAWER").MakeMessageOverWrite("CashDrawerType", m_cSetupInfo.sCDController);
                m_PosDevice.GetMessage("CASHDRAWER").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sCDPortNo);
                m_PosDevice.GetMessage("CASHDRAWER").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sCDBaudrate);

                m_PosDevice.GetMessage("SCALE").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sScaleUseFlag);
                m_PosDevice.GetMessage("SCALE").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sScalePortNo);
                m_PosDevice.GetMessage("SCALE").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sScaleBaudrate);

                m_PosDevice.GetMessage("SCALEPOLEDISP").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sScalewPoleUseFlag);
                m_PosDevice.GetMessage("SCALEPOLEDISP").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sScalewPolePortNo);
                m_PosDevice.GetMessage("SCALEPOLEDISP").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sScalewPoleBaudrate);

                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sSignPadUseFlag);
                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sSignPadPortNo);
                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sSignPadBaudrate);
                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("Model", m_cSetupInfo.sSignPadModel);
                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("AutoFlag", m_cSetupInfo.sSignPadAutoflag);
                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("MinCnt", m_cSetupInfo.sSignPadMinCnt);
                m_PosDevice.GetMessage("SIGNPAD").MakeMessageOverWrite("TimeOut", m_cSetupInfo.sSignPadTimeout);

                m_PosDevice.GetMessage("LABELPRINTER").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sLabelPrtUseFlag);
                m_PosDevice.GetMessage("LABELPRINTER").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sLabelPrtPortNo);
                m_PosDevice.GetMessage("LABELPRINTER").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sLabelPrtBaudrate);

                m_PosDevice.GetMessage("CDP").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sCdpUseFlag);
                m_PosDevice.GetMessage("CDP").MakeMessageOverWrite("Controller", m_cSetupInfo.sCdpController);
                m_PosDevice.GetMessage("CDP").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sCdpPortNo);
                m_PosDevice.GetMessage("CDP").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sCdpBaudrate);
                m_PosDevice.GetMessage("CDP").MakeMessageOverWrite("Model", m_cSetupInfo.sCdpModel);

                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("UseFlag", m_cSetupInfo.sMSREmulUseFlag);
                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("Controller", m_cSetupInfo.sMSREmulController);
                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("SerialPortNumber", m_cSetupInfo.sMSREmulPortNo);
                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("SerialBaudRate", m_cSetupInfo.sMSREmulBaudrate);
                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("Model", m_cSetupInfo.sMSREmulModel);
                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("STX", m_cSetupInfo.sMSREmulStx);
                m_PosDevice.GetMessage("MSR").MakeMessageOverWrite("ETX", m_cSetupInfo.sMSREmulEtx);

                // CommPort.INI
                m_cSetupInfo.sSignLogPort = txtSignLogPort.Text.Trim();
                m_cSetupInfo.sSysInfoPort = txtSysInfoPort.Text.Trim();
                m_cSetupInfo.sTranPort = txtTranPort.Text.Trim();
                m_cSetupInfo.sJrnlPort = txtJrnlPort.Text.Trim();
                m_cSetupInfo.sTranInqPort = txtTranInqPort.Text.Trim();
                m_cSetupInfo.sMissChkPort = txtMissChkPort.Text.Trim();
                m_cSetupInfo.sPayInqPort = txtPayInqPort.Text.Trim();
                m_cSetupInfo.sBizInqPort = txtBizInqPort.Text.Trim();
                m_cSetupInfo.sMstPort = txtMstPort.Text.Trim();
                m_cSetupInfo.sPayLogPort = txtPayLogPort.Text.Trim();
                m_cSetupInfo.sAppLogPort = txtAppLogPort.Text.Trim();
                m_cSetupInfo.sEtcTranPort = txtEtcTranPort.Text.Trim();
                m_cSetupInfo.sScaleLogPort = txtScaleLogPort.Text.Trim();

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                m_cSetupInfo.sDmbIfPort = txtDmbIfPort.Text.Trim();

                if (m_cSetupInfo.sDmbIfPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("DmbIfPort", m_cSetupInfo.sDmbIfPort);
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                if (m_cSetupInfo.sSignLogPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("SignLogPort", m_cSetupInfo.sSignLogPort);
                if (m_cSetupInfo.sSysInfoPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("SysInfoPort", m_cSetupInfo.sSysInfoPort);
                if (m_cSetupInfo.sTranPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("TranPort", m_cSetupInfo.sTranPort);
                if (m_cSetupInfo.sJrnlPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("JrnlPort", m_cSetupInfo.sJrnlPort);
                if (m_cSetupInfo.sTranInqPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("TranInqPort", m_cSetupInfo.sTranInqPort);
                if (m_cSetupInfo.sMissChkPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("MissChkPort", m_cSetupInfo.sMissChkPort);
                if (m_cSetupInfo.sPayInqPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("PayInqPort", m_cSetupInfo.sPayInqPort);
                if (m_cSetupInfo.sBizInqPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("BizInqPort", m_cSetupInfo.sBizInqPort);
                if (m_cSetupInfo.sMstPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("MstPort", m_cSetupInfo.sMstPort);
                if (m_cSetupInfo.sPayLogPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("PayLogPort", m_cSetupInfo.sPayLogPort);
                if (m_cSetupInfo.sAppLogPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("AppLogPort", m_cSetupInfo.sAppLogPort);
                if (m_cSetupInfo.sEtcTranPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("EtcTranPort", m_cSetupInfo.sEtcTranPort);
                if (m_cSetupInfo.sScaleLogPort != "")
                    m_CommPort.GetMessage("SERVER").MakeMessageOverWrite("ScaleLogPort", m_cSetupInfo.sScaleLogPort);

                // Memo.txt
                m_cSetupInfo.sMemo = tbMemo.Text;

                //#20171227 인천공항 포스연동 start, phj
                m_cSetupInfo.IncheonAirportIP = csmAirportIP.Text;
                m_cSetupInfo.IncheonAirportUser = csmAirportUser.Text;
                m_cSetupInfo.IncheonAirportPass = csmAirportPass.Text;
                m_cSetupInfo.IncheonAirportComp = csmAirportComp.Text;
                m_cSetupInfo.IncheonAirportStore = csmAirportStore.Text;
                m_cSetupInfo.IncheonAirportPosNo = csmAirportPosNo.Text;

                if (m_cSetupInfo.IncheonAirportIP != "")
                    m_IncheonAirPort.GetMessage("INCHEONAIRPORT").MakeMessageOverWrite("AirportIP", m_cSetupInfo.IncheonAirportIP);
                if (m_cSetupInfo.IncheonAirportUser != "")
                    m_IncheonAirPort.GetMessage("INCHEONAIRPORT").MakeMessageOverWrite("AirportUser", m_cSetupInfo.IncheonAirportUser);
                if (m_cSetupInfo.IncheonAirportPass != "")
                    m_IncheonAirPort.GetMessage("INCHEONAIRPORT").MakeMessageOverWrite("AirportPass", m_cSetupInfo.IncheonAirportPass);
                if (m_cSetupInfo.IncheonAirportComp != "")
                    m_IncheonAirPort.GetMessage("INCHEONAIRPORT").MakeMessageOverWrite("AirportComp", m_cSetupInfo.IncheonAirportComp);
                if (m_cSetupInfo.IncheonAirportStore != "")
                    m_IncheonAirPort.GetMessage("INCHEONAIRPORT").MakeMessageOverWrite("AirportStore", m_cSetupInfo.IncheonAirportStore);
                if (m_cSetupInfo.IncheonAirportPosNo != "")
                    m_IncheonAirPort.GetMessage("INCHEONAIRPORT").MakeMessageOverWrite("AirportPosNo", m_cSetupInfo.IncheonAirportPosNo);
                //#20171227 인천공항 포스연동 end, phj


                //#20180322 휴게소pos매출연동 start,phj
                string sRestAreaDir = string.Empty;
                string sRestAreaPosGroupCd = string.Empty;
                string sRestAreaPosPosGroupCd = string.Empty;
                string sRestAreaPosCd = string.Empty;
                string sRestAreaPosPosNo = string.Empty;

                sRestAreaDir = Edt_RestAreaDir.Text.Trim();
                sRestAreaPosGroupCd = Edt_RestAreaGroupCd.Text.Trim();
                sRestAreaPosPosGroupCd = Edt_RestAreaPosGroupCd.Text.Trim();
                sRestAreaPosCd = Edt_RestAreaPosCd.Text.Trim();
                sRestAreaPosPosNo = Edt_RestAreaPosPosNo.Text.Trim();

                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                //기존
                //if ((sRestAreaDir.EndsWith(@"/") || sRestAreaDir.EndsWith(@"\")) != true)
                //변경
                if ((sRestAreaDir != "") && (sRestAreaDir.EndsWith(@"/") || sRestAreaDir.EndsWith(@"\")) != true)
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj
                {
                    sRestAreaDir += @"\";
                }


                m_cSetupInfo.RestAreaPosDir = sRestAreaDir.Trim();
                m_cSetupInfo.RestAreaPosGroupCd = sRestAreaPosGroupCd.Trim();
                m_cSetupInfo.RestAreaPosPosGroupCd = sRestAreaPosPosGroupCd.Trim();
                m_cSetupInfo.RestAreaPosCd = sRestAreaPosCd.Trim();
                m_cSetupInfo.RestAreaPosPosNo = sRestAreaPosPosNo.Trim();

                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                /*
                // 파일 저장경로 폴더 생성
                DirectoryCreate(m_cSetupInfo.RestAreaPosDir);
                */
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj

                if (m_cSetupInfo.RestAreaPosDir.Trim() != "")
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosDir", m_cSetupInfo.RestAreaPosDir.Trim());

                    //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                    DirectoryCreate(m_cSetupInfo.RestAreaPosDir.Trim()); 
                    //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj
                }
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 start,phj
                /*
                else
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosDir", @"C:\eRest_SPC\Sals\");
                }
                */
                //#20180410 휴게소매출 경로 없을 경우 자동생성 안함 end,phj

                if (m_cSetupInfo.RestAreaPosGroupCd.Trim() != "")
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosGroupCd", m_cSetupInfo.RestAreaPosGroupCd.PadLeft(3, '0').Trim());
                }
                else
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosGroupCd", "000");
                }

                if (m_cSetupInfo.RestAreaPosPosGroupCd.Trim() != "")
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosPosGroupCd", m_cSetupInfo.RestAreaPosPosGroupCd.PadLeft(2, '0').Trim());
                }
                else
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosPosGroupCd", "00");
                }

                //
                if (m_cSetupInfo.RestAreaPosCd.Trim() != "")
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosCd", m_cSetupInfo.RestAreaPosCd.PadLeft(7, '0').Trim());
                }
                else
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosCd", m_cSetupInfo.sStorCd.PadLeft(7, '0').Trim());
                }

                if (m_cSetupInfo.RestAreaPosPosNo.Trim() != "")
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosPosNo", m_cSetupInfo.RestAreaPosPosNo.PadLeft(4, '0').Trim());
                }
                else
                {
                    m_RestAreaPos.GetMessage("RESTAREAPOS").MakeMessageOverWrite("RestAreaPosPosNo", m_cSetupInfo.sPosNo.PadLeft(4, '0').Trim());
                }
                //#20180322 휴게소pos매출연동 end,phj


                // 파일저장
                m_PosConfig.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
                m_PosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                m_PosDevice.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosDevice);
                m_CommPort.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort);
                //#20171227 인천공항 포스연동 start, phj
                m_IncheonAirPort.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.IncheonAirPort);
                //#20171227 인천공항 포스연동 end, phj

                //#20180322 휴게소pos매출연동 start,phj
                m_RestAreaPos.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.RestAreaPos);
                //#20180322 휴게소pos매출연동 end,phj

                using (StreamWriter sw = new StreamWriter(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.Memo, false, Encoding.UTF8))
                {
                    sw.Write(m_cSetupInfo.sMemo);
                    sw.Flush();
                }

                sRet = UserCom.RST_OK;
            }
            catch (Exception ex) { }

            return sRet;
        }

        private void truncateTranTable()
        {
            IDatabaseSQL cDatabaseSql = null;
            try
            {
                cDatabaseSql = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);

                ArrayList sqlList = new ArrayList();
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_BR_POPUP");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_HOLD_HISTORY");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_INTEGRITY_LOG");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_NOTICE_MNG");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_RESERV_INFO");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_CPI_RSLT");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_DETAIL");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_DPST_WTHDR");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_ETC");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_GUESTCNT");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_HEADER");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_JOURNAL");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SALE_PAY");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_SCALE_LOG");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_STOR_EQU_CHECK_DETAIL");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_STOR_EQU_CHECK_LIST");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_STOR_INSPCT_ANSWR");
                sqlList.Add("TRUNCATE TABLE POSLOG..ETC_STOR_INSPCT_ANSWR_STOR");
                sqlList.Add("TRUNCATE TABLE POSLOG..LOG_SALE_IF");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_CASHIER_TEST");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_P_BOX_DTPER_STOCK");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_RESERV_INFO");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_ADMT");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_ADMT_CHECK");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_APPR_LOG");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_CPI_RSLT");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_DC");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_DETAIL");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_ETC");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_GUESTCNT");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_HEADER");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_JOURNAL");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_PAY");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_SALE_SIGN_LOG");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_STOR_BBS");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_STOR_EMP");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_STOR_EMP_WORK");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_STORE_CLAIM");
                sqlList.Add("TRUNCATE TABLE POSLOG..TR_STORE_VISIT");
                sqlList.Add("TRUNCATE TABLE POSLOG..TUTORIAL_TGT");
                sqlList.Add("UPDATE POSMST..MST_TBL " +
                            "   SET TBL_USE_DIV = '0' " +
                            "     , CUST_CNT = 0 " +
                            "     , FIRST_ORD_HOUR = '' " +
                            "     , ORD_AMT = 0 " +
                            "     , TBL_OP_DIV = '0' " +
                            "     , OP_FLOOR_CD = '' " +
                            "     , OP_TBL_NO = '' " +
                            "     , PAY_CMPT_DIV = '' " +
                            "     , FILLER1 = '' " +
                            "     , FILLER2 = '' " +
                            "     , FILLER3 = '' " +
                            " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' " +
                            "   AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ");
                sqlList.Add("TRUNCATE TABLE POSMST..MST_ORD");
                sqlList.Add("TRUNCATE TABLE POSMST..MST_KTCH_ORD_MSG");
                sqlList.Add("TRUNCATE TABLE POSMST..MST_KTCH_ORD_MSG_ADD");
                sqlList.Add("TRUNCATE TABLE POSMST..MST_KPS_ORD_MSG");
                sqlList.Add("TRUNCATE TABLE POSMST..MST_KDS_ORD_MSG");
                sqlList.Add("TRUNCATE TABLE POSMST..MST_SEAT_MEMO");

                // DB Connect
                cDatabaseSql.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource
                                                  , m_cPosStatus.Base.LocalDbCatalog
                                                  , m_cPosStatus.Base.LocalDbUserID
                                                  , m_cPosStatus.Base.LocalDbPassword);

                foreach(string sQuery in (string[])sqlList.ToArray(typeof(string)))
                {
                    cDatabaseSql.DBExecuteNonQuery(sQuery);
                }
            }
            catch(Exception ex)
            {

            }
            finally
            {
                cDatabaseSql.Close();
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            try
            {
                if (ExeMode.Equals("POS") == false)
                {
                    if (txtCmpCd.Text.Trim() == "")
                    {
                        WinManager.ConfirmMessage("회사 코드를 설정해 주세요.");
                        return;
                    }
                    else if (txtBrandCd.Text.Trim() == "")
                    {
                        WinManager.ConfirmMessage("브랜드 코드를 설정해 주세요.");
                        return;
                    }
                    else if (txtStorCd.Text.Trim() == "")
                    {
                        WinManager.ConfirmMessage("점포 코드를 설정해 주세요.");
                        return;
                    }
                    else if (txtPosNo.Text.Trim() == "")
                    {
                        WinManager.ConfirmMessage("포스 번호를 설정해 주세요.");
                        return;
                    }
                    else if (txtSaleDt.Text.Trim() == "" || txtSaleDt.Text.Length != 8)
                    {
                        WinManager.ConfirmMessage("영업 일자를 설정해 주세요.");
                        return;
                    }
                }

                if (bSaveEvent == true)
                {
                    //저장 값이 있으면 서버 전송
                    SetConfigToServer();
                }

                this.Close();
            }
            catch (Exception ex) { }
        }

        private void btnTitle_Click(object sender, EventArgs e)
        {
            try
            {
                if (((Cosmos.UI.CsmButton)sender).Tag.ToString() != "")
                {
                    if (PosMenuKeyIn != ((Cosmos.UI.CsmButton)sender).Tag.ToString())
                    {
                        PosMenuKeyIn = ((Cosmos.UI.CsmButton)sender).Tag.ToString();
                        TitleDisplay();
                        MenuDisplay();
                    }
                }
            }
            catch (Exception ex) { }
        }

        private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //#20170823 프린터 모델 IBM인 경우 연결유형 OPOS로 자동으로 변경하지 않도록 변경 start
                //기존
                /*
                if (sender == (ComboBox)cbPrinterModel)
                {
                    if (((ComboBox)sender).Text.Substring(0, 1) == PosConst.POS_DEVICE_LIST.POS_PRINTER._3_IBM)
                    {
                        cbPrinterController.SelectedIndex = 1;
                    }
                    else
                    {
                        cbPrinterController.SelectedIndex = 0;
                    }
                }
                */
                //#20170823 프린터 모델 IBM인 경우 연결유형 OPOS로 자동으로 변경하지 않도록 변경 end

                CheckDisabledDevices();
            }
            catch (Exception ex) { }
        }

        // DataGridView 갱신
        private void RefreshDataGridView()
        {
            Hashtable htData = new Hashtable();
            try
            {
                m_dtBrandList.Clear();

                switch (m_SeletedCompany)
                {
                    case CompanyList.PC:
                        htData = m_htPCBrand;
                        break;
                    case CompanyList.BRK:
                        htData = m_htBRBrand;
                        break;
                    case CompanyList.SL:
                        htData = m_htSLBrand;
                        break;
                }

                for (int nLoop = 1; nLoop < htData.Count + 1; nLoop++)
                {
                    DataRow drNew = m_dtBrandList.NewRow();
                    BrandInfo bi = (BrandInfo)htData[nLoop];
                    drNew["BrandCd"] = bi.BrandCd;
                    drNew["BrandNm"] = bi.BrandNm;
                    drNew["BrandDiv"] = bi.BrandDiv;

                    m_dtBrandList.Rows.Add(drNew);
                }

                for (int nLoop = 0; nLoop < dgvBrandList.Rows.Count; nLoop++)
                {
                    dgvBrandList.Rows[nLoop].HeaderCell.Value = (nLoop + 1).ToString();
                }
                dgvBrandList.DataSource = m_dtBrandList;
                dgvBrandList.Rows[0].Selected = true;

                GuidePosInfoData(dgvBrandList.CurrentCell.RowIndex);
            }
            catch (Exception ex) { }
        }

        private void GuidePosInfoData()
        {
            GuidePosInfoData(0);
        }

        /// <summary>
        /// 점포환경-POS정보 자동 설정
        /// </summary>
        /// <param name="iSelectedRowIndex"></param>
        private void GuidePosInfoData(int iSelectedRowIndex)
        {
            BrandInfo bi;
            string sCmpCd = string.Empty;
            string sBrandDiv = string.Empty;
            string sBrandCd = string.Empty;
            try
            {
                if (m_SeletedCompany == CompanyList.PC)
                {
                    sCmpCd = "PCKR";
                    bi = (BrandInfo)m_htPCBrand[iSelectedRowIndex + 1];
                    sBrandDiv = bi.BrandDiv;
                    sBrandCd = bi.BrandCd;
                }
                else if (m_SeletedCompany == CompanyList.BRK)
                {
                    sCmpCd = "BRKR";
                    bi = (BrandInfo)m_htBRBrand[iSelectedRowIndex + 1];
                    sBrandDiv = bi.BrandDiv;
                    sBrandCd = bi.BrandCd;
                }
                else if (m_SeletedCompany == CompanyList.SL)
                {
                    sCmpCd = "SLKR";
                    bi = (BrandInfo)m_htSLBrand[iSelectedRowIndex + 1];
                    sBrandDiv = "";
                    sBrandCd = bi.BrandCd;
                }
                txtCmpCd.Text = sCmpCd;
                txtBrandDiv.Text = sBrandDiv;
                txtBrandCd.Text = sBrandCd;
            }
            catch (Exception ex) { }
        }

        private void GuideServerConfigData(bool bIsBlockingTran = false)
        {
            string sServerIp = string.Empty;
            string sSignLogPort = string.Empty;
            string sSysInfoPort = string.Empty;
            string sTranPort = string.Empty;
            string sJournalPort = string.Empty;
            string sTranInqPort = string.Empty;
            string sMissTranPort = string.Empty;
            string sPayInqPort = string.Empty;
            string sBizInqPort = string.Empty;
            string sMstPort = string.Empty;
            string sPayLogPort = string.Empty;
            string sAppLogPort = string.Empty;
            string sEtcTranPort = string.Empty;
            string sScaleLogPort = string.Empty;

            try
            {                
                if (rbRealServer.Checked == true)
                {
                    if (txtCmpCd.Text.Equals("PCKR"))
                    {
                        sServerIp = "121.254.240.90";
                    }
                    else if (txtCmpCd.Text.Equals("BRKR"))
                    {
                        sServerIp = "121.254.240.91";
                    }
                    else if (txtCmpCd.Text.Equals("SLKR"))
                    {
                        sServerIp = "121.254.240.106";
                    }
                    sSignLogPort = "9006";
                    sSysInfoPort = "9011";
                    sTranPort = "9012";
                    sJournalPort = "9013";
                    sTranInqPort = "9014";
                    sMissTranPort = "9014";
                    sPayInqPort = "9018";
                    sBizInqPort = "9019";
                    sMstPort = "9020";
                    sPayLogPort = "9014";
                    sAppLogPort = "9017";
                    sEtcTranPort = "9024";
                    sScaleLogPort = "9015";
                }
                else if (rbDevServer.Checked == true)
                {
                    if (txtCmpCd.Text.Equals("PCKR"))
                    {
                        sServerIp = "10.0.40.134";
                        sSignLogPort = "9006";
                        sSysInfoPort = "9011";
                        sTranPort = "9012";
                        sJournalPort = "9013";
                        sTranInqPort = "9014";
                        sMissTranPort = "9014";
                        sPayInqPort = "9018";
                        sBizInqPort = "9019";
                        sMstPort = "9020";
                        sPayLogPort = "9014";
                        sAppLogPort = "9017";
                        sEtcTranPort = "9024";
                        sScaleLogPort = "9015";
                    }
                    else if (txtCmpCd.Text.Equals("BRKR"))
                    {
                        sServerIp = "10.0.40.134";
                        sSignLogPort = "9006";
                        sSysInfoPort = "9041";
                        sTranPort = "9042";
                        sJournalPort = "9043";
                        sTranInqPort = "9044";
                        sMissTranPort = "9044";
                        sPayInqPort = "9048";
                        sBizInqPort = "9049";
                        sMstPort = "9050";
                        sPayLogPort = "9044";
                        sAppLogPort = "9047";
                        sEtcTranPort = "9054";
                        sScaleLogPort = "9045";
                    }
                    else if (txtCmpCd.Text.Equals("SLKR"))
                    {
                        sServerIp = "10.0.40.134";
                        sSignLogPort = "9006";
                        sSysInfoPort = "9071";
                        sTranPort = "9072";
                        sJournalPort = "9073";
                        sTranInqPort = "9074";
                        sMissTranPort = "9074";
                        sPayInqPort = "9078";
                        sBizInqPort = "9079";
                        sMstPort = "9080";
                        sPayLogPort = "9074";
                        sAppLogPort = "9077";
                        sEtcTranPort = "9084";
                        sScaleLogPort = "9075";
                    }
                }

                if (bIsBlockingTran == false)
                { 
                    txtCommSvrIp.Text = sServerIp;
                    txtSignLogPort.Text = sSignLogPort;
                    txtSysInfoPort.Text = sSysInfoPort;
                    txtTranPort.Text = sTranPort;
                    txtJrnlPort.Text = sJournalPort;
                    txtTranInqPort.Text = sTranInqPort;
                    txtMissChkPort.Text = sMissTranPort;
                    txtPayInqPort.Text = sPayInqPort;
                    txtBizInqPort.Text = sBizInqPort;
                    txtMstPort.Text = sMstPort;
                    txtPayLogPort.Text = sPayLogPort;
                    txtAppLogPort.Text = sAppLogPort;
                    txtEtcTranPort.Text = sEtcTranPort;
                    txtScaleLogPort.Text = sScaleLogPort;
                }
                else
                {
                    txtCommSvrIp.Text = sServerIp;
                    txtSignLogPort.Text = "0";
                    txtSysInfoPort.Text = sSysInfoPort;
                    txtTranPort.Text = "0";
                    txtJrnlPort.Text = "0";
                    txtTranInqPort.Text = sTranInqPort;
                    txtMissChkPort.Text = sMissTranPort;
                    txtPayInqPort.Text = sPayInqPort;
                    txtBizInqPort.Text = sBizInqPort;
                    txtMstPort.Text = sMstPort;
                    txtPayLogPort.Text = "0";
                    txtAppLogPort.Text = "0";
                    txtEtcTranPort.Text = "0";
                    txtScaleLogPort.Text = "0";
                }
            }
            catch (Exception ex) { }
        }

        private void GuideDataRcvInfo()
        {
            try
            {
                // 마스터
                txtMstDownYYYY.Text = "2000";
                txtMstDownMM.Text = "01";
                txtMstDownDD.Text = "01";
                txtMstDownHH.Text = "00";
                txtMstDownMI.Text = "00";
                txtMstDownSS.Text = "00";
                // 마스터 배치
                txtMstBatchDownYYYY.Text = "2000";
                txtMstBatchDownMM.Text = "01";
                txtMstBatchDownDD.Text = "01";
                txtMstBatchDownHH.Text = "00";
                txtMstBatchDownMI.Text = "00";
                txtMstBatchDownSS.Text = "00";
                // 일반공지
                txtRegularYYYY.Text = "2000";
                txtRegularMM.Text = "01";
                txtRegularDD.Text = "01";
                txtRegularHH.Text = "00";
                txtRegularMI.Text = "00";
                txtRegularSS.Text = "00";
                // 긴급공지
                txtEmergencyYYYY.Text = "2000";
                txtEmergencyMM.Text = "01";
                txtEmergencyDD.Text = "01";
                txtEmergencyHH.Text = "00";
                txtEmergencyMI.Text = "00";
                txtEmergencySS.Text = "00";
                // 영업공지1
                txtSale1YYYY.Text = "2000";
                txtSale1MM.Text = "01";
                txtSale1DD.Text = "01";
                txtSale1HH.Text = "00";
                txtSale1MI.Text = "00";
                txtSale1SS.Text = "00";
                // 영업공지2
                txtSale2YYYY.Text = "2000";
                txtSale2MM.Text = "01";
                txtSale2DD.Text = "01";
                txtSale2HH.Text = "00";
                txtSale2MI.Text = "00";
                txtSale2SS.Text = "00";
                //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
                txtNewPrdUpYYYY.Text = "2000";
                txtNewPrdUpMM.Text = "01";
                txtNewPrdUpDD.Text = "01";
                txtNewPrdUpHH.Text = "00";
                txtNewPrdUpMI.Text = "00";
                txtNewPrdUpSS.Text = "00";

                chkImageAllReDownload.Checked = true;
            }
            catch (Exception ex) { }
        }

        private void CompanyRadioButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender == rbPc)          // PC
                {
                    m_SeletedCompany = CompanyList.PC;
                }
                else if (sender == rbBrk)    // BRK
                {
                    m_SeletedCompany = CompanyList.BRK;
                }
                else if (sender == rbSl)     // SL
                {
                    m_SeletedCompany = CompanyList.SL;
                }

                RefreshDataGridView();
            }
            catch (Exception ex) { }
        }



        private void dgvBrandList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                GuidePosInfoData(dgvBrandList.CurrentCell.RowIndex);
            }
            catch (Exception ex) { }
        }

        private void SvrEnvironment_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                GuideServerConfigData();
            }
            catch (Exception ex) { }
        }

        // 데이터 거래정보 초기화 버튼
        private void btnInitDataRcvInfo_Click(object sender, EventArgs e)
        {
            try
            {
                GuideDataRcvInfo();
            }
            catch (Exception ex) { }
        }

        private void lblTitle_MouseDown(object sender, MouseEventArgs e)
        {
            // 단독으로 실행되었을 경우에만 폼 이동 가능
            if (ExeMode.Equals("POS") == true) return;
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                MouseDownLocation = e.Location;
            }
        }

        private void lblTitle_MouseMove(object sender, MouseEventArgs e)
        {
            // 단독으로 실행되었을 경우에만 폼 이동 가능
            if (ExeMode.Equals("POS") == true) return;
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                this.Left = e.X + this.Left - MouseDownLocation.X;
                this.Top = e.Y + this.Top - MouseDownLocation.Y;
            }
        }

        #region 사인패드/CAT단말기 검색 추가 시작 - 문성진D(20170331)
        
        #region Event 함수
        private static byte MakeSignPad_LRC(byte[] data, int len)
        {
            byte LRC = 0;

            if (data == null || len == 0)
            {
                return LRC;
            }

            for (int i = 1; i <= len - 1; i++)
            {
                LRC = (byte)(LRC ^ data[i]);
            }

            return LRC;
        }

        private void GetSignPadInfoEx(int intRecSize, ref int nDataLength, ref int copyindex, ref byte cCommandID, ref byte[] buff)
        {
            int stxidx;
            byte[] tempbyte = new byte[BUFFER_SIZE];
            if (!FSTX)
            {
                for (stxidx = 0; stxidx < intRecSize; stxidx++)
                {
                    if (buff[stxidx] == STX)
                    {
                        FSTX = true;
                        break;
                    }
                }

                Array.Copy(buff, stxidx, RcvBuf, RcvBufIdex, intRecSize - stxidx);
                RcvBufIdex = intRecSize - stxidx;
            }
            else
            {
                Array.Copy(buff, 0, RcvBuf, RcvBufIdex, intRecSize);
                RcvBufIdex += intRecSize;
            }

            for (int i = RcvBufIdex - 1; i > RcvBufIdex - intRecSize; i--)
            {
                if (i < 0)
                {
                    break;
                }

                if (RcvBuf[i] == ETX)
                {
                    if (i == (RcvBufIdex - 1))
                    {
                        break;
                    }
                    if (RcvBuf[i + 1] == MakeSignPad_LRC(RcvBuf, i + 1))
                    {
                        //메모리 해제
                        Array.Clear(tempbyte, 0, tempbyte.Length);

                        //cCommandID = BitConverter.ToChar(buff, 3);
                        cCommandID = TransBuf[3];
                        nDataLength = (RcvBuf[1] << 2) + RcvBuf[2] - 2;

                        if (nDataLength > 0)
                        {
                            if (cCommandID == CI_VER)
                            {
                                Array.Copy(RcvBuf, 4, tempbyte, 0, nDataLength);

                                copyindex += 30;
                                FKernel = System.Text.Encoding.Default.GetString(tempbyte, 0, copyindex);

                                FRFVersion = System.Text.Encoding.Default.GetString(tempbyte, copyindex, 30);
                                copyindex += 30;

                                FAppVersion = System.Text.Encoding.Default.GetString(tempbyte, copyindex, 30);
                                copyindex += 30;

                                FSerial = System.Text.Encoding.Default.GetString(tempbyte, copyindex, 30);
                                copyindex += 30;

                                FModelType = System.Text.Encoding.Default.GetString(tempbyte, copyindex, 1);
                                copyindex += 1;


                                //    pn90.Visible = true;


                                /*
                                 lbl_1.Text = cbSignPadUseFlag.SelectedItem.ToString();
                                 lbl_sign_modeltype.Text = FModelType;
                                 lbl_sign_kernel.Text = FKernel;
                                 lbl_sign_rfversion.Text = FRFVersion;
                                 lbl_sign_appversion.Text = FAppVersion;
                                 lbl_sign_serialno.Text = FSerial;
                                 */

                                waitHandle.Set();
                            }
                        }
                        i = 0;
                        waitHandle.Set();
                    }
                }
            }
            
            buff = null;
        }

        private static string MakeCATDiv_LRC(byte[] data, int len)
        {
            byte LRC = 0;

            if (data == null || len == 0)
            {
                return ((char)LRC).ToString();
            }

            for (int i = 1; i <= len - 1; i++)
            {
                LRC = (byte)(LRC ^ data[i]);
            }
            LRC = (byte)(LRC | 0x20);

            return ((char)LRC).ToString();
        }
        private bool GetCatDIVInfo(int intRecSize, string strRecData, ref string sLRC)
        {
            bool result = false;
            byte[] buff;
            RcvBufIdex += intRecSize;
            catResultstr += strRecData;
            buff = Encoding.UTF8.GetBytes(catResultstr);

            if (RcvBufIdex == 1)
            {
                if (buff[0] == EOT)
                {
                    waitHandle.Set();
                    return result;
                }
            }

            if (RcvBufIdex > 1)
            {
                if (buff[RcvBufIdex - 2] == ETX)
                {
                    sLRC = MakeCATDiv_LRC(Encoding.UTF8.GetBytes(catResultstr), RcvBufIdex - 1);

                    if (sLRC == ((char)buff[RcvBufIdex - 1]).ToString())
                    {
                        string outStr = Encoding.Default.GetString(buff, 0, RcvBufIdex);

                        string[] splitStr = outStr.Split((char)FS);

                        /* lbl_cat_comport.Text = cbo_cat_comport.SelectedItem.ToString();
                        lbl_cat_divname.Text = splitStr[1];
                        lbl_cat_divver.Text = splitStr[2];
                        lbl_cat_terminalID.Text = splitStr[3];
                        lbl_cat_divserialNo.Text = splitStr[4];
                        lbl_cat_connType.Text = ConnCodeToStr(splitStr[5]);*/

                        FModelType   = splitStr[1];
                        FKernel      = splitStr[2];
                        FAppVersion  = splitStr[3];
                        FSerial      = splitStr[4];
                        FRFVersion   = ConnCodeToStr(splitStr[5]);


                        result = true;
                        waitHandle.Set();
                    }
                }
            }
            return result;
        }

        private string ConnCodeToStr(string ConnType)
        {
            string result = "알수없음";

            switch (ConnType)
            {
                case "01":
                    result = "전화선";
                    break;
                case "02":
                    result = "전용선";
                    break;
                case "03":
                    result = "CDMA";
                    break;
                case "04":
                    result = "LAN";
                    break;
                default:
                    result = "알수없음";
                    break;
            }

            return result;
        }

        private void sPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            int intRecSize = sPort.BytesToRead;
            int nDataLength = 0;
            int copyindex = 0;
            string strRecData;
            byte cCommandID = 0x00;
            string sLRC = string.Empty;

            if (intRecSize != 0)
            {
                strRecData = "";
                byte[] buff = new byte[intRecSize];

                sPort.Read(buff, 0, intRecSize);
                for (int iTemp = 0; iTemp < intRecSize; iTemp++)
                {
                    strRecData += Convert.ToChar(buff[iTemp]);
                }

                switch (ReadType)
                {
                    case SIGNPAD:
                        GetSignPadInfoEx(intRecSize, ref nDataLength, ref copyindex, ref cCommandID, ref buff);
                        break;
                    case CATDIV:
                        GetCatDIVInfo(intRecSize, strRecData, ref sLRC);
                        break;
                    default:
                        break;
                }
                
            }
        }


        private bool ComOpen(string comport, string baudrate)
        {
            bool result = false;
            try
            {
                if (null == sPort)
                {
                    sPort = new SerialPort();
                    sPort.DataReceived += new SerialDataReceivedEventHandler(sPort_DataReceived);

                    sPort.PortName = comport;
                    sPort.BaudRate = Convert.ToInt32(baudrate);
                    sPort.DataBits = (int)8;
                    sPort.Parity = Parity.None;
                    sPort.StopBits = StopBits.One;
                    sPort.ReadTimeout = (int)1000;
                    sPort.WriteTimeout = (int)1000;
                    sPort.Open();
                    result = true;
                }
            }
            catch (System.Exception ex)
            {
                sPort.Close();
                sPort.Dispose();
                sPort = null;
                MessageBox.Show(ex.Message);
            }
            return result;
        }

        private bool ComClose()
        {
            bool result = false;
            try
            {
                if (null != sPort)
                {
                    if (sPort.IsOpen)
                    {
                        sPort.Close();
                        sPort.Dispose();
                        sPort = null;
                        result = true;
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return result;
        }

        private bool SignSearch()
        {
            bool result = false;

            ReadType = SIGNPAD;

            Array.Clear(TransBuf, 0, TransBuf.Length);
            TransBuf[0] = STX;
            TransBuf[1] = NUL;
            TransBuf[2] = EOT;
            TransBuf[3] = CI_INIT;
            TransBuf[4] = Convert.ToByte('2');              // 0x32;
            TransBuf[5] = Convert.ToByte('7');              // 0x37;
            TransBuf[6] = ETX;
            TransBuf[7] = MakeSignPad_LRC(TransBuf, 7 + 1);

            sPort.Write(TransBuf, 0, 8);
            Thread.Sleep(100);
            if (waitHandle.WaitOne(1000))
            {
                if (FSTX)
                {
                    FSTX = false;
                    RcvBufIdex = 0;
                    Array.Clear(TransBuf, 0, TransBuf.Length);

                    TransBuf[0] = STX;
                    TransBuf[1] = NUL;
                    TransBuf[2] = STX;
                    TransBuf[3] = CI_VER;
                    TransBuf[4] = ETX;
                    TransBuf[5] = MakeSignPad_LRC(TransBuf, 5 + 1);

                    sPort.Write(TransBuf, 0, 6);
                    //waitHandle.WaitOne(1000);
                    if (waitHandle.WaitOne(1000))
                    {
                        result = true;
                    }
                }
            }

            if (!result)
            {
                // SIGNINI();
            }

            Array.Clear(RcvBuf, 0, RcvBuf.Length);
            FSTX = false;
            RcvBufIdex = 0;

            return result;
        }

        private void bt_Sign_all_Click(object sender, EventArgs e)
        {
            //
            waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            CheckForIllegalCrossThreadCalls = false;
            List<string> tempStr = new List<string>();
            cbSignPadPortNo.BeginUpdate();

            foreach (string comport in SerialPort.GetPortNames())
            {
                tempStr.Add(comport);
            }

            if (tempStr.Count > 0)
            {
                cbSignPadPortNo.Items.Clear();
                foreach (string comport in tempStr)
                {
                    cbSignPadPortNo.Items.Add(comport);
                }
                tempStr.Clear();

                cbSignPadPortNo.SelectedIndex = 0;
                cbSignPadUseFlag.SelectedIndex = 1;
                cbSignPadBaudRate.SelectedIndex = 3;
            }
            else
            {
                return;
            }

            cbSignPadPortNo.EndUpdate();

            try
            {
                for (int i = 0; i < cbSignPadPortNo.Items.Count; i++)
                {
                    cbSignPadPortNo.SelectedIndex = i;
                    if (ComOpen(cbSignPadPortNo.SelectedItem.ToString(), cbSignPadBaudRate.SelectedItem.ToString()))
                    {
                        if (SignSearch())
                        {
                            //INI입력처리

                            lbl_sign_comport.Text = cbSignPadPortNo.SelectedItem.ToString();
                            lbl_sign_modeltype.Text = FModelType;
                            lbl_sign_kernel.Text = FKernel;
                            lbl_sign_rfversion.Text = FRFVersion;
                            lbl_sign_appversion.Text = FAppVersion;
                            lbl_sign_serialno.Text = FSerial;

                            string[] splitStr = FKernel.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                            for (int iTemp = 0; iTemp < cbSignPadModel.Items.Count  ; iTemp++)
                            {
                                string[] splitStr2 = (cbSignPadModel.Items[iTemp]).ToString().Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);

                                if (splitStr[0].Equals(splitStr2[1]) ) {
                                    cbSignPadModel.SelectedIndex = iTemp;
                                }

                            }

                            SetPnini(0, true);
                            if (ComClose())
                            { }
                            break;
                        }
                        else
                        {
                        }
                    }
                    if (ComClose())
                    { }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void bt_Cat_all_Click(object sender, EventArgs e)
        {
            //
            waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            CheckForIllegalCrossThreadCalls = false;
            List<string> tempStr = new List<string>();

            cbCatPortNo.BeginUpdate();

            foreach (string comport in SerialPort.GetPortNames())
            {
                tempStr.Add(comport);
            }

            if (tempStr.Count > 0)
            {
                cbCatPortNo.Items.Clear();


                foreach (string comport in tempStr)
                {
                    cbCatPortNo.Items.Add(comport);
                }
                tempStr.Clear();

                cbCatPortNo.SelectedIndex = 0;
                cbCatUseFlag.SelectedIndex = 1;
                cbCatBaudRate.SelectedIndex = 1;
            }
            else
            {
                return;
            }

            cbCatPortNo.EndUpdate();

            try
            {
                for (int i = 0; i < cbCatPortNo.Items.Count; i++)
                {
                    cbCatPortNo.SelectedIndex = i;
                    if (ComOpen(cbCatPortNo.SelectedItem.ToString(), cbCatBaudRate.SelectedItem.ToString()))
                    {
                        if (CATSearch())
                        {
                            //INI입력처리

                            lbl_sign_comport.Text     = cbCatPortNo.SelectedItem.ToString();
                            lbl_sign_modeltype.Text   = FModelType;
                            lbl_sign_kernel.Text      = FKernel;
                            lbl_sign_rfversion.Text   = FAppVersion;
                            lbl_sign_appversion.Text  = FSerial;
                            lbl_sign_serialno.Text    = FRFVersion;

                            SetPnini(1, true);
                            if (ComClose())
                            { }
                            break;
                        }
                        else
                        {
                        }
                    }
                    if (ComClose())
                    { }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


        }

        private bool CATSearch()
        {
            bool result = false;

            catResultstr = string.Empty;
            RcvBufIdex = 0;

            ReadType = CATDIV;

            string temp = (char)STX + "Z0" + "A0" + (char)FS + (char)FS + "000000000" + "000000000" + "000000000"
                        + (char)FS + (char)FS + (char)FS + (char)FS + (char)FS + (char)FS + (char)ETX;
            temp += MakeCATDiv_LRC(System.Text.Encoding.Default.GetBytes(temp), temp.Length);

            sPort.Write(temp);
            if (waitHandle.WaitOne(2000))
            {
                sPort.Write(((char)ACK).ToString());
                result = true;
            }
            else
            {
                sPort.Write(((char)NAK).ToString());
               // CATDIVINI();
            }

            return result;
        }

        private void SetPnini(int iMode, bool bVisual)
        {
            switch (iMode)
            {
                case 0:
                    gb_info.Text = "사인패드정보";
                    lbl_2.Text = "Model Type :";
                    lbl_3.Text = "kernel :";
                    lbl_4.Text = "RF Version :";
                    lbl_5.Text = "App Version :";
                    lbl_6.Text = "Serial No :";
                    break;
                case 1:
                    gb_info.Text = "단말기정보";
                    lbl_2.Text = "단말기제품명 :";
                    lbl_3.Text = "단말기버전 :";
                    lbl_4.Text = "Terminal ID :";
                    lbl_5.Text = "단말기제품번호 :";
                    lbl_6.Text = "통신 연결 유형 :";
                    break;
                default:
                    gb_info.Text = "사인패드정보";
                    lbl_2.Text = "Model Type :";
                    lbl_3.Text = "kernel :";
                    lbl_4.Text = "RF Version :";
                    lbl_5.Text = "App Version :";
                    lbl_6.Text = "Serial No :";
                    break;
            }

            if (bVisual)
            {
                pn90.Visible = true;
            }
            else
            {
                pn90.Visible = false;
            }
        }
        #endregion

        private void btn_sign_search_Click_1(object sender, EventArgs e)
        {
            SetPnini(0, false);
        }

        private void bt_Cat_Click_1(object sender, EventArgs e)
        {
            cbCatBaudRate.SelectedIndex = 1;
            waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            CheckForIllegalCrossThreadCalls = false;
            try
            {
                if (ComOpen(cbCatPortNo.SelectedItem.ToString(), cbCatBaudRate.SelectedItem.ToString()))
                {
                    if (CATSearch())
                    {
                        //INI입력처리

                        lbl_sign_comport.Text = cbCatPortNo.SelectedItem.ToString();
                        lbl_sign_modeltype.Text = FModelType;
                        lbl_sign_kernel.Text = FKernel;
                        lbl_sign_rfversion.Text = FAppVersion;
                        lbl_sign_appversion.Text = FSerial;
                        lbl_sign_serialno.Text = FRFVersion;

                        SetPnini(1, true);
                    }
                    else
                    {
                    }
                }
                if (ComClose())
                { }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void bt_Sign_Click(object sender, EventArgs e)
        {
            waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            CheckForIllegalCrossThreadCalls = false;

            cbSignPadBaudRate.SelectedIndex = 3;

            try
            {
                if (ComOpen(cbSignPadPortNo.SelectedItem.ToString(), cbSignPadBaudRate.SelectedItem.ToString()))
                {
                    if (SignSearch())
                    {
                        //INI입력처리
                        lbl_sign_comport.Text = cbSignPadPortNo.SelectedItem.ToString();
                        lbl_sign_modeltype.Text = FModelType;
                        lbl_sign_kernel.Text = FKernel;
                        lbl_sign_rfversion.Text = FAppVersion;
                        lbl_sign_appversion.Text = FSerial;
                        lbl_sign_serialno.Text = FRFVersion;

                        string[] splitStr = FKernel.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                        for (int iTemp = 0; iTemp < cbSignPadModel.Items.Count; iTemp++)
                        {
                            string[] splitStr2 = (cbSignPadModel.Items[iTemp]).ToString().Trim().Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);

                            if (splitStr[0].Equals(splitStr2[1]))
                            {
                                cbSignPadModel.SelectedIndex = iTemp;
                            }

                        }

                        SetPnini(0, true);
                    }
                    else
                    {
                    }
                }
                if (ComClose())
                { }
            }
            catch (System.Exception ex)
            {
                ComClose();
                MessageBox.Show(ex.Message);

            }
        }
        #endregion 사인패드/CAT단말기 검색 추가 끝 - 문성진D(20170331)

        /// <summary>
        /// 기능버튼 Click 처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void funcButton_Click(object sender, EventArgs e)
        {
            try
            {
                Cosmos.UI.CsmButton cButton = (Cosmos.UI.CsmButton)sender;

                if (cButton == btnSave)
                {
                    if (SaveSetupInfo() == UserCom.RST_OK)
                    {
                        //WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0415));
                        WinManager.ConfirmMessage("저장 되었습니다.");
                        bSaveEvent = true;
                    }
                    else
                    {
                        //WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0417));
                        WinManager.ErrorMessage("저장 실패 하였습니다.");
                    }
                    GetSetupInfo();
                }
                else if (cButton == btnDefault)
                {
                    SetByDefaultCircumstance();
                }
                else if (cButton == btnLoad)
                {
                    GetConfigToServer();
                }

            }
            catch (Exception) { }
        }

        #region 환경 설정 서버 송/수신 관련 함수
        /// <summary>
        /// 환경 설정 서버 수신
        /// </summary>
        private void GetConfigToServer()
        {
            try
            {
                GetConfigBasicData();
                
                //if (m_cPosStatus.Base.CmpCd != "" && m_cPosStatus.Base.StoreNo != "" && m_cPosStatus.Base.PosNo != "" && m_cPosStatus.Base.BrandCd != "" && m_cPosStatus.Base.CommSvrIp.Trim() != "" && (int)m_cPosStatus.Base.BizInqPort != 0)
                if (m_cPosStatus.Base.CmpCd != "" && m_cPosStatus.Base.StoreNo != "" && m_cPosStatus.Base.PosNo != "" && m_cPosStatus.Base.CommSvrIp.Trim() != "" && (int)m_cPosStatus.Base.BizInqPort != 0)
                {
                    frmPosLoad frmLoad = new frmPosLoad();

                    if (frmLoad.ShowDialog() == DialogResult.OK)
                    {
                        // 리로드
                        GetSetupInfo();
                    }
                }
                else
                {
                    WinManager.ErrorMessage("점포환경(회사코드,점포코드,포스번호)\r\n통신설정(통신서버IP,업무조회PORT)\r\n설정후 복원 가능합니다.");
                }
            }
            catch (Exception) { }
        }
        /// <summary>
        /// 환경 설정 서버 송신
        /// </summary>
        private void SetConfigToServer()
        {

            try
            {

                GetConfigBasicData();

                //회사코드, 점포코드, 포스번호, 서버아이피, 서버 포트 유무 체크
                if (m_cPosStatus.Base.CmpCd != "" && m_cPosStatus.Base.StoreNo != "" && m_cPosStatus.Base.PosNo != "" && m_cPosStatus.Base.CommSvrIp.Trim() != "" && (int)m_cPosStatus.Base.BizInqPort != 0)
                    m_cPosConfig.Execute(new string[] { ItemConst.POS_CONFIG_TYPE.SAVE, "" });
            }
            catch (Exception) { }
        }
        /// <summary>
        /// Config 서버 전송 기본 데이터 로드
        /// </summary>
        private void GetConfigBasicData()
        {
            try
            {
                CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
                CmMessage cmCommPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort);

                m_cPosStatus.Base.CmpCd = CmUtil.StringNullEmpty(GetConfigInfo(cmPosConfig, "POS", "CmpCd"));
                m_cPosStatus.Base.StoreNo = CmUtil.StringNullEmpty(GetConfigInfo(cmPosConfig, "POS", "StoreNo"));
                m_cPosStatus.Base.PosNo = CmUtil.StringNullEmpty(GetConfigInfo(cmPosConfig, "POS", "PosNo"));
                m_cPosStatus.Base.CommSvrIp = CmUtil.StringNullEmpty(GetConfigInfo(cmPosConfig, "SERVER", "CommSvrIp"));
                // m_cPosStatus.Base.BrandCd = CmUtil.StringNullEmpty(GetConfigInfo(cmPosConfig, "POS", "BrandCd"));
                m_cPosStatus.Base.BizInqPort = CmUtil.LongParse(CmUtil.StringNullEmpty(GetConfigInfo(cmCommPort, "SERVER", "BizInqPort")));
            }
            catch (Exception) { }
        }
        #endregion

        private void SetByDefaultCircumstance()
        {
            try
            {
                if (PosMenuKeyIn == "01")        // 점포환경
                {
                    #region 01 - POS 정보
                    // LOGO 업로드
                    cbLogoUpload.SelectedIndex = 0;     // 0:No
                    // 로그레벨
                    cbLogLevel.SelectedIndex = 0;       // 0:Error
                    #endregion 01 - POS 정보

                    #region 02 - DB 설정
                    // DB Source
                    txtLocalSource.Text = @"localhost\SPCPOS";
                    // DB Catalog
                    txtLocalCatalog.Text = @"POSMST";
                    // DB ID
                    txtLocalUserId.Text = @"sa";
                    // DB Password
                    txtPassword.Text = @"@spcPOS!123";
                    #endregion 02 - DB 설정

                    #region 03 - 글로벌
                    // 언어코드
                    txtCountryCd.Text = @"ko-KR";
                    // 문화코드
                    txtCultureId.Text = @"MC002";
                    // 폰트
                    txtFont.Text = @"맑은 고딕";
                    // 고정너비 폰트
                    txtFontFix.Text = @"굴림체";
                    #endregion 03 - 글로벌

                    #region 04 - 명판 텍스트 등록
                    // 명판 텍스트 1
                    txtTextLogoMsg1.Text = @"";
                    // 명판 텍스트 2
                    txtTextLogoMsg2.Text = @"";
                    #endregion 04 - 명판 텍스트 등록
                }
                else if (PosMenuKeyIn == "02")   // 거래정보
                {
                    #region 01 - 영업 정보
                    // 영업개시
                    cbOpenClose.SelectedIndex = 0;
                    // 영업일자
                    txtSaleDt.Text = System.DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
                    // 개설일시
                    txtOpenDt.Text = "";
                    // 마감일시
                    txtCloseDt.Text = "";
                    // PGM 버전
                    txtPgmVer.Text = "";
                    // PGM 버전Seq
                    txtPgmVerSeq.Text = "";
                    #endregion 01 - 영업 정보

                    #region 02 - 데이터 수신 정보
                    GuideDataRcvInfo();
                    #endregion 02 - 데이터 수신 정보

                    #region 03 - 메시지 번호
                    // 거래 번호
                    txtTradeNo.Text = "00001";
                    // 등록 번호
                    txtRegNo.Text = "00001";
                    // 메시지 Seq No
                    txtMsgSeqNo.Text = "000001";
                    #endregion 03 - 메시지 번호

                    #region 04 - 이미지 전체 재수신 여부
                    chkImageAllReDownload.Checked = true;
                    #endregion
                }
                else if (PosMenuKeyIn == "03")   // 포스장비
                {
                    #region ## 영수증 프린터
                    cbPrinterUseFlag.SelectedIndex = 1;         // 사용
                    cbPrinterController.SelectedIndex = 0;      // RS232
                    cbPrinterPortNo.Text = "COM1";              // COM1
                    cbPrinterBaudRate.Text = "19200";           // 19200
                    cbPrinterModel.Text = ComboBoxConst.POSPrinter_Model.CB_LIST_PrinterModel[0];   // "1:EPSON"
                    #endregion ## 영수증 프린터
                    #region ## IC Reader
                    cbIcReaderUseFlag.SelectedIndex = 1;        // 사용
                    cbIcReaderPortNo.Text = "COM3";             // COM3
                    cbIcReaderBaudRate.Text = "115200";         // 115200
                    #endregion ## IC Reader
                    #region ## 저울
                    cbScaleUseFlag.SelectedIndex = 0;           // 사용 안 함
                    cbScalePortNo.Text = "COM6";                // COM6
                    cbScaleBaudRate.Text = "2400";              // 2400
                    #endregion ## 저울
                    #region ## 사인패드
                    cbSignPadUseFlag.SelectedIndex = 1;         // 사용
                    cbSignPadPortNo.Text = "COM2";              // COM2
                    cbSignPadBaudRate.Text = "38400";           // 38400
                    cbSignPadModel.Text = ComboBoxConst.Signpad_Model.CB_LIST_SignpadModel[4];      // "5:SN-150P"
                    // 전자서명 자동 완료 설정
                    txtSignPadAutoFlag.Text = "1";
                    // 전자서명 최소입력 카운트
                    txtSignPadMinCnt.Text = "3";
                    // 전자서명 입력 타임아웃(sec)
                    txtSignPadTimeout.Text = "30";
                    #endregion ## 사인패드
                    #region ## 돈통
                    cbCDUseFlag.SelectedIndex = 1;              // 사용
                    cbCDController.SelectedIndex = 0;           // 프린터
                    cbCDPortNo.Text = "";
                    cbCDBaudRate.Text = "";
                    #endregion ##돈통
                    #region ## 저울(POLE Device)
                    cbScalewPoleUseFlag.SelectedIndex = 0;      // 사용 안 함
                    cbScalewPolePortNo.Text = "COM5";           // COM5
                    cbScalewPoleBaudRate.Text = "2400";         // 2400
                    #endregion ## 저울(POLE Device)
                    #region ## CAT 단말기
                    cbCatUseFlag.SelectedIndex = 0;             // 사용 안 함
                    cbCatPortNo.Text = "COM6";                  // COM6
                    cbCatBaudRate.Text = "38400";               // 38400
                    cbCatModel.Text = ComboBoxConst.CATTerminal_Model.CB_LIST_CATTerminalModel[0];  // "11:국내"
                    cbCatTimeout.Text = "3";                    // 3초
                    #endregion ## CAT 단말기
                    #region ## CDP
                    cbCdpUseFlag.SelectedIndex = 0;             // 사용 안 함
                    cbCdpController.SelectedIndex = 0;          // RS232
                    cbCdpPortNo.Text = "";
                    cbCdpBaudRate.Text = "";
                    cbCdpModel.SelectedIndex = 0;               // Toshiba
                    #endregion ## CDP
                    #region ## 라벨 프린터
                    cbLabelPrtUseFlag.SelectedIndex = 0;        // 사용 안 함
                    cbLabelPrtPortNo.Text = "COM4";             // COM4
                    cbLabelPrtBaudRate.Text = "115200";         // 115200
                    #endregion ## 라벨 프린터
                }
                else if (PosMenuKeyIn == "04")   // 통신설정
                {
                    #region 01 - 마스터 수신
                    // 마스터 수신
                    rbMstDownYes.Checked = true;    // 마스터 수신
                    #endregion 01 - 마스터 수신

                    #region 02 - FTP 접속 방식
                    // FTP 접속 방식
                    rbPassiveMode.Checked = true;   // Passive 모드
                    #endregion 02 - FTP 접속 방식

                    #region 03 - 서버 환경
                    // 서버 환경
                    rbDevServer.Checked = true;     // 개발기
                    #endregion 03 - 서버 환경
                }
            }
            catch (Exception ex)
            {

            }
        }

        private void btnBlock_Click(object sender, EventArgs e)
        {
            try
            {
                GuideServerConfigData(true);
            }
            catch(Exception ex)
            {

            }
        }

        private void btnTruncate_Click(object sender, EventArgs e)
        {
            try
            {
                frmPosConfigurationSecu frmPassword = new frmPosConfigurationSecu();

                frmPassword.Owner = this;
                frmPassword.PasswordMode = "TRUNCATE";
                if (ExeMode.Equals("POS") == true)
                {
                    frmPassword.TopLevel = true;
                    frmPassword.TopMost = true;
                }
                DialogResult drRtn = frmPassword.ShowDialog();

                // 비밀번호 입력에 실패했을 경우엔 종료
                if (drRtn != DialogResult.OK)
                {
                    return;
                }

                truncateTranTable();
            }
            catch(Exception ex)
            {

            }
        }

        private void bt_IcReader_all_Click(object sender, EventArgs e)
        {
            //
            waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            CheckForIllegalCrossThreadCalls = false;
            List<string> tempStr = new List<string>();
            cbIcReaderPortNo.BeginUpdate();

            foreach (string comport in SerialPort.GetPortNames())
            {
                tempStr.Add(comport);
            }

            if (tempStr.Count > 0)
            {
                cbIcReaderPortNo.Items.Clear();
                foreach (string comport in tempStr)
                {
                    cbIcReaderPortNo.Items.Add(comport);
                }
                tempStr.Clear();

                cbIcReaderPortNo.SelectedIndex = 0;
                cbIcReaderUseFlag.SelectedIndex = 1;
                cbIcReaderBaudRate.SelectedIndex = 4;
            }
            else
            {
                return;
            }

            cbIcReaderPortNo.EndUpdate();
        }

        //#20180528 라벨프린터 설정에 검색기능 추가 start
        private void bt_Lblprt_all_Click(object sender, EventArgs e)
        {
            waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            CheckForIllegalCrossThreadCalls = false;
            List<string> tempStr = new List<string>();
            cbLabelPrtPortNo.BeginUpdate();

            foreach (string comport in SerialPort.GetPortNames())
            {
                tempStr.Add(comport);
            }

            if (tempStr.Count > 0)
            {
                cbLabelPrtPortNo.Items.Clear();
                foreach (string comport in tempStr)
                {
                    cbLabelPrtPortNo.Items.Add(comport);
                }
                tempStr.Clear();

                cbLabelPrtPortNo.SelectedIndex = 0;
                cbLabelPrtUseFlag.SelectedIndex = 1;
                cbLabelPrtBaudRate.SelectedIndex = 4;
            }
            else
            {
                return;
            }

            cbLabelPrtPortNo.EndUpdate();

        }
        //#20180528 라벨프린터 설정에 검색기능 추가 end
    }

    public class SETUP_INFO
    {
        /// <summary>
        /// PosConfig.INI
        /// </summary>
        public string sCmpCd;
        public string sBrandDiv;
        public string sBrandCd;
        public string sStorCd;
        public string sPosNo;
        public string sDesignType;
        public string sThemeType;
        public string sLogLevel;
        public string sCommSvrIp;
        public string sFtpConnType;
        public string sCountryCd;
        public string sCultureCd;
        public string sFont;
        public string sFontFix;
        public string sSource;
        public string sCatalog;
        public string sId;
        public string sPassword;
        public string sTextLogoMsg1;
        public string sTextLogoMsg2;
        public string sLogoUpload;
        public string sMasterDown;

        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
        public string sDmbIf;
        public string sDmbSvrIp;
        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

        /// <summary>
        /// PosSaleInfo.INI
        /// </summary>
        public string sSaleOpenClose;
        public string sSaleDt;
        public string sOpenDT;
        public string sCloseDT;
        public string sMstDownDT;
        public string sPgmVer;
        public string sPgmVerSeq;
        public string sMstBatchDownDT;
        public string sRegularNotice;
        public string sEmergencyNotice;
        public string sSaleNotice1;
        public string sSaleNotice2;
        public string sNewProductUpdateDate; //  2019-03-21 - 1997fx11 : Kiosk 관련 신상품 마지막업데이트일자 추가
        public string sTradeNo;
        public string sRegNo;
        public string sMsgSeqNo;
        public string sIMAGE_ALL_REDOWN_YN;
        /// <summary>
        /// PosDevice.INI
        /// </summary>
        public string sPrtUseFlag;
        public string sPrtController;
        public string sPrtPortNo;
        public string sPrtBaudrate;
        public string sPrtModel;
        //#20171212 프린터 상태 체크 여부 추가 start
        //0: 체크, 1: 체크안함
        public string sPrtChk;
        //#20171212 프린터 상태 체크 여부 추가 end
        public string sIcReaderUseFlag;
        public string sIcReaderPortNo;
        public string sIcReaderBaudrate;
        public string sCatUseFlag;
        public string sCatPortNo;
        public string sCatBaudrate;
        public string sCatModel;
        public string sCatTimeout;
        public string sCDUseFlag;
        public string sCDController;
        public string sCDPortNo;
        public string sCDBaudrate;
        public string sScaleUseFlag;
        public string sScalePortNo;
        public string sScaleBaudrate;
        public string sScalewPoleUseFlag;
        public string sScalewPolePortNo;
        public string sScalewPoleBaudrate;
        public string sSignPadUseFlag;
        public string sSignPadPortNo;
        public string sSignPadBaudrate;
        public string sSignPadModel;
        public string sSignPadAutoflag;
        public string sSignPadMinCnt;
        public string sSignPadTimeout;
        public string sLabelPrtUseFlag;
        public string sLabelPrtPortNo;
        public string sLabelPrtBaudrate;
        public string sCdpUseFlag;
        public string sCdpController;
        public string sCdpPortNo;
        public string sCdpBaudrate;
        public string sCdpModel;
        public string sMSREmulUseFlag;
        public string sMSREmulController;
        public string sMSREmulPortNo;
        public string sMSREmulBaudrate;
        public string sMSREmulStx;
        public string sMSREmulEtx;
        public string sMSREmulModel;
        /// <summary>
        /// CommPort.INI
        /// </summary>
        public string sSignLogPort;
        public string sSysInfoPort;
        public string sTranPort;
        public string sJrnlPort;
        public string sTranInqPort;
        public string sMissChkPort;
        public string sPayInqPort;
        public string sBizInqPort;
        public string sMstPort;
        public string sPayLogPort;
        public string sAppLogPort;
        public string sEtcTranPort;
        public string sScaleLogPort;

        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
        public string sDmbIfPort;
        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

        /// <summary>
        /// Memo.txt
        /// </summary>
        public string sMemo;

        //#20171227 인천공항 포스연동 start, phj
        /// <summary>
        /// IncheonAirport.ini
        /// </summary>
        public string IncheonAirportIP;
        public string IncheonAirportUser;
        public string IncheonAirportPass;
        public string IncheonAirportComp;
        public string IncheonAirportStore;
        public string IncheonAirportPosNo;
        //#20171227 인천공항 포스연동 end, phj


        //#20180322 휴게소pos매출연동 start,phj
        public string RestAreaPosDir;
        public string RestAreaPosGroupCd;
        public string RestAreaPosPosGroupCd;
        public string RestAreaPosCd;
        public string RestAreaPosPosNo;
        //#20180322 휴게소pos매출연동 end,phj
    }

    public class BrandInfo
    {
        private string m_BrandCd = string.Empty;
        public string BrandCd { get { return m_BrandCd; } }
        private string m_BrandNm = string.Empty;
        public string BrandNm { get { return m_BrandNm; } }
        private string m_BrandDiv = string.Empty;
        public string BrandDiv { get { return m_BrandDiv; } }

        public BrandInfo(string BrandCd, string BrandNm, string BrandDiv)
        {
            this.m_BrandCd = BrandCd;
            this.m_BrandNm = BrandNm;
            this.m_BrandDiv = BrandDiv;
        }
    }
}
