using System;
using System.Text;
using System.IO;
using System.Collections;
using System.Runtime.InteropServices;
using System.Data;

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

/*-----------------------------------------------------------------------------------------------*/
// 설      명 : 캐셔 마스터
// 작  성  자 : 
// 변경  이력 : 
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
    public class CashierMaster : PosMaster, IMasterUs
    {
        public CashierMaster()
        {
         
        }

        /// <summary>
        /// 조회
        /// </summary>
        /// <param name="aParam"></param>
        /// <returns></returns>
        public DataTable Select(string[] aParam)
        {
            try
            {
                string sQuery = "";
                sQuery += " SELECT * ";
                sQuery += " FROM POSMST..MST_USER";
                sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
                sQuery += "   AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "'";
                if (aParam.Length > 0)
                {
                    sQuery += "   AND CASHIER_ID = '{0}{1}'";
                }
                if (aParam.Length > 2)
                {
                    sQuery += " AND CASHIER_DIV = '{2}'";
                }
                sQuery += "   AND USE_YN  = '" + PosConst.MST_USE_YN.YES + "'";


                if (aParam.Length == 1)
                {
                    sQuery = string.Format(sQuery, string.Empty, aParam[0]);
                }
                else if(aParam.Length == 2)
                {
                    sQuery = string.Format(sQuery, aParam[0], aParam[1]);
                }
                else if (aParam.Length == 3)
                {
                    sQuery = string.Format(sQuery, aParam[0], aParam[1], aParam[2]);
                }

                return base.Select(new string[] { sQuery });
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            return null;
        }

        public int Delete(string[] aParam)
        {
            int rows = 0;

            return rows;
        }

        public int Update(string[] aParam)
        {
            int rows = 0;

            return rows;
        }

        public int Insert(string[] aParam)
        {
            int rows = 0;

            return rows;
        }
    }
}
