/// <summary>
        /// 檢查是否已開啟線上交易的服務;
        /// 此功能會自動產生服務帳號密碼,因此僅限用於未來無需變更密碼的服務
        /// </summary>
        /// <param name="GashAccount"></param>
        /// <param name="ServiceCode"></param>
        /// <param name="ServiceRegion"></param>
        /// <param name="GashRegion"></param>
        /// <returns>1成功;0失敗;-1例外錯誤</returns>
        public int CheckOpenEventService(string GashAccount, string ServiceCode, string ServiceRegion, string GashRegion)
        {
            int Result = -1;
            string wsResult = string.Empty;
            string[] aryResult;

            using (ServiceAccount ws = new ServiceAccount())
            {
                ws.Url = GetGashWSUrl("ServiceAccount", GashRegion.ToUpper());
                try
                {
                    //WS
                    //intResult: (1 Success, 0 Failed, -1 Error)
                    //ex:"0;ServiceAccountID_Exists","0;DisplayName_Exists","0;Over_MaxAccount"
                    wsResult = ws.ServiceAccount_CreateSimple(GashAccount, ServiceCode, ServiceRegion, GashAccount);
                    aryResult = wsResult.Split(";".ToCharArray());
                    Result = (aryResult[0] == "0" || aryResult[0] == "1") ? 1 : 0;
                    OutputResult = aryResult[0];
                }
                catch(Exception ex)
                {
                    Result = -1;
                    WSException = ex;
                    aryResult = new string[] { "" };
                }
            }

            OutputMsg = (aryResult!=null && aryResult.Length > 1) ? aryResult[1] : wsResult;

            return Result;
        }
        /// <summary>     
        //        /*'==================================================================================================
        //        '程式說明:檢查是否已開啟線上交易的服務
        //        '傳入參數:	1._strMainAccountID :Gash帳號
        //        '		2.strServiceCode : 線上交易服務代碼
        //        '		3._strServiceRegion:服務區域代碼
        //        '		4._strServiceAccountID:服務帳號
        //        '傳回結果:	0; Output message -- 尚未開啟,則自動替User開啟
        //        '		1; Output message -- 已開啟
        //        '		-1; Output message -- Error
        //        '==================================================================================================*/
        public static int CheckOpenEventService(string tmpGash, string tmpServiceCode, string tmpRegion, string strGashRegion)
        {
            try
            {
                ServiceAccount sp = new ServiceAccount();

                switch (strGashRegion.ToUpper())
                {
                    case "TW":
                        sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_ServiceAccount"] ?? "");
                        break;
                    case "HK":
                        sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_ServiceAccount_HK"] ?? "");
                        break;
                    default:
                        sp.Url = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["GASHv30FWS_ServiceAccount"] ?? "");
                        break;
                }

                if (tmpGash.Length <= 0)
                { return 0; }
                else
                {
                    string myresult = sp.ServiceAccount_CreateSimple(tmpGash, tmpServiceCode, tmpRegion, tmpGash);
                    string myresult1;
                    string myresult2;

                    if (myresult.IndexOf("0;ServiceAccountID_Exists", 0, myresult.Length) >= 0 || myresult.IndexOf("0;DisplayName_Exists", 0, myresult.Length) >= 0)
                        myresult1 = "1";
                    else
                        myresult1 = "0";

                    if (myresult.IndexOf("0;Over_MaxAccount", 0, myresult.Length) >= 0)
                        myresult2 = "1";
                    else
                        myresult2 = "0";

                    myresult = myresult.Substring(0, 1);

                    if (myresult == "1" || myresult1 == "1" || myresult2 == "1")
                    { return 1; }
                    else
                    { return 0; }
                }
            }
            catch
            {
                return 0;
            }
        }