using Cosmos.BaseFrame;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.ServiceProvider;
using Cosmos.UserFrame;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace Cosmos.Win
{
    public class WinPay
    {
        /// <summary>
        /// FORM 화면 표시
        /// </summary>
        /// <param name="aPara"></param>
        /// <returns></returns>
        public static string ShowForm(string[] aPara)
        {
            SManager sManager = new SManager();                                 // 이 객체를 통해 업무 Service 호출
            StateServer StateObject = (StateServer)StateServer.GetInstance();   // StateObject : StateServer Object (객체)
            PosStatus m_cPosStatus = new PosStatus();                           // 기본정보 참조
            DeviceStatus m_cDevStatus = new DeviceStatus();                     // 디바이스 관리

            string sRet = UserCom.RST_ERR;
            frmPayBackGround fBForm = null;
            m_cPosStatus = (PosStatus)StateObject.POS;      // POS 기본정보

            //---------------------------------------------------------------------------------------------
            // 주의 사항 - 반드시 0,1 배열값은 아래 값으로 고정해서 넘겨야한다!
            // aPara[0] = 스크린 아이디 (고정!)
            // aPara[1] = 기능키 코드   (고정!)
            //---------------------------------------------------------------------------------------------

            try
            {
                switch (aPara[0])
                {
                    //#20180202 인천공항 VIP 라운지 기능미사용으로 주석처리 start,phj
                    /*
                    // grayber@20180115 인천공항 VIP 라운지 start - 폼 처리 추가
                    case FormManager.FORM_AIRPORT_VIP_LOUNGE:
                        {
                            frmVipLounge fForm = (frmVipLounge)FormManager.GetForm(FormManager.FORM_AIRPORT_VIP_LOUNGE);
                            if(fForm == null)
                            {
                                fForm = new frmVipLounge();
                                FormManager.AddForm(FormManager.FORM_AIRPORT_VIP_LOUNGE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            fForm.SetPayAmt = aPara[2];
                            
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    // grayber@20180115 인천공항 VIP 라운지 end
                    */
                    //#20180202 인천공항 VIP 라운지 기능미사용으로 주석처리 end,phj

                    //grayber@20180208 코레일 마일리지 입력 start - Show Form 처리
                    case FormManager.FORM_KORAIL_MILEAGE:
                        {
                            frmKorailMileage fForm = (frmKorailMileage)FormManager.GetForm(FormManager.FORM_KORAIL_MILEAGE);
                            if(fForm == null)
                            {
                                fForm = new frmKorailMileage();
                                FormManager.AddForm(FormManager.FORM_KORAIL_MILEAGE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            fForm.SetPayAmt = aPara[2];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //grayber@20180208 코레일 마일리지 입력 end
                    
                    //#20171227 인천공항 포스연동 start, phj
                    case FormManager.FORM_INCHEONAIRPORT:
                        {
                            frmAirPortTran fForm = (frmAirPortTran)FormManager.GetForm(FormManager.FORM_INCHEONAIRPORT);
                            if (fForm == null)
                            {
                                fForm = new frmAirPortTran();
                                FormManager.AddForm(FormManager.FORM_INCHEONAIRPORT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //#20171227 인천공항 포스연동 end, phj

                    case FormManager.FORM_PAY_CASH:  //현금
                        {
                            frmCash fForm = (frmCash)FormManager.GetForm(FormManager.FORM_PAY_CASH);
                            if (fForm == null)
                            {
                                fForm = new frmCash();
                                FormManager.AddForm(FormManager.FORM_PAY_CASH, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];

                            if (aPara.Length > 2)
                            {
                                fForm.SetPayAmt = aPara[2];
                            }
                            else
                            {
                                fForm.SetPayAmt = "";
                            }
                            
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    case FormManager.FORM_PAY_POINT_HAPPY_POINT:  //해피포인트
                        {
                            //해피포인트 적립
                            if (PosMstManager.GetPosOption(POS_OPTION.OPT316) == "2")       // 해피포인트 사용 여부(0:사용안함, 1:사용함(한국), 2:사용함(중국))
                            {
                                frmPntHappyPointSave_China fForm = (frmPntHappyPointSave_China)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_SAVE_CHINA);
                                if (fForm == null)
                                {
                                    fForm = new frmPntHappyPointSave_China();
                                    FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_SAVE_CHINA, fForm);
                                }
                                fForm.SetPosMenuKey = PosKey.MENU_KEY.HAPPY_POINT_SAVE_CHINA;
                                fForm.SetHappyPointSave = aPara.Length >= 3 ? aPara[2] : "0";
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmPntHappyPoint fForm = (frmPntHappyPoint)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT);
                                if (fForm == null)
                                {
                                    fForm = new frmPntHappyPoint();
                                    FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT, fForm);
                                }
                                fForm.SetPosMenuKey = aPara[1];
                                fForm.SetHappyPointSave = aPara.Length >= 3 ? aPara[2] : "0";
                                //#20180413 웰컴카드 신규기능 추가 start,phj
                                fForm.SetClientSearch = aPara.Length >= 4 ? aPara[3] : "0";
                                //#20180413 웰컴카드 신규기능 추가 end,phj
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            break;
                        }
                    case FormManager.FORM_PAY_POINT_OCB_SAVE:       // OCB 적립
                        {
                            frmPntOcbSave fForm = (frmPntOcbSave)FormManager.GetForm(FormManager.FORM_PAY_POINT_OCB_SAVE);
                            if (fForm == null)
                            {
                                fForm = new frmPntOcbSave();
                                FormManager.AddForm(FormManager.FORM_PAY_POINT_OCB_SAVE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_POINT_MOBILE_COM:  //통신사 할인 화면 
                        {
                            //#20170810 추가적립 캠페인 적용 가능시 통신사 할인 하려고 하면 안내 팝업 start
                            //기존
                            /*
                            frmPntMobileCom fForm = (frmPntMobileCom)FormManager.GetForm(FormManager.FORM_PAY_POINT_MOBILE_COM);
                            if (fForm == null)
                            {
                                fForm = new frmPntMobileCom();
                                FormManager.AddForm(FormManager.FORM_PAY_POINT_MOBILE_COM, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                            */
                            //변경
                            frmPntMobileCom fForm = (frmPntMobileCom)FormManager.GetForm(FormManager.FORM_PAY_POINT_MOBILE_COM);
                            if (fForm == null)
                            {
                                fForm = new frmPntMobileCom();
                                FormManager.AddForm(FormManager.FORM_PAY_POINT_MOBILE_COM, fForm);
                            }

                            //#15583 캠페인 기능 개선 요청 start
                            //기존
                            /*
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            */
                            //변경
                            if (CpiCheck(FormManager.FORM_PAY_POINT_MOBILE_COM) == false)
                            {
                                break;
                            }
                            //#15583 캠페인 기능 개선 요청 end

                            // 적립불가 상품의 캠페인 성립여부 체크
                            bool bSaveCpiYN = false;

                            ArrayList alSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);

                            foreach (Column.TR_PLU.DATA cPluItem in alSaleItem)
                            {
                                if (cPluItem.alTrSaleCpi != null)
                                {
                                    foreach (Column.TR_SALE_CPI_RSLT.DATA cTrSaleCpi in cPluItem.alTrSaleCpi)
                                    {
                                        // TELECOM_COOP_DUP_PRMT_YN -> 제휴할인그룹 중복 여부(1:중복적용가능, 0:중복적용불가)
                                        // CPI_CUST_BNFT_TYPE -> 캠페인 고객해택 구분(01:할인,02:적립,03:할인+적립,04:사은품,05:복권,06:명판,07:복권+명판,08:응모권,09:응모권+명판,10:스템프,11:할인(실효100%),12:사은품+적립,13:할인(실효))
                                        if (cTrSaleCpi.TELECOM_COOP_DUP_PRMT_YN == "0" && cTrSaleCpi.CPI_CUST_BNFT_TYPE == "02")
                                        {
                                            bSaveCpiYN = true;
                                        }
                                    }
                                }
                            }

                            if (bSaveCpiYN == true)
                            {
                                if (WinManager.QuestionMessage(MessageManager.GetGuideMessage(POS_MESSAGE.GUIDE.MSG_0012)) == true)
                                {
                                    fForm.SetPosMenuKey = aPara[1];
                                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                                }
                            }
                            else
                            {
                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            break;

                            //#20170810 추가적립 캠페인 적용 가능시 통신사 할인 하려고 하면 안내 팝업 end
                        }
                    case FormManager.FORM_PAY_DC_EMP:  //SPC 임직원 할인 화면 
                        {
                            frmSPCEmployeeDC fForm = (frmSPCEmployeeDC)FormManager.GetForm(FormManager.FORM_PAY_DC_EMP);
                            if (fForm == null)
                            {
                                fForm = new frmSPCEmployeeDC();
                                FormManager.AddForm(FormManager.FORM_PAY_DC_EMP, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_DC_EMP_CHINA:  //SPC 임직원 할인 - 중국 화면 
                        {
                            frmSPCEmployeeDC_China fForm = (frmSPCEmployeeDC_China)FormManager.GetForm(FormManager.FORM_PAY_DC_EMP_CHINA);
                            if (fForm == null)
                            {
                                fForm = new frmSPCEmployeeDC_China();
                                FormManager.AddForm(FormManager.FORM_PAY_DC_EMP_CHINA, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_CREDITCARD:   //신용카드
                    case FormManager.FORM_PAY_MSR_CARD:     //신용카드 (MSR)
                        {
#if !DEVICE_MSR_VER           
                            
                            if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT024), "0") == "1")         // X-CHARGE 승인
                            {
                                frmXChargeAmt fForm = (frmXChargeAmt)FormManager.GetForm(FormManager.FORM_PAY_XCHARGE_INPUT);
                                if (fForm == null)
                                {
                                    fForm = new frmXChargeAmt();
                                    FormManager.AddForm(FormManager.FORM_PAY_XCHARGE_INPUT, fForm);
                                }

                                if (aPara.Length >= 5)
                                {
                                    fForm.SetPayAmt = aPara[4];                                     // 사용자 입력 금액
                                }

                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmCreditCard fForm = (frmCreditCard)FormManager.GetForm(FormManager.FORM_PAY_CREDITCARD);
                                if (fForm == null)
                                {
                                    fForm = new frmCreditCard();
                                    FormManager.AddForm(FormManager.FORM_PAY_CREDITCARD, fForm);
                                }
                                fForm.SetDcTy = aPara[2];       // 제휴할인 구분

                                if (aPara.Length >= 4)
                                {
                                    fForm.SetSamsungPoint = CmUtil.DoubleParse(aPara[3]);          //포인트구분
                                }

                                if (aPara.Length >= 5)
                                {
                                    fForm.SetPayAmt = aPara[4];                                     // 사용자 입력 금액
                                }

                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
#else
                            if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT024), "0") == "1")         // X-CHARGE 승인
                            {
                                frmXChargeAmt fForm = (frmXChargeAmt)FormManager.GetForm(FormManager.FORM_PAY_XCHARGE_INPUT);
                                if (fForm == null)
                                {
                                    fForm = new frmXChargeAmt();
                                    FormManager.AddForm(FormManager.FORM_PAY_XCHARGE_INPUT, fForm);
                                }
                                
                                if (aPara.Length >= 5)
                                {
                                    fForm.SetPayAmt = aPara[4];                                     // 사용자 입력 금액
                                }

                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else if (m_cDevStatus.ICReader.UseYn == true)         // 여전법 인증여부(0:MSR, 1:IC)
                            {
                                frmCreditCard fForm = (frmCreditCard)FormManager.GetForm(FormManager.FORM_PAY_CREDITCARD);
                                if (fForm == null)
                                {
                                    fForm = new frmCreditCard();
                                    FormManager.AddForm(FormManager.FORM_PAY_CREDITCARD, fForm);
                                }
                                fForm.SetDcTy = aPara[2];       // 제휴할인 구분

                                if (aPara.Length >= 4)
                                {
                                    fForm.SetSamsungPoint = CmUtil.DoubleParse(aPara[3]);          //포인트구분
                                }

                                if (aPara.Length >= 5)
                                {
                                    fForm.SetPayAmt = aPara[4];                                     // 사용자 입력 금액
                                }

                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmMSRCard fForm = (frmMSRCard)FormManager.GetForm(FormManager.FORM_PAY_MSR_CARD);
                                if (fForm == null)
                                {
                                    fForm = new frmMSRCard();
                                    FormManager.AddForm(FormManager.FORM_PAY_MSR_CARD, fForm);
                                }
                                fForm.SetDcTy = aPara[2];       //제휴할인 구분

                                if (aPara.Length >= 4)
                                {
                                    fForm.SetSamsungPoint = CmUtil.DoubleParse(aPara[3]);          //포인트구분
                                }

                                if (aPara.Length >= 5)
                                {
                                    fForm.SetPayAmt = aPara[4];                                     // 사용자 입력 금액
                                }

                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }                         
#endif
                        }
                        break;
                    case FormManager.FORM_PAY_CHECK:   //수표
                        {

                            // 한국이 아니면 현금 창으로 수표 금액 등록 처리 함!
                            if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
                            {
                                frmCash fForm = (frmCash)FormManager.GetForm(FormManager.FORM_PAY_CASH);
                                if (fForm == null)
                                {
                                    fForm = new frmCash();
                                    FormManager.AddForm(FormManager.FORM_PAY_CASH, fForm);
                                }

                                fForm.SetPosMenuKey = aPara[1];
                                fForm.SetPayAmt = "";
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmCheck fForm = (frmCheck)FormManager.GetForm(FormManager.FORM_PAY_CHECK);
                                if (fForm == null)
                                {
                                    fForm = new frmCheck();
                                    FormManager.AddForm(FormManager.FORM_PAY_CHECK, fForm);
                                }

                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            
                            break;
                        }
                    case FormManager.FORM_GIFT_SCH :     //상품권 조회
                        {
                            frmGiftApp fForm = (frmGiftApp)FormManager.GetForm(FormManager.FORM_GIFT_SCH);
                            if (fForm == null)
                            {
                                fForm = new frmGiftApp();
                                FormManager.AddForm(FormManager.FORM_GIFT_SCH, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];
                            fForm.SetBrandCD = "";
                            fForm.SetGitftType = "";

                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    case FormManager.FORM_MOBILE_COUPON_SCH:     //모바일쿠폰 조회
                        {
                            frmMobileCoupon fForm = (frmMobileCoupon)FormManager.GetForm(FormManager.FORM_MOBILE_COUPON_SCH);
                            if (fForm == null)
                            {
                                fForm = new frmMobileCoupon();
                                FormManager.AddForm(FormManager.FORM_MOBILE_COUPON_SCH, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];

                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    case FormManager.FORM_PAY_CASH_APPROVAL: //현금 영수증
                        {
                            frmCashBill fForm = (frmCashBill)FormManager.GetForm(FormManager.FORM_PAY_CASH_APPROVAL);
                            if (fForm == null)
                            {
                                fForm = new frmCashBill();
                                FormManager.AddForm(FormManager.FORM_PAY_CASH_APPROVAL, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];     //
                            fForm.SetCashBillAmt = aPara[2];    //승인 대상 금액
                            fForm.SetCashTaxAmt = aPara[3];     //세금(부가세)
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_POINT_MEMBERS_USE: // 제휴 멤버스 포인트 오케이캐쉬백, 오일뱅크 , 블루, 레드
                        {
                            frmPntMemberUse fForm = (frmPntMemberUse)FormManager.GetForm(FormManager.FORM_PAY_POINT_MEMBERS_USE);
                            if (fForm == null)
                            {
                                fForm = new frmPntMemberUse();
                                FormManager.AddForm(FormManager.FORM_PAY_POINT_MEMBERS_USE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    case FormManager.FORM_PAY_ALIPAY: // 알리페이
                        {
                            frmAliPay fForm = (frmAliPay)FormManager.GetForm(FormManager.FORM_PAY_ALIPAY);
                            if (fForm == null)
                            {
                                fForm = new frmAliPay();
                                FormManager.AddForm(FormManager.FORM_PAY_ALIPAY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    case FormManager.FORM_PAY_WECHATPAY: // 위챗페이
                        {
                            frmWeChatPay fForm = (frmWeChatPay)FormManager.GetForm(FormManager.FORM_PAY_WECHATPAY);
                            if (fForm == null)
                            {
                                fForm = new frmWeChatPay();
                                FormManager.AddForm(FormManager.FORM_PAY_WECHATPAY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }

                    //#20170911.001, 중국 위쳇 페이, 샤오청쉬 기프트 카드 바이롱과 연동 개발 Start, girak.kim
                    case FormManager.FORM_PAY_WECHATPAY_BAIRONG:
                        {
                            frmWeChatPayBaiRong fForm = (frmWeChatPayBaiRong)FormManager.GetForm(FormManager.FORM_PAY_WECHATPAY_BAIRONG);
                            if(fForm == null)
                            {
                                fForm = new frmWeChatPayBaiRong();
                                FormManager.AddForm(FormManager.FORM_PAY_WECHATPAY_BAIRONG, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }

                    case FormManager.FORM_PAY_XIAOCHENGXU_GIFTCARD:
                        {
                            frmXiaoChengxu_GiftCard fForm = (frmXiaoChengxu_GiftCard)FormManager.GetForm(FormManager.FORM_PAY_XIAOCHENGXU_GIFTCARD);
                            if(fForm == null)
                            {
                                fForm = new frmXiaoChengxu_GiftCard();
                                FormManager.AddForm(FormManager.FORM_PAY_XIAOCHENGXU_GIFTCARD, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }

                    //#20170911.001, 중국 위쳇 페이, 샤오청쉬 기프트 카드 바이롱과 연동 개발 End, girak.kim


                    case FormManager.FORM_PAY_SMILEPAY: // 스마일페이
                        {
                            frmSmilePay fForm = (frmSmilePay)FormManager.GetForm(FormManager.FORM_PAY_SMILEPAY);
                            if (fForm == null)
                            {
                                fForm = new frmSmilePay();
                                FormManager.AddForm(FormManager.FORM_PAY_SMILEPAY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    case FormManager.FORM_PAY_POINT_HPCOUPON:      // 해피쿠폰
                        {
                            // 해피포인트 쿠폰
                            frmPntHappyCpn fForm = (frmPntHappyCpn)FormManager.GetForm(FormManager.FORM_PAY_POINT_HPCOUPON);
                            if (fForm == null)
                            {
                                fForm = new frmPntHappyCpn();
                                FormManager.AddForm(FormManager.FORM_PAY_POINT_HPCOUPON, fForm);
                            }

                            //#15583 캠페인 기능 개선 요청 start
                            //기존
                            /*
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            */
                            //변경
                            if (CpiCheck(FormManager.FORM_PAY_POINT_HPCOUPON) == true)
                            {
                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            //#15583 캠페인 기능 개선 요청 end

                            break;
                        }
                    case FormManager.FORM_PAY_POINT_HAPPY_POINT_USE:      // 해피포인트 사용
                        {
                            // 해피포인트 사용
                            if (PosMstManager.GetPosOption(POS_OPTION.OPT316) == "2")       // 해피포인트 - 중국
                            {
                                frmPntHappyPointUse_China fForm = (frmPntHappyPointUse_China)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE_CHINA);
                                if (fForm == null)
                                {
                                    fForm = new frmPntHappyPointUse_China();
                                    FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE_CHINA, fForm);
                                }
                                fForm.SetPosMenuKey = PosKey.MENU_KEY.HAPPY_POINT_USE_CHINA;
                                fForm.SetHappyPointSave = "0";
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmPntHappyPointUse fForm = (frmPntHappyPointUse)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE);
                                if (fForm == null)
                                {
                                    fForm = new frmPntHappyPointUse();
                                    FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE, fForm);
                                }
                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            break;
                        }
                    case FormManager.FORM_PAY_DC_TOTAL:             // 전체 할인
                        {
                            frmTotItemDC fForm = (frmTotItemDC)FormManager.GetForm(FormManager.FORM_PAY_DC_TOTAL);
                            if (fForm == null)
                            {
                                fForm = new frmTotItemDC();
                                FormManager.AddForm(FormManager.FORM_PAY_DC_TOTAL, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_DC_COUPON:                // 쿠폰할인
                        {
                            frmCouponDC fForm = (frmCouponDC)FormManager.GetForm(FormManager.FORM_PAY_DC_COUPON);
                            if (fForm == null)
                            {
                                fForm = new frmCouponDC();
                                FormManager.AddForm(FormManager.FORM_PAY_DC_COUPON, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_INSTOR_DC:                // 입점매장할인
                        {
                            frmiNStorDC fForm = (frmiNStorDC)FormManager.GetForm(FormManager.FORM_INSTOR_DC);
                            if (fForm == null)
                            {
                                fForm = new frmiNStorDC();
                                FormManager.AddForm(FormManager.FORM_INSTOR_DC, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_INSTOR_PAY:               // 기타결제
                        {
                            frmiNStorDC fForm = (frmiNStorDC)FormManager.GetForm(FormManager.FORM_INSTOR_PAY);
                            if (fForm == null)
                            {
                                fForm = new frmiNStorDC();
                                FormManager.AddForm(FormManager.FORM_INSTOR_PAY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_DC_CAKE_VOUCHERS:         // 케익교환권
                        {
                            frmCakeChange fForm = (frmCakeChange)FormManager.GetForm(FormManager.FORM_PAY_DC_CAKE_VOUCHERS);
                            if (fForm == null)
                            {
                                fForm = new frmCakeChange();
                                FormManager.AddForm(FormManager.FORM_PAY_DC_CAKE_VOUCHERS, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_SEVERANCE_DC:                // 세브란스병원 임직원 할인
                        {
                            frmSeveranceDC fForm = (frmSeveranceDC)FormManager.GetForm(FormManager.FORM_SEVERANCE_DC);
                            if (fForm == null)
                            {
                                fForm = new frmSeveranceDC();
                                FormManager.AddForm(FormManager.FORM_SEVERANCE_DC, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }

                    case FormManager.FORM_PAY_MOBILE_COUPON:                     // 모바일쿠폰
                        {
                            frmMobileCoupon fForm = (frmMobileCoupon)FormManager.GetForm(FormManager.FORM_PAY_MOBILE_COUPON);
                            if (fForm == null)
                            {
                                fForm = new frmMobileCoupon();
                                FormManager.AddForm(FormManager.FORM_PAY_MOBILE_COUPON, fForm);
                            }

                            //#15583 캠페인 기능 개선 요청 start
                            //기존
                            /*
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            */
                            //변경
                            if (CpiCheck(FormManager.FORM_PAY_MOBILE_COUPON) == true)
                            {
                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            //#15583 캠페인 기능 개선 요청 end

                            break;
                        }

                    case FormManager.FORM_PAY_MOBILE_COUPON_HAPPYCON:           // 모바일쿠폰 - 차세대 해피콘
                        {
                            frmMobileCouponHappyCon fForm = (frmMobileCouponHappyCon)FormManager.GetForm(FormManager.FORM_PAY_MOBILE_COUPON_HAPPYCON);
                            if (fForm == null)
                            {
                                fForm = new frmMobileCouponHappyCon();
                                FormManager.AddForm(FormManager.FORM_PAY_MOBILE_COUPON_HAPPYCON, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            fForm.SetCouponCD = aPara[2];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    
                    case FormManager.FORM_SAMSUNG_SFC:                           //삼성카드 제휴할인 SFC
                        {
                            frmSFCCard fForm = (frmSFCCard)FormManager.GetForm(FormManager.FORM_SAMSUNG_SFC);
                            if (fForm == null)
                            {
                                fForm = new frmSFCCard();
                                FormManager.AddForm(FormManager.FORM_SAMSUNG_SFC, fForm);
                            }

                            fForm.SetPosMenuKey = aPara[1];

                            if (fForm.ShowDialog() == DialogResult.OK)
                            {
                                //카드 호출
                                sRet = WinPay.ShowForm(new string[] { FormManager.FORM_PAY_CREDITCARD, PosKey.MENU_KEY.CREDIT_CARD, ItemConst.CREDITCARD_DC_TY.CREDIT_SFC });
                                if(sRet == UserCom.RST_OK)
                                {
                                    
                                }
                            }
                            break;
                        }

                    case FormManager.FORM_INPUT_CARD:                           
                        //{
                        //    // 카드번호 입력 화면
                        //    frmInputCardCom fForm = (frmInputCardCom)FormManager.GetForm(FormManager.FORM_INPUT_CARD);
                        //    if (fForm == null)
                        //    {
                        //        fForm = new frmInputCardCom();
                        //        FormManager.AddForm(FormManager.FORM_INPUT_CARD, fForm);
                        //    }
                        //    fForm.PAY_WAY_CD = aPara[1];
                        //    fForm.SetCardNo = aPara[2];
                        //    fForm.SetAppAmt = aPara[3];
                        //    fForm.SetCardNm = aPara[4];
                        //    if (fForm.ShowDialog() == DialogResult.OK)
                        //    {
                        //        sRet = fForm.CardInfoOut;
                        //    }
                        //    break;
                        //}
                    case FormManager.FORM_SAMSUNG_POINT:                            // 삼성포인트
                        {
                            frmSamsungPoint fForm = (frmSamsungPoint)FormManager.GetForm(FormManager.FORM_SAMSUNG_POINT);
                            if (fForm == null)
                            {
                                fForm = new frmSamsungPoint();
                                FormManager.AddForm(FormManager.FORM_SAMSUNG_POINT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_WOORIMORE_POINT:                            // 우리모아포인트
                        {
                            frmSamsungPoint fForm = (frmSamsungPoint)FormManager.GetForm(FormManager.FORM_WOORIMORE_POINT);
                            if (fForm == null)
                            {
                                fForm = new frmSamsungPoint();
                                FormManager.AddForm(FormManager.FORM_WOORIMORE_POINT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_HYUNDAI_M_POINT:                            // 현대M포인트
                        {
                            frmSamsungPoint fForm = (frmSamsungPoint)FormManager.GetForm(FormManager.FORM_HYUNDAI_M_POINT);
                            if (fForm == null)
                            {
                                fForm = new frmSamsungPoint();
                                FormManager.AddForm(FormManager.FORM_HYUNDAI_M_POINT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //*** MoonSeokWoo 2017.12.12 Add
                    case FormManager.FORM_SINHANCARD_POINT:
                        {
                            frmSamsungPoint fForm = (frmSamsungPoint)FormManager.GetForm(FormManager.FORM_SINHANCARD_POINT);
                            if (fForm == null)
                            {
                                fForm = new frmSamsungPoint();
                                FormManager.AddForm(FormManager.FORM_SINHANCARD_POINT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //*** MoonSeokWoo 2017.12.12 End
                    case FormManager.FORM_PAY_MEAL_TICKET:                          // 식권
                        {
                            // 프랑스면 현금 창으로 등록 처리 함!
                            if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.FR)
                            {
                                frmCash fForm = (frmCash)FormManager.GetForm(FormManager.FORM_PAY_CASH);
                                if (fForm == null)
                                {
                                    fForm = new frmCash();
                                    FormManager.AddForm(FormManager.FORM_PAY_CASH, fForm);
                                }

                                fForm.SetPosMenuKey = aPara[1];
                                if (aPara.Length > 2)
                                {
                                    fForm.SetPayAmt = aPara[2];
                                }
                                else
                                {
                                    fForm.SetPayAmt = "";
                                }
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmMealTicket fForm = (frmMealTicket)FormManager.GetForm(FormManager.FORM_PAY_MEAL_TICKET);
                                if (fForm == null)
                                {
                                    fForm = new frmMealTicket();
                                    FormManager.AddForm(FormManager.FORM_PAY_MEAL_TICKET, fForm);
                                }
                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            break;
                        }
                    case FormManager.FORM_PAY_GIFT:                                 // 상품권
                        {
                            frmGift fForm = (frmGift)FormManager.GetForm(FormManager.FORM_PAY_GIFT);
                            if (fForm == null)
                            {
                                fForm = new frmGift();
                                FormManager.AddForm(FormManager.FORM_PAY_GIFT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    
                    case FormManager.FORM_PAY_BALANCE_VOUCHER:                      // 잔액교환권
                        {
                            // 프랑스면 현금 창으로 등록 처리 함!
                            if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.FR)
                            {
                                frmCash fForm = (frmCash)FormManager.GetForm(FormManager.FORM_PAY_CASH);
                                if (fForm == null)
                                {
                                    fForm = new frmCash();
                                    FormManager.AddForm(FormManager.FORM_PAY_CASH, fForm);
                                }

                                fForm.SetPosMenuKey = aPara[1];
                                if (aPara.Length > 2)
                                {
                                    fForm.SetPayAmt = aPara[2];
                                }
                                else
                                {
                                    fForm.SetPayAmt = "";
                                }
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            else
                            {
                                frmExchangeTicket fForm = (frmExchangeTicket)FormManager.GetForm(FormManager.FORM_PAY_BALANCE_VOUCHER);
                                if (fForm == null)
                                {
                                    fForm = new frmExchangeTicket();
                                    FormManager.AddForm(FormManager.FORM_PAY_BALANCE_VOUCHER, fForm);
                                }
                                fForm.SetPosMenuKey = aPara[1];
                                if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            }
                            break;
                        }

                    case FormManager.FORM_PAY_CREDIT_CUSTOMER:                     // 외상
                        {
                            frmSaleOnCustomer fForm = (frmSaleOnCustomer)FormManager.GetForm(FormManager.FORM_PAY_CREDIT_CUSTOMER);
                            if (fForm == null)
                            {
                                fForm = new frmSaleOnCustomer();
                                FormManager.AddForm(FormManager.FORM_PAY_CREDIT_CUSTOMER, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_FOREIGN_CURRENCY:                     // 외화
                        {
                            frmForeign fForm = (frmForeign)FormManager.GetForm(FormManager.FORM_PAY_FOREIGN_CURRENCY);
                            if (fForm == null)
                            {
                                fForm = new frmForeign();
                                FormManager.AddForm(FormManager.FORM_PAY_FOREIGN_CURRENCY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_PREPAID_CARDS:                        // 선불카드
                        {
                            frmPrepaidCard fForm = (frmPrepaidCard)FormManager.GetForm(FormManager.FORM_PAY_PREPAID_CARDS);
                            if (fForm == null)
                            {
                                fForm = new frmPrepaidCard();
                                FormManager.AddForm(FormManager.FORM_PAY_PREPAID_CARDS, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_HPJOY:                                // 선불카드 - 중국
                        {
                            frmPrepaidCard_China fForm = (frmPrepaidCard_China)FormManager.GetForm(FormManager.FORM_PAY_HPJOY);
                            if (fForm == null)
                            {
                                fForm = new frmPrepaidCard_China();
                                FormManager.AddForm(FormManager.FORM_PAY_HPJOY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_HAPPY_GIFTCARD:                                // 해피 기프트
                        {
                            frmHappyGiftUse fForm = (frmHappyGiftUse)FormManager.GetForm(FormManager.FORM_PAY_HAPPY_GIFTCARD);
                            if (fForm == null)
                            {
                                fForm = new frmHappyGiftUse();
                                FormManager.AddForm(FormManager.FORM_PAY_HAPPY_GIFTCARD, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (aPara.Length >= 3) { fForm.SetMsrCard = aPara[2]; }
                            //#20180612 신용카드, 해피기프트(신) 화면에서 해피기프트(구) 카드번호 리딩되도록 수정 start
                           
                            if (aPara.Length >= 4) { fForm.SetEncData = aPara[3]; }
                            if (aPara.Length >= 5) { fForm.SetInputType = aPara[4]; }
                           
                            //#20180612 신용카드, 해피기프트(신) 화면에서 해피기프트(구) 카드번호 리딩되도록 수정 end

                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_SAL_HP_GIFT_CHARGED:      // 해피 기프트 충전
                        {
                            frmHPGiftReChange fForm = (frmHPGiftReChange)FormManager.GetForm(FormManager.FORM_SAL_HP_GIFT_CHARGED);
                            if (fForm == null)
                            {
                                fForm = new frmHPGiftReChange();
                                FormManager.AddForm(FormManager.FORM_SAL_HP_GIFT_CHARGED, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //20171013 dkshin 해피기프트(신) IC/RF 충전 및 승인
                    case FormManager.FORM_SAL_HP_GIFT_NEW_CHARGED:      // 해피 기프트 카드(코나머니) 충전
                        {
                            frmHPGiftReChangeNew fForm = (frmHPGiftReChangeNew)FormManager.GetForm(FormManager.FORM_SAL_HP_GIFT_NEW_CHARGED);
                            if (fForm == null)
                            {
                                fForm = new frmHPGiftReChangeNew();
                                FormManager.AddForm(FormManager.FORM_SAL_HP_GIFT_NEW_CHARGED, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //case FormManager.FORM_HAPPY_POINT_SEARCH:                       // 해피 포인트 조회
                    //    {
                    //        frmPointHappyPointSch fForm = (frmPointHappyPointSch)FormManager.GetForm(FormManager.FORM_HAPPY_POINT_SEARCH);
                    //        if (fForm == null)
                    //        {
                    //            fForm = new frmPointHappyPointSch();
                    //            FormManager.AddForm(FormManager.FORM_HAPPY_POINT_SEARCH, fForm);
                    //        }
                    //        if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                    //        break;
                    //    }
                    case FormManager.FORM_SAL_BUNDLE_ITEM:                          // 묶음상품/쇼킹박스
                        {
                            frmBundleiTem fForm = (frmBundleiTem)FormManager.GetForm(FormManager.FORM_SAL_BUNDLE_ITEM);
                            if (fForm == null)
                            {
                                fForm = new frmBundleiTem();
                                FormManager.AddForm(FormManager.FORM_SAL_BUNDLE_ITEM, fForm);
                            }
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_EMP:                                  // SPC 임직원 결제
                        {
                            frmSPCEmployeeUse fForm = (frmSPCEmployeeUse)FormManager.GetForm(FormManager.FORM_PAY_EMP);
                            if (fForm == null)
                            {
                                fForm = new frmSPCEmployeeUse();
                                FormManager.AddForm(FormManager.FORM_PAY_EMP, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_SEVERANCE:                            // 세브란스 임직원 결제
                        {
                            frmSeverancePay fForm = (frmSeverancePay)FormManager.GetForm(FormManager.FORM_PAY_SEVERANCE);
                            if (fForm == null)
                            {
                                fForm = new frmSeverancePay();
                                FormManager.AddForm(FormManager.FORM_PAY_SEVERANCE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_TMONEY:                               // 티머니
                    case FormManager.FORM_PAY_CASHBEE:                              // 캐시비
                        {
                            frmTMoney fForm = (frmTMoney)FormManager.GetForm(FormManager.FORM_PAY_TMONEY);
                            if (fForm == null)
                            {
                                fForm = new frmTMoney();
                                FormManager.AddForm(FormManager.FORM_PAY_TMONEY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            fForm.SetSaleAmount = aPara[2];
                            fForm.SetSearchMode = aPara[3];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_TMONEY_SEARCH:                        // 교통카드 조회
                        {
                            frmTMoney fForm = (frmTMoney)FormManager.GetForm(FormManager.FORM_PAY_TMONEY);
                            if (fForm == null)
                            {
                                fForm = new frmTMoney();
                                FormManager.AddForm(FormManager.FORM_PAY_TMONEY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            fForm.SetSaleAmount = aPara[2];
                            fForm.SetSearchMode = aPara[3];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_OURHOME:                              // 아워홈
                        {
                            frmOurHome fForm = (frmOurHome)FormManager.GetForm(FormManager.FORM_PAY_OURHOME);
                            if (fForm == null)
                            {
                                fForm = new frmOurHome();
                                FormManager.AddForm(FormManager.FORM_PAY_OURHOME, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_HPP_REGULAR_CUST:     // 단골매장등록
                        {
                            frmPointHPRegularCust fForm = (frmPointHPRegularCust)FormManager.GetForm(FormManager.FORM_HPP_REGULAR_CUST);
                            if (fForm == null)
                            {
                                fForm = new frmPointHPRegularCust();
                                FormManager.AddForm(FormManager.FORM_HPP_REGULAR_CUST, fForm);
                            }
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_TPAY:             // T 페이 
                        {
                            frmTPay fForm = (frmTPay)FormManager.GetForm(FormManager.FORM_PAY_TPAY);
                            if (fForm == null)
                            {
                                fForm = new frmTPay();
                                FormManager.AddForm(FormManager.FORM_PAY_TPAY, fForm);
                            }
                            fForm.PosMenuKey = aPara[1];
                            fForm.SetTPayData("", "", "", "" ,"", CmUtil.DoubleParse(aPara[2]), "");
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }

                    case FormManager.FORM_PAY_ONLINE_COUPON:    // 온라인쿠폰(중국)
                        {
                            frmOnLineCoupon fForm = (frmOnLineCoupon)FormManager.GetForm(FormManager.FORM_PAY_ONLINE_COUPON);
                            if (fForm == null)
                            {
                                fForm = new frmOnLineCoupon();
                                FormManager.AddForm(FormManager.FORM_PAY_ONLINE_COUPON, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_SERVICE_CHARGE:    // Servie Charge
                        {
                            frmServiceCharge fForm = (frmServiceCharge)FormManager.GetForm(FormManager.FORM_PAY_SERVICE_CHARGE);
                            if (fForm == null)
                            {
                                fForm = new frmServiceCharge();
                                FormManager.AddForm(FormManager.FORM_PAY_SERVICE_CHARGE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_PAY_VIP_POINT:    // VIP_POINT
                        {
                            frmVipPoint fForm = (frmVipPoint)FormManager.GetForm(FormManager.FORM_PAY_VIP_POINT);
                            if (fForm == null)
                            {
                                fForm = new frmVipPoint();
                                FormManager.AddForm(FormManager.FORM_PAY_VIP_POINT, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    case FormManager.FORM_MULTI_DCITEM:    // 선택 상품 할인
                        {
                            frmMultiSlectItemDc fForm = (frmMultiSlectItemDc)FormManager.GetForm(FormManager.FORM_MULTI_DCITEM);
                            if (fForm == null)
                            {
                                fForm = new frmMultiSlectItemDc();
                                FormManager.AddForm(FormManager.FORM_MULTI_DCITEM, fForm);
                            }
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //#20170731, 해피기프트카드(코나머니) 개발 Start, srlee
                    case FormManager.FORM_HPGIFTCARD:    // 해피기프트카드(코나머니)
                        {
                            frmHappyGiftCard fForm = (frmHappyGiftCard)FormManager.GetForm(FormManager.FORM_HPGIFTCARD);
                            if (fForm == null)
                            {
                                fForm = new frmHappyGiftCard();
                                FormManager.AddForm(FormManager.FORM_HPGIFTCARD, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //#20170731, 해피기프트카드(코나머니) 개발 End, srlee

                    //#20180413 웰컴카드 신규기능 추가 start,phj
                    case FormManager.FORM_WELCOMECARD_ISSUE:
                        {
                            frmWelcomCard fForm = (frmWelcomCard)FormManager.GetForm(FormManager.FORM_WELCOMECARD_ISSUE);
                            if (fForm == null)
                            {
                                fForm = new frmWelcomCard();
                                FormManager.AddForm(FormManager.FORM_WELCOMECARD_ISSUE, fForm);
                            }
                            fForm.SetPosMenuKey = aPara.Length >= 2 ? aPara[1] : "";
                            fForm.SetOpenKey = aPara.Length >= 3 ? aPara[2] : "";
                            fForm.SetWccCardNo = aPara.Length >= 4 ? aPara[3] : "";
                            fForm.SetHPAppClient_CheckYN = aPara.Length >= 5 ? aPara[4] : "true";
                            
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

                            break;
                        }
                    //#20180413 웰컴카드 신규기능 추가 end,phj
                    
                    // 제휴카드(통합) 할인 처리(2017.08.29) -- START
                    case FormManager.FORM_PAY_POINT_MOBILE_UNITY:
                        {
                            frmPntMobileUnity fForm = (frmPntMobileUnity)FormManager.GetForm(FormManager.FORM_PAY_POINT_MOBILE_UNITY);
                            if (fForm == null)
                            {
                                fForm = new frmPntMobileUnity();
                                FormManager.AddForm(FormManager.FORM_PAY_POINT_MOBILE_UNITY, fForm);
                            }
                            fForm.SetPosMenuKey = aPara[1];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    // 제휴카드(통합) 할인 처리(2017.08.29) -- END

                    //#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 start
                    case FormManager.FORM_CPN_SEND:
                        {
                            // 해피쿠폰 발송
                            frmCpnSend fForm = (frmCpnSend)FormManager.GetForm(FormManager.FORM_CPN_SEND);
                            if (fForm == null)
                            {
                                fForm = new frmCpnSend();
                                FormManager.AddForm(FormManager.FORM_CPN_SEND, fForm);
                            }

                            fForm.SetInPutType      = aPara[1];
                            fForm.SetInMaskData     = aPara[2];
                            fForm.SetInEncData      = aPara[3];
                            fForm.SetInServiceCode  = aPara[4];
                            fForm.SetInAppCardNo    = aPara[5];
                            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
                            break;
                        }
                    //#20180418 고객 구매이력 정보 표시 및 해피쿠폰 발송 end

                    default:

                        //정의된값 없음!

                        break;
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            return sRet;
        }

        //#15583 캠페인 기능 개선 요청 start
        public static bool CpiCheck(string sPosMenuKey)
        {
            StateServer StateObject = (StateServer)StateServer.GetInstance();   // StateObject : StateServer Object (객체)

            bool bCpnDupPrmtYN = false;
            try
            {
                // TELECOM_COOP_DUP_PRMT_YN -> 제휴할인그룹 중복 여부(1:중복적용가능, 0:중복적용불가)
                // MOBILE_CPN_DUP_PRMT_YN -> 모바일쿠폰 그룹 중복 여부(1:중복적용가능, 0:중복적용불가)
                // HPY_CPN_DUP_PRMT_YN -> 해피쿠폰 사용 중복 허용 여부(1:중복적용가능, 0:중복적용불가)
                // CPI_CUST_BNFT_TYPE -> 캠페인 고객해택 구분(01:할인,02:적립,03:할인+적립,04:사은품,05:복권,06:명판,07:복권+명판,08:응모권,09:응모권+명판,10:스템프,11:할인(실효100%),12:사은품+적립,13:할인(실효))

                //기타 캠페인 체크
                ArrayList alTrSaleCpi = (ArrayList)StateObject.GetItemObject(Column.TR_SALE_CPI_RSLT.ITEM);         // 캠페인트란 아이템

                if (alTrSaleCpi != null)
                {
                    foreach (Column.TR_SALE_CPI_RSLT.DATA cTrSaleCpi in alTrSaleCpi)
                    {
                        if (cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.LOTTERY ||
                            cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.RECEIPT ||
                            cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.LOTT_REC ||
                            cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.ENTRY ||
                            cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.ENTR_REC ||
                            cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.HP_STAMP)
                        {
                            if (sPosMenuKey == FormManager.FORM_PAY_POINT_MOBILE_COM &&
                                cTrSaleCpi.TELECOM_COOP_DUP_PRMT_YN == "0" &&
                                cTrSaleCpi.LTTR_NMPLAT_NO != "")
                            {
                                bCpnDupPrmtYN = true;
                                break;
                            }
                            else if (sPosMenuKey == FormManager.FORM_PAY_POINT_HPCOUPON &&
                                     cTrSaleCpi.HPY_CPN_DUP_PRMT_YN == "0" &&
                                     cTrSaleCpi.LTTR_NMPLAT_NO != "")
                            {
                                bCpnDupPrmtYN = true;
                                break;
                            }
                            else if (sPosMenuKey == FormManager.FORM_PAY_MOBILE_COUPON &&
                                     cTrSaleCpi.MOBILE_CPN_DUP_PRMT_YN == "0" &&
                                     cTrSaleCpi.LTTR_NMPLAT_NO != "")
                            {
                                bCpnDupPrmtYN = true;
                                break;
                            }
                        }
                        else
                        {
                            if (sPosMenuKey == FormManager.FORM_PAY_MOBILE_COUPON &&
                                cTrSaleCpi.MOBILE_CPN_DUP_PRMT_YN == "0" &&
                                cTrSaleCpi.DC_SUM_AMT > 0)
                            {
                                bCpnDupPrmtYN = true;
                                break;
                            }
                            else if (sPosMenuKey == FormManager.FORM_PAY_POINT_HPCOUPON &&
                                     cTrSaleCpi.HPY_CPN_DUP_PRMT_YN == "0" &&
                                     cTrSaleCpi.DC_SUM_AMT > 0)
                            {
                                bCpnDupPrmtYN = true;
                                break;
                            }
                        }
                    }
                }

                //상품 캠페인 체크
                ArrayList alSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);

                foreach (Column.TR_PLU.DATA cPluItem in alSaleItem)
                {
                    if (cPluItem.alTrSaleCpi != null)
                    {
                        foreach (Column.TR_SALE_CPI_RSLT.DATA cTrSaleCpi in cPluItem.alTrSaleCpi)
                        {
                            if (cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.LOTTERY ||
                                cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.RECEIPT ||
                                cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.LOTT_REC ||
                                cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.ENTRY ||
                                cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.ENTR_REC ||
                                cTrSaleCpi.CPI_CUST_BNFT_TYPE == ItemConst.CPI_CUST_BNFT.HP_STAMP)
                            {
                                if (sPosMenuKey == FormManager.FORM_PAY_POINT_MOBILE_COM &&
                                    cTrSaleCpi.TELECOM_COOP_DUP_PRMT_YN == "0" &&
                                    cTrSaleCpi.LTTR_NMPLAT_NO != "")
                                {
                                    bCpnDupPrmtYN = true;
                                    break;
                                }
                                else if (sPosMenuKey == FormManager.FORM_PAY_POINT_HPCOUPON &&
                                         cTrSaleCpi.HPY_CPN_DUP_PRMT_YN == "0" &&
                                         cTrSaleCpi.LTTR_NMPLAT_NO != "")
                                {
                                    bCpnDupPrmtYN = true;
                                    break;
                                }
                                else if (sPosMenuKey == FormManager.FORM_PAY_MOBILE_COUPON &&
                                         cTrSaleCpi.MOBILE_CPN_DUP_PRMT_YN == "0" &&
                                         cTrSaleCpi.LTTR_NMPLAT_NO != "")
                                {
                                    bCpnDupPrmtYN = true;
                                    break;
                                }
                            }
                            else
                            {
                                if (sPosMenuKey == FormManager.FORM_PAY_MOBILE_COUPON &&
                                    cTrSaleCpi.MOBILE_CPN_DUP_PRMT_YN == "0" &&
                                    cTrSaleCpi.DC_SUM_AMT > 0)
                                {
                                    bCpnDupPrmtYN = true;
                                    break;
                                }
                                else if (sPosMenuKey == FormManager.FORM_PAY_POINT_HPCOUPON &&
                                         cTrSaleCpi.HPY_CPN_DUP_PRMT_YN == "0" &&
                                         cTrSaleCpi.DC_SUM_AMT > 0)
                                {
                                    bCpnDupPrmtYN = true;
                                    break;
                                }
                            }
                        }

                        if (bCpnDupPrmtYN == true)
                        {
                            break;
                        }
                    }
                }


                if (bCpnDupPrmtYN == true)
                {
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0796);
                    return false;
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            return true;
        }
        //#15583 캠페인 기능 개선 요청 end


        #region 주석
        ///// <summary>
        ///// FORM 화면 표시
        ///// </summary>
        ///// <param name="aPara"></param>
        ///// <returns></returns>
        //public static string ShowForm(string[] aPara)
        //{
        //    string sRet = UserCom.RST_ERR;
        //    frmPayBackGround fBForm = null;

        //    //---------------------------------------------------------------------------------------------
        //    // 주의 사항 - 반드시 0,1 배열값은 아래 값으로 고정해서 넘겨야한다!
        //    // aPara[0] = 스크린 아이디 (고정!)
        //    // aPara[1] = 기능키 코드   (고정!)
        //    //---------------------------------------------------------------------------------------------

        //    try
        //    {
        //        if (aPara[0] == FormManager.FORM_PAY_POINT_HAPPY_POINT)
        //        {
        //            //해피포인트 적립
        //            frmPntHappyPoint fForm = (frmPntHappyPoint)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT);
        //            if (fForm == null)
        //            {
        //                fForm = new frmPntHappyPoint();
        //                FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT, fForm);
        //            }
        //            fForm.SetPosMenuKey = aPara[1];
        //            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //            return sRet;
        //        }
        //        else if (aPara[0] == FormManager.FORM_PAY_POINT_HAPPY_POINT_USE)
        //        {
        //            // 해피포인트 사용
        //            frmPntHappyPointUse fForm = (frmPntHappyPointUse)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE);
        //            if (fForm == null)
        //            {
        //                fForm = new frmPntHappyPointUse();
        //                FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE, fForm);
        //            }
        //            fForm.SetPosMenuKey = aPara[1];
        //            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //            return sRet;
        //        }
        //        else if (aPara[0] == FormManager.FORM_PAY_POINT_HPCOUPON)
        //        {
        //            // 해피포인트 쿠폰
        //            frmPntHappyCpn fForm = (frmPntHappyCpn)FormManager.GetForm(FormManager.FORM_PAY_POINT_HPCOUPON);
        //            if (fForm == null)
        //            {
        //                fForm = new frmPntHappyCpn();
        //                FormManager.AddForm(FormManager.FORM_PAY_POINT_HPCOUPON, fForm);
        //            }
        //            fForm.SetPosMenuKey = aPara[1];
        //            if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //            return sRet;
        //        }

        //        // -------------------------------------------------------------------------------------------
        //        // 결제 검정 배경용
        //        // -------------------------------------------------------------------------------------------
        //        fBForm = (frmPayBackGround)FormManager.GetForm(FormManager.FORM_PAY_BACKGROUND);
        //        if (fBForm == null)
        //        {
        //            fBForm = new frmPayBackGround();
        //            FormManager.AddForm(FormManager.FORM_PAY_BACKGROUND, fBForm);
        //        }
        //        if (aPara.Length > 1) fBForm.SetrtbMotMainMotMsg(PosConst.MOT_MSG_TYPE.DSP_SCN_MSG, aPara[1]);
        //        fBForm.Show();
        //        // -------------------------------------------------------------------------------------------

        //        switch (aPara[0])
        //        {
        //            case FormManager.FORM_PAY_CASH:  //현금
        //                {
        //                    frmCash fForm = (frmCash)FormManager.GetForm(FormManager.FORM_PAY_CASH);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmCash();
        //                        FormManager.AddForm(FormManager.FORM_PAY_CASH, fForm);
        //                    }

        //                    if (aPara.Length > 2)
        //                    {
        //                        fForm.SetPayAmt = aPara[2];
        //                    }
        //                    else
        //                    {
        //                        fForm.SetPayAmt = "";
        //                    }

        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //                    break;
        //                }
        //            case FormManager.FORM_PAY_POINT_HAPPY_POINT:  //해피포인트
        //                {
        //                    frmPointHappyPoint fForm = (frmPointHappyPoint)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointHappyPoint();
        //                        FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //                    break;
        //                }
        //            case FormManager.FORM_PAY_POINT_MOBILE_COM:  //통신사 할인 화면 
        //                {
        //                    frmPointMobileCom fForm = (frmPointMobileCom)FormManager.GetForm(FormManager.FORM_PAY_POINT_MOBILE_COM);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointMobileCom();
        //                        FormManager.AddForm(FormManager.FORM_PAY_POINT_MOBILE_COM, fForm);
        //                    }

        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_DC_EMP:  //SPC 임직원 할인 화면 
        //                {
        //                    frmSPCEmployeeDC fForm = (frmSPCEmployeeDC)FormManager.GetForm(FormManager.FORM_PAY_DC_EMP);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSPCEmployeeDC();
        //                        FormManager.AddForm(FormManager.FORM_PAY_DC_EMP, fForm);
        //                    }

        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_CREDITCARD:   //신용카드
        //                {
        //                    frmCreditCard fForm = (frmCreditCard)FormManager.GetForm(FormManager.FORM_PAY_CREDITCARD);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmCreditCard();
        //                        FormManager.AddForm(FormManager.FORM_PAY_CREDITCARD, fForm);
        //                    }

        //                    fForm.SetDcTy = aPara[2];       //제휴할인 구분

        //                    if (aPara.Length >= 3)
        //                    {
        //                        fForm.SetSamsungPoint = m_cDataService.DoubleParse(aPara[3]);          //포인트구분
        //                    }

        //                    if (aPara.Length >= 4)
        //                    {
        //                        fForm.SetPayAmt = aPara[4];                                     // 사용자 입력 금액
        //                    }

        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_CHECK:   //수표
        //                {
        //                    frmCheck fForm = (frmCheck)FormManager.GetForm(FormManager.FORM_PAY_CHECK);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmCheck();
        //                        FormManager.AddForm(FormManager.FORM_PAY_CHECK, fForm);
        //                    }

        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //                    break;
        //                }
        //            case FormManager.FORM_PAY_CASH_APPROVAL: //현금 영수증
        //                {
        //                    frmCashBill fForm = (frmCashBill)FormManager.GetForm(FormManager.FORM_PAY_CASH_APPROVAL);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmCashBill();
        //                        FormManager.AddForm(FormManager.FORM_PAY_CASH_APPROVAL, fForm);
        //                    }
        //                    fForm.SetCashBillAmt = aPara[2];    //승인 대상 금액
        //                    fForm.SetCashTaxAmt = aPara[3];     //세금(부가세)
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_POINT_MEMBERS_USE: // 제휴 멤버스 포인트 오케이캐쉬백, 오일뱅크 , 블루, 레드
        //                {
        //                    frmPointMemberUse fForm = (frmPointMemberUse)FormManager.GetForm(FormManager.FORM_PAY_POINT_MEMBERS_USE);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointMemberUse();
        //                        FormManager.AddForm(FormManager.FORM_PAY_POINT_MEMBERS_USE, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //                    break;
        //                }
        //            case FormManager.FORM_PAY_ALIPAY: // 알리페이
        //                {
        //                    frmAliPay fForm = (frmAliPay)FormManager.GetForm(FormManager.FORM_PAY_ALIPAY);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmAliPay();
        //                        FormManager.AddForm(FormManager.FORM_PAY_ALIPAY, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;

        //                    break;
        //                }
        //            case FormManager.FORM_PAY_POINT_HPCOUPON:      // 해피쿠폰
        //                {
        //                    frmPointHappyCpn fForm = (frmPointHappyCpn)FormManager.GetForm(FormManager.FORM_PAY_POINT_HPCOUPON);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointHappyCpn();
        //                        FormManager.AddForm(FormManager.FORM_PAY_POINT_HPCOUPON, fForm);
        //                    }
        //                    fForm.SetSelectRow = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_POINT_HPCOUPON_LIST:      // 해피쿠폰(인카드쿠폰조회)
        //                {
        //                    frmPointHappyCpnList fForm = (frmPointHappyCpnList)FormManager.GetForm(FormManager.FORM_PAY_POINT_HPCOUPON_LIST);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointHappyCpnList();
        //                        FormManager.AddForm(FormManager.FORM_PAY_POINT_HPCOUPON_LIST, fForm);
        //                    }
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = fForm.GetCouponCode;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_POINT_HAPPY_POINT_USE:      // 해피포인트 사용
        //                {
        //                    frmPointHappyPointUse fForm = (frmPointHappyPointUse)FormManager.GetForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointHappyPointUse();
        //                        FormManager.AddForm(FormManager.FORM_PAY_POINT_HAPPY_POINT_USE, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_DC_TOTAL_AMT:             // 전체 금액 할인
        //                {
        //                    frmToTalDC fForm = (frmToTalDC)FormManager.GetForm(FormManager.FORM_PAY_DC_TOTAL_AMT);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmToTalDC();
        //                        FormManager.AddForm(FormManager.FORM_PAY_DC_TOTAL_AMT, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_DC_TOTAL_RATE:             // 전체 % 할인
        //                {
        //                    frmToTalDC fForm = (frmToTalDC)FormManager.GetForm(FormManager.FORM_PAY_DC_TOTAL_RATE);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmToTalDC();
        //                        FormManager.AddForm(FormManager.FORM_PAY_DC_TOTAL_RATE, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_DC_COUPON:                // 쿠폰할인
        //                {
        //                    frmCouponDC fForm = (frmCouponDC)FormManager.GetForm(FormManager.FORM_PAY_DC_COUPON);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmCouponDC();
        //                        FormManager.AddForm(FormManager.FORM_PAY_DC_COUPON, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_INSTOR_DC:                // 입점매장할인
        //                {
        //                    frmiNStorDC fForm = (frmiNStorDC)FormManager.GetForm(FormManager.FORM_INSTOR_DC);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmiNStorDC();
        //                        FormManager.AddForm(FormManager.FORM_INSTOR_DC, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_SEVERANCE_DC:                // 세브란스병원 임직원 할인
        //                {
        //                    frmSeveranceDC fForm = (frmSeveranceDC)FormManager.GetForm(FormManager.FORM_SEVERANCE_DC);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSeveranceDC();
        //                        FormManager.AddForm(FormManager.FORM_SEVERANCE_DC, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }

        //            case FormManager.FORM_PAY_MOBILE_COUPON:                     // 모바일쿠폰
        //                {
        //                    frmMobileCoupon fForm = (frmMobileCoupon)FormManager.GetForm(FormManager.FORM_PAY_ONLINE_COUPON);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmMobileCoupon();
        //                        FormManager.AddForm(FormManager.FORM_PAY_MOBILE_COUPON, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }

        //            case FormManager.FORM_SAMSUNG_SFC:                           //삼성카드 제휴할인 SFC
        //                {
        //                    frmSFCCard fForm = (frmSFCCard)FormManager.GetForm(FormManager.FORM_SAMSUNG_SFC);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSFCCard();
        //                        FormManager.AddForm(FormManager.FORM_SAMSUNG_SFC, fForm);
        //                    }
        //                    if (fForm.ShowDialog() == DialogResult.OK)
        //                    {
        //                        //카드 호출
        //                        sRet = WinPay.ShowForm(new string[] { FormManager.FORM_PAY_CREDITCARD, PosKey.MENU_KEY.CREDIT_CARD, ItemConst.CREDITCARD_DC_TY.CREDIT_SFC });
        //                        if (sRet == UserCom.RST_OK)
        //                        {

        //                        }
        //                    }
        //                    break;
        //                }

        //            case FormManager.FORM_INPUT_CARD:
        //            //{
        //            //    // 카드번호 입력 화면
        //            //    frmInputCardCom fForm = (frmInputCardCom)FormManager.GetForm(FormManager.FORM_INPUT_CARD);
        //            //    if (fForm == null)
        //            //    {
        //            //        fForm = new frmInputCardCom();
        //            //        FormManager.AddForm(FormManager.FORM_INPUT_CARD, fForm);
        //            //    }
        //            //    fForm.PAY_WAY_CD = aPara[1];
        //            //    fForm.SetCardNo = aPara[2];
        //            //    fForm.SetAppAmt = aPara[3];
        //            //    fForm.SetCardNm = aPara[4];
        //            //    if (fForm.ShowDialog() == DialogResult.OK)
        //            //    {
        //            //        sRet = fForm.CardInfoOut;
        //            //    }
        //            //    break;
        //            //}
        //            case FormManager.FORM_SAMSUNG_POINT:                            // 삼성포인트
        //                {
        //                    frmPointSamsung fForm = (frmPointSamsung)FormManager.GetForm(FormManager.FORM_SAMSUNG_POINT);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointSamsung();
        //                        FormManager.AddForm(FormManager.FORM_SAMSUNG_POINT, fForm);
        //                    }

        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_MEAL_TICKET:                          // 식권
        //                {
        //                    frmMealTicket fForm = (frmMealTicket)FormManager.GetForm(FormManager.FORM_PAY_MEAL_TICKET);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmMealTicket();
        //                        FormManager.AddForm(FormManager.FORM_PAY_MEAL_TICKET, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_GIFT:                                 // 상품권
        //                {
        //                    frmGift fForm = (frmGift)FormManager.GetForm(FormManager.FORM_PAY_GIFT);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmGift();
        //                        FormManager.AddForm(FormManager.FORM_PAY_GIFT, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }

        //            case FormManager.FORM_PAY_BALANCE_VOUCHER:                      // 잔액교환권
        //                {
        //                    frmExchangeTicket fForm = (frmExchangeTicket)FormManager.GetForm(FormManager.FORM_PAY_BALANCE_VOUCHER);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmExchangeTicket();
        //                        FormManager.AddForm(FormManager.FORM_PAY_BALANCE_VOUCHER, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }

        //            case FormManager.FORM_PAY_CREDIT_CUSTOMER:                     // 외상
        //                {
        //                    frmSaleOnCustomer fForm = (frmSaleOnCustomer)FormManager.GetForm(FormManager.FORM_PAY_CREDIT_CUSTOMER);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSaleOnCustomer();
        //                        FormManager.AddForm(FormManager.FORM_PAY_CREDIT_CUSTOMER, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_FOREIGN_CURRENCY:                     // 외화
        //                {
        //                    frmForeign fForm = (frmForeign)FormManager.GetForm(FormManager.FORM_PAY_FOREIGN_CURRENCY);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmForeign();
        //                        FormManager.AddForm(FormManager.FORM_PAY_FOREIGN_CURRENCY, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_PREPAID_CARDS:                        // 선불카드
        //                {
        //                    frmPrepaidCard fForm = (frmPrepaidCard)FormManager.GetForm(FormManager.FORM_PAY_PREPAID_CARDS);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPrepaidCard();
        //                        FormManager.AddForm(FormManager.FORM_PAY_PREPAID_CARDS, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_TMONEY_SEARCH:                        // 교통카드 조회
        //                {
        //                    frmSchTMoney fForm = (frmSchTMoney)FormManager.GetForm(FormManager.FORM_TMONEY_SEARCH);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSchTMoney();
        //                        FormManager.AddForm(FormManager.FORM_TMONEY_SEARCH, fForm);
        //                    }
        //                    //fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_HAPPY_GIFTCARD:                                // 해피 기프트
        //                {
        //                    frmHappyGiftUse fForm = (frmHappyGiftUse)FormManager.GetForm(FormManager.FORM_PAY_HAPPY_GIFTCARD);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmHappyGiftUse();
        //                        FormManager.AddForm(FormManager.FORM_PAY_HAPPY_GIFTCARD, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_SAL_HP_GIFT_CHARGED:      // 해피 기프트 충전
        //                {
        //                    frmHPGiftReChange fForm = (frmHPGiftReChange)FormManager.GetForm(FormManager.FORM_SAL_HP_GIFT_CHARGED);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmHPGiftReChange();
        //                        FormManager.AddForm(FormManager.FORM_SAL_HP_GIFT_CHARGED, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            //case FormManager.FORM_HAPPY_POINT_SEARCH:                       // 해피 포인트 조회
        //            //    {
        //            //        frmPointHappyPointSch fForm = (frmPointHappyPointSch)FormManager.GetForm(FormManager.FORM_HAPPY_POINT_SEARCH);
        //            //        if (fForm == null)
        //            //        {
        //            //            fForm = new frmPointHappyPointSch();
        //            //            FormManager.AddForm(FormManager.FORM_HAPPY_POINT_SEARCH, fForm);
        //            //        }
        //            //        if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //            //        break;
        //            //    }
        //            case FormManager.FORM_SAL_BUNDLE_ITEM:                          // 묶음상품/쇼킹박스
        //                {
        //                    frmBundleiTem fForm = (frmBundleiTem)FormManager.GetForm(FormManager.FORM_SAL_BUNDLE_ITEM);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmBundleiTem();
        //                        FormManager.AddForm(FormManager.FORM_SAL_BUNDLE_ITEM, fForm);
        //                    }
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_EMP:                                  // SPC 임직원 결제
        //                {
        //                    frmSPCEmployeeUse fForm = (frmSPCEmployeeUse)FormManager.GetForm(FormManager.FORM_PAY_EMP);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSPCEmployeeUse();
        //                        FormManager.AddForm(FormManager.FORM_PAY_EMP, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_SEVERANCE:                            // 세브란스 임직원 결제
        //                {
        //                    frmSeverancePay fForm = (frmSeverancePay)FormManager.GetForm(FormManager.FORM_PAY_SEVERANCE);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmSeverancePay();
        //                        FormManager.AddForm(FormManager.FORM_PAY_SEVERANCE, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_TMONEY:                               // 티머니
        //            case FormManager.FORM_PAY_CASHBEE:                              // 캐시비
        //                {
        //                    frmTMONEY fForm = (frmTMONEY)FormManager.GetForm(FormManager.FORM_PAY_TMONEY);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmTMONEY();
        //                        FormManager.AddForm(FormManager.FORM_PAY_TMONEY, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_PAY_OURHOME:                              // 아워홈
        //                {
        //                    frmOurHome fForm = (frmOurHome)FormManager.GetForm(FormManager.FORM_PAY_OURHOME);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmOurHome();
        //                        FormManager.AddForm(FormManager.FORM_PAY_OURHOME, fForm);
        //                    }
        //                    fForm.SetPosMenuKey = aPara[1];
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            case FormManager.FORM_HPP_REGULAR_CUST:     // 단골매장등록
        //                {
        //                    frmPointHPRegularCust fForm = (frmPointHPRegularCust)FormManager.GetForm(FormManager.FORM_HPP_REGULAR_CUST);
        //                    if (fForm == null)
        //                    {
        //                        fForm = new frmPointHPRegularCust();
        //                        FormManager.AddForm(FormManager.FORM_HPP_REGULAR_CUST, fForm);
        //                    }
        //                    if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
        //                    break;
        //                }
        //            default:

        //                //정의된값 없음!

        //                break;
        //        }

        //        fBForm.Hide();
        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
        //    }
        //    finally
        //    {
        //        //fBForm.Hide();
        //    }
        //    return sRet;
        //}
#endregion
    }
}
